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
netket/netket
0d534e54ecbf25b677ea72af6b85947979420652
netket/graph/lattice.py
python
Lattice.vector_to_site
(self, vector: CoordT)
return self.id_from_basis_coords([*vector, 0])
Deprecated. please use :code:`id_from_basis_coords([*vector, 0])` instead.
Deprecated. please use :code:`id_from_basis_coords([*vector, 0])` instead.
[ "Deprecated", ".", "please", "use", ":", "code", ":", "id_from_basis_coords", "(", "[", "*", "vector", "0", "]", ")", "instead", "." ]
def vector_to_site(self, vector: CoordT) -> int: """Deprecated. please use :code:`id_from_basis_coords([*vector, 0])` instead.""" # Note: This only gives one site within the unit cell, so that # `vector_to_site(site_to_vector(i)) == i` is _not_ true in general, # which is consistent with the behavior of the v2 lattice. return self.id_from_basis_coords([*vector, 0])
[ "def", "vector_to_site", "(", "self", ",", "vector", ":", "CoordT", ")", "->", "int", ":", "# Note: This only gives one site within the unit cell, so that", "# `vector_to_site(site_to_vector(i)) == i` is _not_ true in general,", "# which is consistent with the behavior of the v2 lattice.", "return", "self", ".", "id_from_basis_coords", "(", "[", "*", "vector", ",", "0", "]", ")" ]
https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/graph/lattice.py#L722-L727
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/AWSPythonSDK/1.5.8/s3transfer/download.py
python
IOStreamingWriteTask._main
(self, fileobj, data)
Write data to a fileobj. Data will be written directly to the fileboj without any prior seeking. :param fileobj: The fileobj to write content to :param data: The data to write
Write data to a fileobj.
[ "Write", "data", "to", "a", "fileobj", "." ]
def _main(self, fileobj, data): """Write data to a fileobj. Data will be written directly to the fileboj without any prior seeking. :param fileobj: The fileobj to write content to :param data: The data to write """ fileobj.write(data)
[ "def", "_main", "(", "self", ",", "fileobj", ",", "data", ")", ":", "fileobj", ".", "write", "(", "data", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/s3transfer/download.py#L589-L599
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/kvstore/base.py
python
KVStoreBase.load_optimizer_states
(self, fname)
Loads the optimizer (updater) state from the file. Parameters ---------- fname : str Path to input states file.
Loads the optimizer (updater) state from the file.
[ "Loads", "the", "optimizer", "(", "updater", ")", "state", "from", "the", "file", "." ]
def load_optimizer_states(self, fname): """Loads the optimizer (updater) state from the file. Parameters ---------- fname : str Path to input states file. """ raise NotImplementedError()
[ "def", "load_optimizer_states", "(", "self", ",", "fname", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/kvstore/base.py#L174-L182
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/packager/formats.py
python
FlatFormatter._get_base
(self, path)
return mozpath.basedir(path, self._bases)
Return the deepest base directory containing the given path.
Return the deepest base directory containing the given path.
[ "Return", "the", "deepest", "base", "directory", "containing", "the", "given", "path", "." ]
def _get_base(self, path): ''' Return the deepest base directory containing the given path. ''' self._frozen_bases = True return mozpath.basedir(path, self._bases)
[ "def", "_get_base", "(", "self", ",", "path", ")", ":", "self", ".", "_frozen_bases", "=", "True", "return", "mozpath", ".", "basedir", "(", "path", ",", "self", ".", "_bases", ")" ]
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/packager/formats.py#L85-L90
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/telemetry/third_party/davclient/davclient.py
python
DAVClient.move_collection
(self, source, destination, depth='infinity', overwrite=True, headers=None)
Move DAV collection and copy all properties
Move DAV collection and copy all properties
[ "Move", "DAV", "collection", "and", "copy", "all", "properties" ]
def move_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Move DAV collection and copy all properties""" body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None: headers = {} headers['Content-Type'] = 'text/xml; charset="utf-8"' self.move(source, destination, unicode(body, 'utf-8'), depth=depth, overwrite=overwrite, headers=headers)
[ "def", "move_collection", "(", "self", ",", "source", ",", "destination", ",", "depth", "=", "'infinity'", ",", "overwrite", "=", "True", ",", "headers", "=", "None", ")", ":", "body", "=", "'<?xml version=\"1.0\" encoding=\"utf-8\" ?><d:propertybehavior xmlns:d=\"DAV:\"><d:keepalive>*</d:keepalive></d:propertybehavior>'", "# Add proper headers", "if", "headers", "is", "None", ":", "headers", "=", "{", "}", "headers", "[", "'Content-Type'", "]", "=", "'text/xml; charset=\"utf-8\"'", "self", ".", "move", "(", "source", ",", "destination", ",", "unicode", "(", "body", ",", "'utf-8'", ")", ",", "depth", "=", "depth", ",", "overwrite", "=", "overwrite", ",", "headers", "=", "headers", ")" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/third_party/davclient/davclient.py#L183-L192
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/ros_comm/rostopic/src/rostopic/__init__.py
python
CallbackEcho.__init__
(self, topic, msg_eval, plot=False, filter_fn=None, echo_clear=False, echo_all_topics=False, offset_time=False, count=None, field_filter_fn=None, fixed_numeric_width=None)
:param plot: if ``True``, echo in plotting-friendly format (csv), ``bool`` :param filter_fn: function that evaluates to ``True`` if message is to be echo'd, ``fn(topic, msg)`` :param echo_all_topics: (optional) if ``True``, echo all messages in bag, ``bool`` :param offset_time: (optional) if ``True``, display time as offset from current time, ``bool`` :param count: number of messages to echo, ``None`` for infinite, ``int`` :param field_filter_fn: filter the fields that are strified for Messages, ``fn(Message)->iter(str)`` :param fixed_numeric_width: fixed width for numeric values, ``None`` for automatic, ``int``
:param plot: if ``True``, echo in plotting-friendly format (csv), ``bool`` :param filter_fn: function that evaluates to ``True`` if message is to be echo'd, ``fn(topic, msg)`` :param echo_all_topics: (optional) if ``True``, echo all messages in bag, ``bool`` :param offset_time: (optional) if ``True``, display time as offset from current time, ``bool`` :param count: number of messages to echo, ``None`` for infinite, ``int`` :param field_filter_fn: filter the fields that are strified for Messages, ``fn(Message)->iter(str)`` :param fixed_numeric_width: fixed width for numeric values, ``None`` for automatic, ``int``
[ ":", "param", "plot", ":", "if", "True", "echo", "in", "plotting", "-", "friendly", "format", "(", "csv", ")", "bool", ":", "param", "filter_fn", ":", "function", "that", "evaluates", "to", "True", "if", "message", "is", "to", "be", "echo", "d", "fn", "(", "topic", "msg", ")", ":", "param", "echo_all_topics", ":", "(", "optional", ")", "if", "True", "echo", "all", "messages", "in", "bag", "bool", ":", "param", "offset_time", ":", "(", "optional", ")", "if", "True", "display", "time", "as", "offset", "from", "current", "time", "bool", ":", "param", "count", ":", "number", "of", "messages", "to", "echo", "None", "for", "infinite", "int", ":", "param", "field_filter_fn", ":", "filter", "the", "fields", "that", "are", "strified", "for", "Messages", "fn", "(", "Message", ")", "-", ">", "iter", "(", "str", ")", ":", "param", "fixed_numeric_width", ":", "fixed", "width", "for", "numeric", "values", "None", "for", "automatic", "int" ]
def __init__(self, topic, msg_eval, plot=False, filter_fn=None, echo_clear=False, echo_all_topics=False, offset_time=False, count=None, field_filter_fn=None, fixed_numeric_width=None): """ :param plot: if ``True``, echo in plotting-friendly format (csv), ``bool`` :param filter_fn: function that evaluates to ``True`` if message is to be echo'd, ``fn(topic, msg)`` :param echo_all_topics: (optional) if ``True``, echo all messages in bag, ``bool`` :param offset_time: (optional) if ``True``, display time as offset from current time, ``bool`` :param count: number of messages to echo, ``None`` for infinite, ``int`` :param field_filter_fn: filter the fields that are strified for Messages, ``fn(Message)->iter(str)`` :param fixed_numeric_width: fixed width for numeric values, ``None`` for automatic, ``int`` """ if topic and topic[-1] == '/': topic = topic[:-1] self.topic = topic self.msg_eval = msg_eval self.plot = plot self.filter_fn = filter_fn self.fixed_numeric_width = fixed_numeric_width self.prefix = '' self.suffix = '\n---' if not plot else ''# same as YAML document separator, bug #3291 self.echo_all_topics = echo_all_topics self.offset_time = offset_time # done tracks when we've exceeded the count self.done = False self.max_count = count self.count = 0 # determine which strifying function to use if plot: #TODOXXX: need to pass in filter function self.str_fn = _str_plot self.sep = '' else: #TODOXXX: need to pass in filter function self.str_fn = self.custom_strify_message if echo_clear: self.prefix = '\033[2J\033[;H' self.field_filter=field_filter_fn # first tracks whether or not we've printed anything yet. Need this for printing plot fields. self.first = True # cache self.last_topic = None self.last_msg_eval = None
[ "def", "__init__", "(", "self", ",", "topic", ",", "msg_eval", ",", "plot", "=", "False", ",", "filter_fn", "=", "None", ",", "echo_clear", "=", "False", ",", "echo_all_topics", "=", "False", ",", "offset_time", "=", "False", ",", "count", "=", "None", ",", "field_filter_fn", "=", "None", ",", "fixed_numeric_width", "=", "None", ")", ":", "if", "topic", "and", "topic", "[", "-", "1", "]", "==", "'/'", ":", "topic", "=", "topic", "[", ":", "-", "1", "]", "self", ".", "topic", "=", "topic", "self", ".", "msg_eval", "=", "msg_eval", "self", ".", "plot", "=", "plot", "self", ".", "filter_fn", "=", "filter_fn", "self", ".", "fixed_numeric_width", "=", "fixed_numeric_width", "self", ".", "prefix", "=", "''", "self", ".", "suffix", "=", "'\\n---'", "if", "not", "plot", "else", "''", "# same as YAML document separator, bug #3291", "self", ".", "echo_all_topics", "=", "echo_all_topics", "self", ".", "offset_time", "=", "offset_time", "# done tracks when we've exceeded the count", "self", ".", "done", "=", "False", "self", ".", "max_count", "=", "count", "self", ".", "count", "=", "0", "# determine which strifying function to use", "if", "plot", ":", "#TODOXXX: need to pass in filter function", "self", ".", "str_fn", "=", "_str_plot", "self", ".", "sep", "=", "''", "else", ":", "#TODOXXX: need to pass in filter function", "self", ".", "str_fn", "=", "self", ".", "custom_strify_message", "if", "echo_clear", ":", "self", ".", "prefix", "=", "'\\033[2J\\033[;H'", "self", ".", "field_filter", "=", "field_filter_fn", "# first tracks whether or not we've printed anything yet. Need this for printing plot fields.", "self", ".", "first", "=", "True", "# cache", "self", ".", "last_topic", "=", "None", "self", ".", "last_msg_eval", "=", "None" ]
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rostopic/src/rostopic/__init__.py#L715-L765
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py
python
mbox.__init__
(self, path, factory=None, create=True)
Initialize an mbox mailbox.
Initialize an mbox mailbox.
[ "Initialize", "an", "mbox", "mailbox", "." ]
def __init__(self, path, factory=None, create=True): """Initialize an mbox mailbox.""" self._message_factory = mboxMessage _mboxMMDF.__init__(self, path, factory, create)
[ "def", "__init__", "(", "self", ",", "path", ",", "factory", "=", "None", ",", "create", "=", "True", ")", ":", "self", ".", "_message_factory", "=", "mboxMessage", "_mboxMMDF", ".", "__init__", "(", "self", ",", "path", ",", "factory", ",", "create", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py#L844-L847
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
python
_RegistryGetValue
(key, value)
return match.group(1)
Use _winreg or reg.exe to obtain the value of a registry key. Using _winreg is preferable because it solves an issue on some corporate environments where access to reg.exe is locked down. However, we still need to fallback to reg.exe for the case where the _winreg module is not available (for example in cygwin python). Args: key: The registry key. value: The particular registry value to read. Return: contents of the registry key's value, or None on failure.
Use _winreg or reg.exe to obtain the value of a registry key.
[ "Use", "_winreg", "or", "reg", ".", "exe", "to", "obtain", "the", "value", "of", "a", "registry", "key", "." ]
def _RegistryGetValue(key, value): """Use _winreg or reg.exe to obtain the value of a registry key. Using _winreg is preferable because it solves an issue on some corporate environments where access to reg.exe is locked down. However, we still need to fallback to reg.exe for the case where the _winreg module is not available (for example in cygwin python). Args: key: The registry key. value: The particular registry value to read. Return: contents of the registry key's value, or None on failure. """ try: return _RegistryGetValueUsingWinReg(key, value) except ImportError: pass # Fallback to reg.exe if we fail to import _winreg. text = _RegistryQuery(key, value) if not text: return None # Extract value. match = re.search(r'REG_\w+\s+([^\r]+)\r\n', text) if not match: return None return match.group(1)
[ "def", "_RegistryGetValue", "(", "key", ",", "value", ")", ":", "try", ":", "return", "_RegistryGetValueUsingWinReg", "(", "key", ",", "value", ")", "except", "ImportError", ":", "pass", "# Fallback to reg.exe if we fail to import _winreg.", "text", "=", "_RegistryQuery", "(", "key", ",", "value", ")", "if", "not", "text", ":", "return", "None", "# Extract value.", "match", "=", "re", ".", "search", "(", "r'REG_\\w+\\s+([^\\r]+)\\r\\n'", ",", "text", ")", "if", "not", "match", ":", "return", "None", "return", "match", ".", "group", "(", "1", ")" ]
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py#L199-L226
bulletphysics/bullet3
f0f2a952e146f016096db6f85cf0c44ed75b0b9a
examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py
python
lambda_advantage
(reward, value, length, discount)
return tf.check_numerics(tf.stop_gradient(advantage), 'advantage')
Generalized Advantage Estimation.
Generalized Advantage Estimation.
[ "Generalized", "Advantage", "Estimation", "." ]
def lambda_advantage(reward, value, length, discount): """Generalized Advantage Estimation.""" timestep = tf.range(reward.shape[1].value) mask = tf.cast(timestep[None, :] < length[:, None], tf.float32) next_value = tf.concat([value[:, 1:], tf.zeros_like(value[:, -1:])], 1) delta = reward + discount * next_value - value advantage = tf.reverse( tf.transpose( tf.scan(lambda agg, cur: cur + discount * agg, tf.transpose(tf.reverse(mask * delta, [1]), [1, 0]), tf.zeros_like(delta[:, -1]), 1, False), [1, 0]), [1]) return tf.check_numerics(tf.stop_gradient(advantage), 'advantage')
[ "def", "lambda_advantage", "(", "reward", ",", "value", ",", "length", ",", "discount", ")", ":", "timestep", "=", "tf", ".", "range", "(", "reward", ".", "shape", "[", "1", "]", ".", "value", ")", "mask", "=", "tf", ".", "cast", "(", "timestep", "[", "None", ",", ":", "]", "<", "length", "[", ":", ",", "None", "]", ",", "tf", ".", "float32", ")", "next_value", "=", "tf", ".", "concat", "(", "[", "value", "[", ":", ",", "1", ":", "]", ",", "tf", ".", "zeros_like", "(", "value", "[", ":", ",", "-", "1", ":", "]", ")", "]", ",", "1", ")", "delta", "=", "reward", "+", "discount", "*", "next_value", "-", "value", "advantage", "=", "tf", ".", "reverse", "(", "tf", ".", "transpose", "(", "tf", ".", "scan", "(", "lambda", "agg", ",", "cur", ":", "cur", "+", "discount", "*", "agg", ",", "tf", ".", "transpose", "(", "tf", ".", "reverse", "(", "mask", "*", "delta", ",", "[", "1", "]", ")", ",", "[", "1", ",", "0", "]", ")", ",", "tf", ".", "zeros_like", "(", "delta", "[", ":", ",", "-", "1", "]", ")", ",", "1", ",", "False", ")", ",", "[", "1", ",", "0", "]", ")", ",", "[", "1", "]", ")", "return", "tf", ".", "check_numerics", "(", "tf", ".", "stop_gradient", "(", "advantage", ")", ",", "'advantage'", ")" ]
https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py#L117-L128
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/auibar.py
python
AuiToolBar.SetMarginsSize
(self, size)
Set the values to be used as margins for the toolbar. :param Size `size`: the margin size (an instance of :class:`Size`).
Set the values to be used as margins for the toolbar.
[ "Set", "the", "values", "to", "be", "used", "as", "margins", "for", "the", "toolbar", "." ]
def SetMarginsSize(self, size): """ Set the values to be used as margins for the toolbar. :param Size `size`: the margin size (an instance of :class:`Size`). """ self.SetMargins(size.x, size.x, size.y, size.y)
[ "def", "SetMarginsSize", "(", "self", ",", "size", ")", ":", "self", ".", "SetMargins", "(", "size", ".", "x", ",", "size", ".", "x", ",", "size", ".", "y", ",", "size", ".", "y", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L2453-L2460
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/estimator/inputs/queues/feeding_queue_runner.py
python
_FeedingQueueRunner._run
(self, sess, enqueue_op, feed_fn, coord=None)
Execute the enqueue op in a loop, close the queue in case of error. Args: sess: A `Session`. enqueue_op: The `Operation` to run. feed_fn: the feed function to pass to `sess.run`. coord: Optional `Coordinator` object for reporting errors and checking for stop conditions.
Execute the enqueue op in a loop, close the queue in case of error.
[ "Execute", "the", "enqueue", "op", "in", "a", "loop", "close", "the", "queue", "in", "case", "of", "error", "." ]
def _run(self, sess, enqueue_op, feed_fn, coord=None): """Execute the enqueue op in a loop, close the queue in case of error. Args: sess: A `Session`. enqueue_op: The `Operation` to run. feed_fn: the feed function to pass to `sess.run`. coord: Optional `Coordinator` object for reporting errors and checking for stop conditions. """ # TODO(jamieas): Reduce code duplication with `QueueRunner`. if coord: coord.register_thread(threading.current_thread()) decremented = False try: while True: if coord and coord.should_stop(): break try: feed_dict = None if feed_fn is None else feed_fn() sess.run(enqueue_op, feed_dict=feed_dict) except (errors.OutOfRangeError, errors.CancelledError): # This exception indicates that a queue was closed. with self._lock: self._runs_per_session[sess] -= 1 decremented = True if self._runs_per_session[sess] == 0: try: sess.run(self._close_op) except Exception as e: # Intentionally ignore errors from close_op. logging.vlog(1, "Ignored exception: %s", str(e)) return except Exception as e: # This catches all other exceptions. if coord: coord.request_stop(e) else: logging.error("Exception in QueueRunner: %s", str(e)) with self._lock: self._exceptions_raised.append(e) raise finally: # Make sure we account for all terminations: normal or errors. if not decremented: with self._lock: self._runs_per_session[sess] -= 1
[ "def", "_run", "(", "self", ",", "sess", ",", "enqueue_op", ",", "feed_fn", ",", "coord", "=", "None", ")", ":", "# TODO(jamieas): Reduce code duplication with `QueueRunner`.", "if", "coord", ":", "coord", ".", "register_thread", "(", "threading", ".", "current_thread", "(", ")", ")", "decremented", "=", "False", "try", ":", "while", "True", ":", "if", "coord", "and", "coord", ".", "should_stop", "(", ")", ":", "break", "try", ":", "feed_dict", "=", "None", "if", "feed_fn", "is", "None", "else", "feed_fn", "(", ")", "sess", ".", "run", "(", "enqueue_op", ",", "feed_dict", "=", "feed_dict", ")", "except", "(", "errors", ".", "OutOfRangeError", ",", "errors", ".", "CancelledError", ")", ":", "# This exception indicates that a queue was closed.", "with", "self", ".", "_lock", ":", "self", ".", "_runs_per_session", "[", "sess", "]", "-=", "1", "decremented", "=", "True", "if", "self", ".", "_runs_per_session", "[", "sess", "]", "==", "0", ":", "try", ":", "sess", ".", "run", "(", "self", ".", "_close_op", ")", "except", "Exception", "as", "e", ":", "# Intentionally ignore errors from close_op.", "logging", ".", "vlog", "(", "1", ",", "\"Ignored exception: %s\"", ",", "str", "(", "e", ")", ")", "return", "except", "Exception", "as", "e", ":", "# This catches all other exceptions.", "if", "coord", ":", "coord", ".", "request_stop", "(", "e", ")", "else", ":", "logging", ".", "error", "(", "\"Exception in QueueRunner: %s\"", ",", "str", "(", "e", ")", ")", "with", "self", ".", "_lock", ":", "self", ".", "_exceptions_raised", ".", "append", "(", "e", ")", "raise", "finally", ":", "# Make sure we account for all terminations: normal or errors.", "if", "not", "decremented", ":", "with", "self", ".", "_lock", ":", "self", ".", "_runs_per_session", "[", "sess", "]", "-=", "1" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/estimator/inputs/queues/feeding_queue_runner.py#L73-L120
koth/kcws
88efbd36a7022de4e6e90f5a1fb880cf87cfae9f
third_party/setuptools/pkg_resources.py
python
load_entry_point
(dist, group, name)
return get_distribution(dist).load_entry_point(group, name)
Return `name` entry point of `group` for `dist` or raise ImportError
Return `name` entry point of `group` for `dist` or raise ImportError
[ "Return", "name", "entry", "point", "of", "group", "for", "dist", "or", "raise", "ImportError" ]
def load_entry_point(dist, group, name): """Return `name` entry point of `group` for `dist` or raise ImportError""" return get_distribution(dist).load_entry_point(group, name)
[ "def", "load_entry_point", "(", "dist", ",", "group", ",", "name", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "load_entry_point", "(", "group", ",", "name", ")" ]
https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/setuptools/pkg_resources.py#L354-L356
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/data/experimental/ops/readers.py
python
_infer_column_names
(filenames, field_delim, use_quote_delim, file_io_fn)
return column_names
Infers column names from first rows of files.
Infers column names from first rows of files.
[ "Infers", "column", "names", "from", "first", "rows", "of", "files", "." ]
def _infer_column_names(filenames, field_delim, use_quote_delim, file_io_fn): """Infers column names from first rows of files.""" csv_kwargs = { "delimiter": field_delim, "quoting": csv.QUOTE_MINIMAL if use_quote_delim else csv.QUOTE_NONE } with file_io_fn(filenames[0]) as f: try: column_names = next(csv.reader(f, **csv_kwargs)) except StopIteration: raise ValueError("Failed when reading the header line of " f"{filenames[0]}. Is it an empty file?") for name in filenames[1:]: with file_io_fn(name) as f: try: if next(csv.reader(f, **csv_kwargs)) != column_names: raise ValueError( "All input CSV files should have the same column names in the " f"header row. File {name} has different column names.") except StopIteration: raise ValueError("Failed when reading the header line of " f"{name}. Is it an empty file?") return column_names
[ "def", "_infer_column_names", "(", "filenames", ",", "field_delim", ",", "use_quote_delim", ",", "file_io_fn", ")", ":", "csv_kwargs", "=", "{", "\"delimiter\"", ":", "field_delim", ",", "\"quoting\"", ":", "csv", ".", "QUOTE_MINIMAL", "if", "use_quote_delim", "else", "csv", ".", "QUOTE_NONE", "}", "with", "file_io_fn", "(", "filenames", "[", "0", "]", ")", "as", "f", ":", "try", ":", "column_names", "=", "next", "(", "csv", ".", "reader", "(", "f", ",", "*", "*", "csv_kwargs", ")", ")", "except", "StopIteration", ":", "raise", "ValueError", "(", "\"Failed when reading the header line of \"", "f\"{filenames[0]}. Is it an empty file?\"", ")", "for", "name", "in", "filenames", "[", "1", ":", "]", ":", "with", "file_io_fn", "(", "name", ")", "as", "f", ":", "try", ":", "if", "next", "(", "csv", ".", "reader", "(", "f", ",", "*", "*", "csv_kwargs", ")", ")", "!=", "column_names", ":", "raise", "ValueError", "(", "\"All input CSV files should have the same column names in the \"", "f\"header row. File {name} has different column names.\"", ")", "except", "StopIteration", ":", "raise", "ValueError", "(", "\"Failed when reading the header line of \"", "f\"{name}. Is it an empty file?\"", ")", "return", "column_names" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/data/experimental/ops/readers.py#L157-L180
rodeofx/OpenWalter
6116fbe3f04f1146c854afbfbdbe944feaee647e
walter/maya/scripts/AEwalterStandinTemplate.py
python
AEwalterStandinTemplate.__toolbarNew
(self, plug)
Create the Panel button.
Create the Panel button.
[ "Create", "the", "Panel", "button", "." ]
def __toolbarNew(self, plug): """Create the Panel button.""" currentWidget = self.__currentWidget() toolbar = WalterToolbar(currentWidget, self._nodeName) currentWidget.layout().addWidget(toolbar) toolbar.setObjectName("abcToolbarWidget") self.__toolbarReplace(plug)
[ "def", "__toolbarNew", "(", "self", ",", "plug", ")", ":", "currentWidget", "=", "self", ".", "__currentWidget", "(", ")", "toolbar", "=", "WalterToolbar", "(", "currentWidget", ",", "self", ".", "_nodeName", ")", "currentWidget", ".", "layout", "(", ")", ".", "addWidget", "(", "toolbar", ")", "toolbar", ".", "setObjectName", "(", "\"abcToolbarWidget\"", ")", "self", ".", "__toolbarReplace", "(", "plug", ")" ]
https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/maya/scripts/AEwalterStandinTemplate.py#L380-L387
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/grit/grit/format/policy_templates/writers/plist_strings_writer.py
python
PListStringsWriter.WritePolicy
(self, policy)
Add strings to the stringtable corresponding a given policy. Args: policy: The policy for which the strings will be added to the string table.
Add strings to the stringtable corresponding a given policy.
[ "Add", "strings", "to", "the", "stringtable", "corresponding", "a", "given", "policy", "." ]
def WritePolicy(self, policy): '''Add strings to the stringtable corresponding a given policy. Args: policy: The policy for which the strings will be added to the string table. ''' desc = policy['desc'] if policy['type'] == 'external': # This type can only be set through cloud policy. return elif policy['type'] in ('int-enum','string-enum', 'string-enum-list'): # Append the captions of enum items to the description string. item_descs = [] for item in policy['items']: item_descs.append(str(item['value']) + ' - ' + item['caption']) desc = '\n'.join(item_descs) + '\n' + desc self._AddToStringTable(policy['name'], policy['label'], desc)
[ "def", "WritePolicy", "(", "self", ",", "policy", ")", ":", "desc", "=", "policy", "[", "'desc'", "]", "if", "policy", "[", "'type'", "]", "==", "'external'", ":", "# This type can only be set through cloud policy.", "return", "elif", "policy", "[", "'type'", "]", "in", "(", "'int-enum'", ",", "'string-enum'", ",", "'string-enum-list'", ")", ":", "# Append the captions of enum items to the description string.", "item_descs", "=", "[", "]", "for", "item", "in", "policy", "[", "'items'", "]", ":", "item_descs", ".", "append", "(", "str", "(", "item", "[", "'value'", "]", ")", "+", "' - '", "+", "item", "[", "'caption'", "]", ")", "desc", "=", "'\\n'", ".", "join", "(", "item_descs", ")", "+", "'\\n'", "+", "desc", "self", ".", "_AddToStringTable", "(", "policy", "[", "'name'", "]", ",", "policy", "[", "'label'", "]", ",", "desc", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/policy_templates/writers/plist_strings_writer.py#L47-L65
OGRECave/ogre
d2cae7220c21e9cf6cc5a00b35c351c38914bcf0
Tools/Wings3DExporter/pgon.py
python
Triangulator.this_v
(self, vert)
return self.pgon[vert]
return position of given vertex
return position of given vertex
[ "return", "position", "of", "given", "vertex" ]
def this_v(self, vert): "return position of given vertex" return self.pgon[vert]
[ "def", "this_v", "(", "self", ",", "vert", ")", ":", "return", "self", ".", "pgon", "[", "vert", "]" ]
https://github.com/OGRECave/ogre/blob/d2cae7220c21e9cf6cc5a00b35c351c38914bcf0/Tools/Wings3DExporter/pgon.py#L54-L56
numworks/epsilon
8952d2f8b1de1c3f064eec8ffcea804c5594ba4c
build/device/usb/util.py
python
dispose_resources
(device)
r"""Release internal resources allocated by the object. Sometimes you need to provide deterministic resources freeing, for example to allow another application to talk to the device. As Python does not provide deterministic destruction, this function releases all internal resources allocated by the device, like device handle and interface policy. After calling this function, you can continue using the device object normally. If the resources will be necessary again, it will be allocated automatically.
r"""Release internal resources allocated by the object.
[ "r", "Release", "internal", "resources", "allocated", "by", "the", "object", "." ]
def dispose_resources(device): r"""Release internal resources allocated by the object. Sometimes you need to provide deterministic resources freeing, for example to allow another application to talk to the device. As Python does not provide deterministic destruction, this function releases all internal resources allocated by the device, like device handle and interface policy. After calling this function, you can continue using the device object normally. If the resources will be necessary again, it will be allocated automatically. """ device._ctx.dispose(device)
[ "def", "dispose_resources", "(", "device", ")", ":", "device", ".", "_ctx", ".", "dispose", "(", "device", ")" ]
https://github.com/numworks/epsilon/blob/8952d2f8b1de1c3f064eec8ffcea804c5594ba4c/build/device/usb/util.py#L221-L235
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/symbol/random.py
python
randint
(low, high, shape=_Null, dtype=_Null, **kwargs)
return _random_helper(_internal._random_randint, None, [low, high], shape, dtype, kwargs)
Draw random samples from a discrete uniform distribution. Samples are uniformly distributed over the half-open interval *[low, high)* (includes *low*, but excludes *high*). Parameters ---------- low : int, required Lower boundary of the output interval. All values generated will be greater than or equal to low. high : int, required Upper boundary of the output interval. All values generated will be less than high. shape : int or tuple of ints, optional The number of samples to draw. If shape is, e.g., `(m, n)` and `low` and `high` are scalars, output shape will be `(m, n)`. dtype : {'int32', 'int64'}, optional Data type of output samples. Default is 'int32' Returns ------- Symbol If input `shape` has dimensions, e.g., `(m, n)`, and `low` and `high` are scalars, returned Symbol will resolve to shape `(m, n)`.
Draw random samples from a discrete uniform distribution.
[ "Draw", "random", "samples", "from", "a", "discrete", "uniform", "distribution", "." ]
def randint(low, high, shape=_Null, dtype=_Null, **kwargs): """Draw random samples from a discrete uniform distribution. Samples are uniformly distributed over the half-open interval *[low, high)* (includes *low*, but excludes *high*). Parameters ---------- low : int, required Lower boundary of the output interval. All values generated will be greater than or equal to low. high : int, required Upper boundary of the output interval. All values generated will be less than high. shape : int or tuple of ints, optional The number of samples to draw. If shape is, e.g., `(m, n)` and `low` and `high` are scalars, output shape will be `(m, n)`. dtype : {'int32', 'int64'}, optional Data type of output samples. Default is 'int32' Returns ------- Symbol If input `shape` has dimensions, e.g., `(m, n)`, and `low` and `high` are scalars, returned Symbol will resolve to shape `(m, n)`. """ return _random_helper(_internal._random_randint, None, [low, high], shape, dtype, kwargs)
[ "def", "randint", "(", "low", ",", "high", ",", "shape", "=", "_Null", ",", "dtype", "=", "_Null", ",", "*", "*", "kwargs", ")", ":", "return", "_random_helper", "(", "_internal", ".", "_random_randint", ",", "None", ",", "[", "low", ",", "high", "]", ",", "shape", ",", "dtype", ",", "kwargs", ")" ]
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/random.py#L461-L488
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/grid_rnn/python/ops/grid_rnn_cell.py
python
_propagate
(dim_indices, conf, cells, c_prev, m_prev, new_output, new_state, first_call)
Propagates through all the cells in dim_indices dimensions.
Propagates through all the cells in dim_indices dimensions.
[ "Propagates", "through", "all", "the", "cells", "in", "dim_indices", "dimensions", "." ]
def _propagate(dim_indices, conf, cells, c_prev, m_prev, new_output, new_state, first_call): """Propagates through all the cells in dim_indices dimensions. """ if len(dim_indices) == 0: return # Because of the way RNNCells are implemented, we take the last dimension # (H_{N-1}) out and feed it as the state of the RNN cell # (in `last_dim_output`). # The input of the cell (H_0 to H_{N-2}) are concatenated into `cell_inputs` if conf.num_dims > 1: ls_cell_inputs = [None] * (conf.num_dims - 1) for d in conf.dims[:-1]: if new_output[d.idx] is None: ls_cell_inputs[d.idx] = m_prev[d.idx] else: ls_cell_inputs[d.idx] = new_output[d.idx] cell_inputs = array_ops.concat(ls_cell_inputs, 1) else: cell_inputs = array_ops.zeros([m_prev[0].get_shape().as_list()[0], 0], m_prev[0].dtype) last_dim_output = (new_output[-1] if new_output[-1] is not None else m_prev[-1]) for i in dim_indices: d = conf.dims[i] if d.non_recurrent_fn: if conf.num_dims > 1: linear_args = array_ops.concat([cell_inputs, last_dim_output], 1) else: linear_args = last_dim_output with vs.variable_scope('non_recurrent' if conf.tied else 'non_recurrent/cell_{}'.format(i)): if conf.tied and not (first_call and i == dim_indices[0]): vs.get_variable_scope().reuse_variables() new_output[d.idx] = layers.fully_connected( linear_args, num_outputs=conf.num_units, activation_fn=d.non_recurrent_fn, weights_initializer=(vs.get_variable_scope().initializer or layers.initializers.xavier_initializer), weights_regularizer=vs.get_variable_scope().regularizer) else: if c_prev[i] is not None: cell_state = (c_prev[i], last_dim_output) else: # for GRU/RNN, the state is just the previous output cell_state = last_dim_output with vs.variable_scope('recurrent' if conf.tied else 'recurrent/cell_{}'.format(i)): if conf.tied and not (first_call and i == dim_indices[0]): vs.get_variable_scope().reuse_variables() cell = cells[i] new_output[d.idx], new_state[d.idx] = cell(cell_inputs, cell_state)
[ "def", "_propagate", "(", "dim_indices", ",", "conf", ",", "cells", ",", "c_prev", ",", "m_prev", ",", "new_output", ",", "new_state", ",", "first_call", ")", ":", "if", "len", "(", "dim_indices", ")", "==", "0", ":", "return", "# Because of the way RNNCells are implemented, we take the last dimension", "# (H_{N-1}) out and feed it as the state of the RNN cell", "# (in `last_dim_output`).", "# The input of the cell (H_0 to H_{N-2}) are concatenated into `cell_inputs`", "if", "conf", ".", "num_dims", ">", "1", ":", "ls_cell_inputs", "=", "[", "None", "]", "*", "(", "conf", ".", "num_dims", "-", "1", ")", "for", "d", "in", "conf", ".", "dims", "[", ":", "-", "1", "]", ":", "if", "new_output", "[", "d", ".", "idx", "]", "is", "None", ":", "ls_cell_inputs", "[", "d", ".", "idx", "]", "=", "m_prev", "[", "d", ".", "idx", "]", "else", ":", "ls_cell_inputs", "[", "d", ".", "idx", "]", "=", "new_output", "[", "d", ".", "idx", "]", "cell_inputs", "=", "array_ops", ".", "concat", "(", "ls_cell_inputs", ",", "1", ")", "else", ":", "cell_inputs", "=", "array_ops", ".", "zeros", "(", "[", "m_prev", "[", "0", "]", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", "0", "]", ",", "0", "]", ",", "m_prev", "[", "0", "]", ".", "dtype", ")", "last_dim_output", "=", "(", "new_output", "[", "-", "1", "]", "if", "new_output", "[", "-", "1", "]", "is", "not", "None", "else", "m_prev", "[", "-", "1", "]", ")", "for", "i", "in", "dim_indices", ":", "d", "=", "conf", ".", "dims", "[", "i", "]", "if", "d", ".", "non_recurrent_fn", ":", "if", "conf", ".", "num_dims", ">", "1", ":", "linear_args", "=", "array_ops", ".", "concat", "(", "[", "cell_inputs", ",", "last_dim_output", "]", ",", "1", ")", "else", ":", "linear_args", "=", "last_dim_output", "with", "vs", ".", "variable_scope", "(", "'non_recurrent'", "if", "conf", ".", "tied", "else", "'non_recurrent/cell_{}'", ".", "format", "(", "i", ")", ")", ":", "if", "conf", ".", "tied", "and", "not", "(", "first_call", "and", "i", "==", "dim_indices", "[", "0", "]", ")", ":", "vs", ".", "get_variable_scope", "(", ")", ".", "reuse_variables", "(", ")", "new_output", "[", "d", ".", "idx", "]", "=", "layers", ".", "fully_connected", "(", "linear_args", ",", "num_outputs", "=", "conf", ".", "num_units", ",", "activation_fn", "=", "d", ".", "non_recurrent_fn", ",", "weights_initializer", "=", "(", "vs", ".", "get_variable_scope", "(", ")", ".", "initializer", "or", "layers", ".", "initializers", ".", "xavier_initializer", ")", ",", "weights_regularizer", "=", "vs", ".", "get_variable_scope", "(", ")", ".", "regularizer", ")", "else", ":", "if", "c_prev", "[", "i", "]", "is", "not", "None", ":", "cell_state", "=", "(", "c_prev", "[", "i", "]", ",", "last_dim_output", ")", "else", ":", "# for GRU/RNN, the state is just the previous output", "cell_state", "=", "last_dim_output", "with", "vs", ".", "variable_scope", "(", "'recurrent'", "if", "conf", ".", "tied", "else", "'recurrent/cell_{}'", ".", "format", "(", "i", ")", ")", ":", "if", "conf", ".", "tied", "and", "not", "(", "first_call", "and", "i", "==", "dim_indices", "[", "0", "]", ")", ":", "vs", ".", "get_variable_scope", "(", ")", ".", "reuse_variables", "(", ")", "cell", "=", "cells", "[", "i", "]", "new_output", "[", "d", ".", "idx", "]", ",", "new_state", "[", "d", ".", "idx", "]", "=", "cell", "(", "cell_inputs", ",", "cell_state", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/grid_rnn/python/ops/grid_rnn_cell.py#L608-L665
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/richtext.py
python
RichTextCompositeObject.GetChildCount
(*args, **kwargs)
return _richtext.RichTextCompositeObject_GetChildCount(*args, **kwargs)
GetChildCount(self) -> size_t
GetChildCount(self) -> size_t
[ "GetChildCount", "(", "self", ")", "-", ">", "size_t" ]
def GetChildCount(*args, **kwargs): """GetChildCount(self) -> size_t""" return _richtext.RichTextCompositeObject_GetChildCount(*args, **kwargs)
[ "def", "GetChildCount", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextCompositeObject_GetChildCount", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1562-L1564
ZhouWeikuan/DouDiZhu
0d84ff6c0bc54dba6ae37955de9ae9307513dc99
code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py
python
Diagnostic.category_name
(self)
return conf.lib.clang_getDiagnosticCategoryName(self.category_number)
The string name of the category for this diagnostic.
The string name of the category for this diagnostic.
[ "The", "string", "name", "of", "the", "category", "for", "this", "diagnostic", "." ]
def category_name(self): """The string name of the category for this diagnostic.""" return conf.lib.clang_getDiagnosticCategoryName(self.category_number)
[ "def", "category_name", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_getDiagnosticCategoryName", "(", "self", ".", "category_number", ")" ]
https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L345-L347
nlohmann/json
eb2182414749825be086c825edb5229e5c28503d
third_party/cpplint/cpplint.py
python
_CppLintState.SetCountingStyle
(self, counting_style)
Sets the module's counting options.
Sets the module's counting options.
[ "Sets", "the", "module", "s", "counting", "options", "." ]
def SetCountingStyle(self, counting_style): """Sets the module's counting options.""" self.counting = counting_style
[ "def", "SetCountingStyle", "(", "self", ",", "counting_style", ")", ":", "self", ".", "counting", "=", "counting_style" ]
https://github.com/nlohmann/json/blob/eb2182414749825be086c825edb5229e5c28503d/third_party/cpplint/cpplint.py#L1289-L1291
cyberbotics/webots
af7fa7d68dcf7b4550f1f2e132092b41e83698fc
resources/osm_importer/utils/shapely_utils.py
python
invert_line_string
(line)
return LineString(line.coords[::-1])
Revert the coords order from a LineString.
Revert the coords order from a LineString.
[ "Revert", "the", "coords", "order", "from", "a", "LineString", "." ]
def invert_line_string(line): """Revert the coords order from a LineString.""" assert isinstance(line, LineString) # http://stackoverflow.com/questions/33175022/order-of-linestrings-in-multilinestring-object-in-shapely return LineString(line.coords[::-1])
[ "def", "invert_line_string", "(", "line", ")", ":", "assert", "isinstance", "(", "line", ",", "LineString", ")", "# http://stackoverflow.com/questions/33175022/order-of-linestrings-in-multilinestring-object-in-shapely", "return", "LineString", "(", "line", ".", "coords", "[", ":", ":", "-", "1", "]", ")" ]
https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/resources/osm_importer/utils/shapely_utils.py#L58-L62
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py3/prompt_toolkit/output/vt100.py
python
_EscapeCodeCache._color_name_to_rgb
(self, color: str)
Turn 'ffffff', into (0xff, 0xff, 0xff).
Turn 'ffffff', into (0xff, 0xff, 0xff).
[ "Turn", "ffffff", "into", "(", "0xff", "0xff", "0xff", ")", "." ]
def _color_name_to_rgb(self, color: str) -> Tuple[int, int, int]: "Turn 'ffffff', into (0xff, 0xff, 0xff)." try: rgb = int(color, 16) except ValueError: raise else: r = (rgb >> 16) & 0xFF g = (rgb >> 8) & 0xFF b = rgb & 0xFF return r, g, b
[ "def", "_color_name_to_rgb", "(", "self", ",", "color", ":", "str", ")", "->", "Tuple", "[", "int", ",", "int", ",", "int", "]", ":", "try", ":", "rgb", "=", "int", "(", "color", ",", "16", ")", "except", "ValueError", ":", "raise", "else", ":", "r", "=", "(", "rgb", ">>", "16", ")", "&", "0xFF", "g", "=", "(", "rgb", ">>", "8", ")", "&", "0xFF", "b", "=", "rgb", "&", "0xFF", "return", "r", ",", "g", ",", "b" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/output/vt100.py#L317-L327
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/device_assignment.py
python
_ring_2d
(height, width)
return ret
Ring-order of a height x width mesh. For example, in a 4x4 mesh, this returns the following order. 0 -- 1 -- 2 -- 3 | | | | 15-- 6 -- 5 -- 4 | | | | 14-- 7 -- 8 -- 9 | | | | 13-- 12-- 11-- 10 Args: height: An integer represents the height. width: An integer represents the width. Returns: A list of [y, x] pairs with ring order.
Ring-order of a height x width mesh.
[ "Ring", "-", "order", "of", "a", "height", "x", "width", "mesh", "." ]
def _ring_2d(height, width): """Ring-order of a height x width mesh. For example, in a 4x4 mesh, this returns the following order. 0 -- 1 -- 2 -- 3 | | | | 15-- 6 -- 5 -- 4 | | | | 14-- 7 -- 8 -- 9 | | | | 13-- 12-- 11-- 10 Args: height: An integer represents the height. width: An integer represents the width. Returns: A list of [y, x] pairs with ring order. """ if height == 1: return [(0, i) for i in range(width)] if width == 1: return [(i, 0) for i in range(height)] if height % 2 != 0: logging.warning("Odd dimension") return [(i % height, i // height) for i in range(width * height)] ret = [(0, 0)] for i in range(height // 2): for j in range(1, width): ret.append((2 * i, j)) for j in range(width - 1, 0, -1): ret.append((2 * i + 1, j)) for i in range(height - 1, 0, -1): ret.append((i, 0)) return ret
[ "def", "_ring_2d", "(", "height", ",", "width", ")", ":", "if", "height", "==", "1", ":", "return", "[", "(", "0", ",", "i", ")", "for", "i", "in", "range", "(", "width", ")", "]", "if", "width", "==", "1", ":", "return", "[", "(", "i", ",", "0", ")", "for", "i", "in", "range", "(", "height", ")", "]", "if", "height", "%", "2", "!=", "0", ":", "logging", ".", "warning", "(", "\"Odd dimension\"", ")", "return", "[", "(", "i", "%", "height", ",", "i", "//", "height", ")", "for", "i", "in", "range", "(", "width", "*", "height", ")", "]", "ret", "=", "[", "(", "0", ",", "0", ")", "]", "for", "i", "in", "range", "(", "height", "//", "2", ")", ":", "for", "j", "in", "range", "(", "1", ",", "width", ")", ":", "ret", ".", "append", "(", "(", "2", "*", "i", ",", "j", ")", ")", "for", "j", "in", "range", "(", "width", "-", "1", ",", "0", ",", "-", "1", ")", ":", "ret", ".", "append", "(", "(", "2", "*", "i", "+", "1", ",", "j", ")", ")", "for", "i", "in", "range", "(", "height", "-", "1", ",", "0", ",", "-", "1", ")", ":", "ret", ".", "append", "(", "(", "i", ",", "0", ")", ")", "return", "ret" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/device_assignment.py#L178-L212
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_gdi.py
python
Font.GetWeight
(*args, **kwargs)
return _gdi_.Font_GetWeight(*args, **kwargs)
GetWeight(self) -> int Gets the font weight.
GetWeight(self) -> int
[ "GetWeight", "(", "self", ")", "-", ">", "int" ]
def GetWeight(*args, **kwargs): """ GetWeight(self) -> int Gets the font weight. """ return _gdi_.Font_GetWeight(*args, **kwargs)
[ "def", "GetWeight", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "Font_GetWeight", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L2315-L2321
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/third_party/depot_tools/cpplint.py
python
_IsSourceExtension
(s)
return s in ('c', 'cc', 'cpp', 'cxx')
File extension (excluding dot) matches a source file extension.
File extension (excluding dot) matches a source file extension.
[ "File", "extension", "(", "excluding", "dot", ")", "matches", "a", "source", "file", "extension", "." ]
def _IsSourceExtension(s): """File extension (excluding dot) matches a source file extension.""" return s in ('c', 'cc', 'cpp', 'cxx')
[ "def", "_IsSourceExtension", "(", "s", ")", ":", "return", "s", "in", "(", "'c'", ",", "'cc'", ",", "'cpp'", ",", "'cxx'", ")" ]
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/third_party/depot_tools/cpplint.py#L657-L659
danxuhk/ContinuousCRF-CNN
2b6dcaf179620f118b225ed12c890414ca828e21
scripts/cpp_lint.py
python
CheckVlogArguments
(filename, clean_lines, linenum, error)
Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Checks that VLOG() is only used for defining a logging level.
[ "Checks", "that", "VLOG", "()", "is", "only", "used", "for", "defining", "a", "logging", "level", "." ]
def CheckVlogArguments(filename, clean_lines, linenum, error): """Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found. """ line = clean_lines.elided[linenum] if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): error(filename, linenum, 'runtime/vlog', 5, 'VLOG() should be used with numeric verbosity level. ' 'Use LOG() if you want symbolic severity levels.')
[ "def", "CheckVlogArguments", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "if", "Search", "(", "r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'", ",", "line", ")", ":", "error", "(", "filename", ",", "linenum", ",", "'runtime/vlog'", ",", "5", ",", "'VLOG() should be used with numeric verbosity level. '", "'Use LOG() if you want symbolic severity levels.'", ")" ]
https://github.com/danxuhk/ContinuousCRF-CNN/blob/2b6dcaf179620f118b225ed12c890414ca828e21/scripts/cpp_lint.py#L1712-L1728
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Jinja2/py3/jinja2/compiler.py
python
CodeGenerator.signature
( self, node: t.Union[nodes.Call, nodes.Filter, nodes.Test], frame: Frame, extra_kwargs: t.Optional[t.Mapping[str, t.Any]] = None, )
Writes a function call to the stream for the current node. A leading comma is added automatically. The extra keyword arguments may not include python keywords otherwise a syntax error could occur. The extra keyword arguments should be given as python dict.
Writes a function call to the stream for the current node. A leading comma is added automatically. The extra keyword arguments may not include python keywords otherwise a syntax error could occur. The extra keyword arguments should be given as python dict.
[ "Writes", "a", "function", "call", "to", "the", "stream", "for", "the", "current", "node", ".", "A", "leading", "comma", "is", "added", "automatically", ".", "The", "extra", "keyword", "arguments", "may", "not", "include", "python", "keywords", "otherwise", "a", "syntax", "error", "could", "occur", ".", "The", "extra", "keyword", "arguments", "should", "be", "given", "as", "python", "dict", "." ]
def signature( self, node: t.Union[nodes.Call, nodes.Filter, nodes.Test], frame: Frame, extra_kwargs: t.Optional[t.Mapping[str, t.Any]] = None, ) -> None: """Writes a function call to the stream for the current node. A leading comma is added automatically. The extra keyword arguments may not include python keywords otherwise a syntax error could occur. The extra keyword arguments should be given as python dict. """ # if any of the given keyword arguments is a python keyword # we have to make sure that no invalid call is created. kwarg_workaround = any( is_python_keyword(t.cast(str, k)) for k in chain((x.key for x in node.kwargs), extra_kwargs or ()) ) for arg in node.args: self.write(", ") self.visit(arg, frame) if not kwarg_workaround: for kwarg in node.kwargs: self.write(", ") self.visit(kwarg, frame) if extra_kwargs is not None: for key, value in extra_kwargs.items(): self.write(f", {key}={value}") if node.dyn_args: self.write(", *") self.visit(node.dyn_args, frame) if kwarg_workaround: if node.dyn_kwargs is not None: self.write(", **dict({") else: self.write(", **{") for kwarg in node.kwargs: self.write(f"{kwarg.key!r}: ") self.visit(kwarg.value, frame) self.write(", ") if extra_kwargs is not None: for key, value in extra_kwargs.items(): self.write(f"{key!r}: {value}, ") if node.dyn_kwargs is not None: self.write("}, **") self.visit(node.dyn_kwargs, frame) self.write(")") else: self.write("}") elif node.dyn_kwargs is not None: self.write(", **") self.visit(node.dyn_kwargs, frame)
[ "def", "signature", "(", "self", ",", "node", ":", "t", ".", "Union", "[", "nodes", ".", "Call", ",", "nodes", ".", "Filter", ",", "nodes", ".", "Test", "]", ",", "frame", ":", "Frame", ",", "extra_kwargs", ":", "t", ".", "Optional", "[", "t", ".", "Mapping", "[", "str", ",", "t", ".", "Any", "]", "]", "=", "None", ",", ")", "->", "None", ":", "# if any of the given keyword arguments is a python keyword", "# we have to make sure that no invalid call is created.", "kwarg_workaround", "=", "any", "(", "is_python_keyword", "(", "t", ".", "cast", "(", "str", ",", "k", ")", ")", "for", "k", "in", "chain", "(", "(", "x", ".", "key", "for", "x", "in", "node", ".", "kwargs", ")", ",", "extra_kwargs", "or", "(", ")", ")", ")", "for", "arg", "in", "node", ".", "args", ":", "self", ".", "write", "(", "\", \"", ")", "self", ".", "visit", "(", "arg", ",", "frame", ")", "if", "not", "kwarg_workaround", ":", "for", "kwarg", "in", "node", ".", "kwargs", ":", "self", ".", "write", "(", "\", \"", ")", "self", ".", "visit", "(", "kwarg", ",", "frame", ")", "if", "extra_kwargs", "is", "not", "None", ":", "for", "key", ",", "value", "in", "extra_kwargs", ".", "items", "(", ")", ":", "self", ".", "write", "(", "f\", {key}={value}\"", ")", "if", "node", ".", "dyn_args", ":", "self", ".", "write", "(", "\", *\"", ")", "self", ".", "visit", "(", "node", ".", "dyn_args", ",", "frame", ")", "if", "kwarg_workaround", ":", "if", "node", ".", "dyn_kwargs", "is", "not", "None", ":", "self", ".", "write", "(", "\", **dict({\"", ")", "else", ":", "self", ".", "write", "(", "\", **{\"", ")", "for", "kwarg", "in", "node", ".", "kwargs", ":", "self", ".", "write", "(", "f\"{kwarg.key!r}: \"", ")", "self", ".", "visit", "(", "kwarg", ".", "value", ",", "frame", ")", "self", ".", "write", "(", "\", \"", ")", "if", "extra_kwargs", "is", "not", "None", ":", "for", "key", ",", "value", "in", "extra_kwargs", ".", "items", "(", ")", ":", "self", ".", "write", "(", "f\"{key!r}: {value}, \"", ")", "if", "node", ".", "dyn_kwargs", "is", "not", "None", ":", "self", ".", "write", "(", "\"}, **\"", ")", "self", ".", "visit", "(", "node", ".", "dyn_kwargs", ",", "frame", ")", "self", ".", "write", "(", "\")\"", ")", "else", ":", "self", ".", "write", "(", "\"}\"", ")", "elif", "node", ".", "dyn_kwargs", "is", "not", "None", ":", "self", ".", "write", "(", "\", **\"", ")", "self", ".", "visit", "(", "node", ".", "dyn_kwargs", ",", "frame", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py3/jinja2/compiler.py#L481-L536
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftguitools/gui_beziers.py
python
CubicBezCurve.finish
(self, closed=False, cont=False)
Terminate the operation and close the curve if asked. Parameters ---------- closed: bool, optional Close the line if `True`.
Terminate the operation and close the curve if asked.
[ "Terminate", "the", "operation", "and", "close", "the", "curve", "if", "asked", "." ]
def finish(self, closed=False, cont=False): """Terminate the operation and close the curve if asked. Parameters ---------- closed: bool, optional Close the line if `True`. """ if self.ui: if hasattr(self, "bezcurvetrack"): self.bezcurvetrack.finalize() if not utils.getParam("UiMode", 1): Gui.Control.closeDialog() if self.obj: # remove temporary object, if any old = self.obj.Name todo.ToDo.delay(self.doc.removeObject, old) if closed is False: cleannd = (len(self.node) - 1) % self.degree if cleannd == 0: self.node = self.node[0:-3] if cleannd > 0: self.node = self.node[0:-cleannd] if len(self.node) > 1: try: # The command to run is built as a series of text strings # to be committed through the `draftutils.todo.ToDo` class. rot, sup, pts, fil = self.getStrings() Gui.addModule("Draft") _cmd = 'Draft.makeBezCurve' _cmd += '(' _cmd += 'points, ' _cmd += 'closed=' + str(closed) + ', ' _cmd += 'support=' + sup + ', ' _cmd += 'degree=' + str(self.degree) _cmd += ')' _cmd_list = ['points = ' + pts, 'bez = ' + _cmd, 'Draft.autogroup(bez)', 'FreeCAD.ActiveDocument.recompute()'] self.commit(translate("draft", "Create BezCurve"), _cmd_list) except Exception: _err("Draft: error delaying commit") # `Creator` is the grandfather class, the parent of `Line`; # we need to call it to perform final cleanup tasks. # # Calling it directly like this is a bit messy; maybe we need # another method that performs cleanup (superfinish) # that is not re-implemented by any of the child classes. gui_base_original.Creator.finish(self) if self.ui and self.ui.continueMode: self.Activated()
[ "def", "finish", "(", "self", ",", "closed", "=", "False", ",", "cont", "=", "False", ")", ":", "if", "self", ".", "ui", ":", "if", "hasattr", "(", "self", ",", "\"bezcurvetrack\"", ")", ":", "self", ".", "bezcurvetrack", ".", "finalize", "(", ")", "if", "not", "utils", ".", "getParam", "(", "\"UiMode\"", ",", "1", ")", ":", "Gui", ".", "Control", ".", "closeDialog", "(", ")", "if", "self", ".", "obj", ":", "# remove temporary object, if any", "old", "=", "self", ".", "obj", ".", "Name", "todo", ".", "ToDo", ".", "delay", "(", "self", ".", "doc", ".", "removeObject", ",", "old", ")", "if", "closed", "is", "False", ":", "cleannd", "=", "(", "len", "(", "self", ".", "node", ")", "-", "1", ")", "%", "self", ".", "degree", "if", "cleannd", "==", "0", ":", "self", ".", "node", "=", "self", ".", "node", "[", "0", ":", "-", "3", "]", "if", "cleannd", ">", "0", ":", "self", ".", "node", "=", "self", ".", "node", "[", "0", ":", "-", "cleannd", "]", "if", "len", "(", "self", ".", "node", ")", ">", "1", ":", "try", ":", "# The command to run is built as a series of text strings", "# to be committed through the `draftutils.todo.ToDo` class.", "rot", ",", "sup", ",", "pts", ",", "fil", "=", "self", ".", "getStrings", "(", ")", "Gui", ".", "addModule", "(", "\"Draft\"", ")", "_cmd", "=", "'Draft.makeBezCurve'", "_cmd", "+=", "'('", "_cmd", "+=", "'points, '", "_cmd", "+=", "'closed='", "+", "str", "(", "closed", ")", "+", "', '", "_cmd", "+=", "'support='", "+", "sup", "+", "', '", "_cmd", "+=", "'degree='", "+", "str", "(", "self", ".", "degree", ")", "_cmd", "+=", "')'", "_cmd_list", "=", "[", "'points = '", "+", "pts", ",", "'bez = '", "+", "_cmd", ",", "'Draft.autogroup(bez)'", ",", "'FreeCAD.ActiveDocument.recompute()'", "]", "self", ".", "commit", "(", "translate", "(", "\"draft\"", ",", "\"Create BezCurve\"", ")", ",", "_cmd_list", ")", "except", "Exception", ":", "_err", "(", "\"Draft: error delaying commit\"", ")", "# `Creator` is the grandfather class, the parent of `Line`;", "# we need to call it to perform final cleanup tasks.", "#", "# Calling it directly like this is a bit messy; maybe we need", "# another method that performs cleanup (superfinish)", "# that is not re-implemented by any of the child classes.", "gui_base_original", ".", "Creator", ".", "finish", "(", "self", ")", "if", "self", ".", "ui", "and", "self", ".", "ui", ".", "continueMode", ":", "self", ".", "Activated", "(", ")" ]
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_beziers.py#L411-L464
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/AWSPythonSDK/1.5.8/boto3/resources/factory.py
python
ResourceFactory._load_attributes
(self, attrs, meta, resource_name, resource_model, service_context)
Load resource attributes based on the resource shape. The shape name is referenced in the resource JSON, but the shape itself is defined in the Botocore service JSON, hence the need for access to the ``service_model``.
Load resource attributes based on the resource shape. The shape name is referenced in the resource JSON, but the shape itself is defined in the Botocore service JSON, hence the need for access to the ``service_model``.
[ "Load", "resource", "attributes", "based", "on", "the", "resource", "shape", ".", "The", "shape", "name", "is", "referenced", "in", "the", "resource", "JSON", "but", "the", "shape", "itself", "is", "defined", "in", "the", "Botocore", "service", "JSON", "hence", "the", "need", "for", "access", "to", "the", "service_model", "." ]
def _load_attributes(self, attrs, meta, resource_name, resource_model, service_context): """ Load resource attributes based on the resource shape. The shape name is referenced in the resource JSON, but the shape itself is defined in the Botocore service JSON, hence the need for access to the ``service_model``. """ if not resource_model.shape: return shape = service_context.service_model.shape_for( resource_model.shape) identifiers = dict( (i.member_name, i) for i in resource_model.identifiers if i.member_name) attributes = resource_model.get_attributes(shape) for name, (orig_name, member) in attributes.items(): if name in identifiers: prop = self._create_identifier_alias( resource_name=resource_name, identifier=identifiers[name], member_model=member, service_context=service_context ) else: prop = self._create_autoload_property( resource_name=resource_name, name=orig_name, snake_cased=name, member_model=member, service_context=service_context ) attrs[name] = prop
[ "def", "_load_attributes", "(", "self", ",", "attrs", ",", "meta", ",", "resource_name", ",", "resource_model", ",", "service_context", ")", ":", "if", "not", "resource_model", ".", "shape", ":", "return", "shape", "=", "service_context", ".", "service_model", ".", "shape_for", "(", "resource_model", ".", "shape", ")", "identifiers", "=", "dict", "(", "(", "i", ".", "member_name", ",", "i", ")", "for", "i", "in", "resource_model", ".", "identifiers", "if", "i", ".", "member_name", ")", "attributes", "=", "resource_model", ".", "get_attributes", "(", "shape", ")", "for", "name", ",", "(", "orig_name", ",", "member", ")", "in", "attributes", ".", "items", "(", ")", ":", "if", "name", "in", "identifiers", ":", "prop", "=", "self", ".", "_create_identifier_alias", "(", "resource_name", "=", "resource_name", ",", "identifier", "=", "identifiers", "[", "name", "]", ",", "member_model", "=", "member", ",", "service_context", "=", "service_context", ")", "else", ":", "prop", "=", "self", ".", "_create_autoload_property", "(", "resource_name", "=", "resource_name", ",", "name", "=", "orig_name", ",", "snake_cased", "=", "name", ",", "member_model", "=", "member", ",", "service_context", "=", "service_context", ")", "attrs", "[", "name", "]", "=", "prop" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/boto3/resources/factory.py#L170-L203
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
third_party/mesa/MesaLib/src/gallium/auxiliary/util/u_format_pack.py
python
generate_format_fetch
(format, dst_channel, dst_native_type, dst_suffix)
Generate the function to unpack pixels from a particular format
Generate the function to unpack pixels from a particular format
[ "Generate", "the", "function", "to", "unpack", "pixels", "from", "a", "particular", "format" ]
def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix): '''Generate the function to unpack pixels from a particular format''' name = format.short_name() print 'static INLINE void' print 'util_format_%s_fetch_%s(%s *dst, const uint8_t *src, unsigned i, unsigned j)' % (name, dst_suffix, dst_native_type) print '{' if is_format_supported(format): generate_unpack_kernel(format, dst_channel, dst_native_type) print '}' print
[ "def", "generate_format_fetch", "(", "format", ",", "dst_channel", ",", "dst_native_type", ",", "dst_suffix", ")", ":", "name", "=", "format", ".", "short_name", "(", ")", "print", "'static INLINE void'", "print", "'util_format_%s_fetch_%s(%s *dst, const uint8_t *src, unsigned i, unsigned j)'", "%", "(", "name", ",", "dst_suffix", ",", "dst_native_type", ")", "print", "'{'", "if", "is_format_supported", "(", "format", ")", ":", "generate_unpack_kernel", "(", "format", ",", "dst_channel", ",", "dst_native_type", ")", "print", "'}'", "print" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/mesa/MesaLib/src/gallium/auxiliary/util/u_format_pack.py#L618-L631
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/datetime.py
python
date.ctime
(self)
return "%s %s %2d 00:00:00 %04d" % ( _DAYNAMES[weekday], _MONTHNAMES[self._month], self._day, self._year)
Return ctime() style string.
Return ctime() style string.
[ "Return", "ctime", "()", "style", "string", "." ]
def ctime(self): "Return ctime() style string." weekday = self.toordinal() % 7 or 7 return "%s %s %2d 00:00:00 %04d" % ( _DAYNAMES[weekday], _MONTHNAMES[self._month], self._day, self._year)
[ "def", "ctime", "(", "self", ")", ":", "weekday", "=", "self", ".", "toordinal", "(", ")", "%", "7", "or", "7", "return", "\"%s %s %2d 00:00:00 %04d\"", "%", "(", "_DAYNAMES", "[", "weekday", "]", ",", "_MONTHNAMES", "[", "self", ".", "_month", "]", ",", "self", ".", "_day", ",", "self", ".", "_year", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/datetime.py#L950-L956
albertz/openlierox
d316c14a8eb57848ef56e9bfa7b23a56f694a51b
tools/DedicatedServerVideo/gdata/spreadsheet/service.py
python
SpreadsheetsService.AddWorksheet
(self, title, row_count, col_count, key)
return self.Post(new_worksheet, 'http://%s/feeds/worksheets/%s/private/full' % (self.server, key), converter=gdata.spreadsheet.SpreadsheetsWorksheetFromString)
Creates a new worksheet in the desired spreadsheet. The new worksheet is appended to the end of the list of worksheets. The new worksheet will only have the available number of columns and cells specified. Args: title: str The title which will be displayed in the list of worksheets. row_count: int or str The number of rows in the new worksheet. col_count: int or str The number of columns in the new worksheet. key: str The spreadsheet key to the spreadsheet to which the new worksheet should be added. Returns: A SpreadsheetsWorksheet if the new worksheet was created succesfully.
Creates a new worksheet in the desired spreadsheet.
[ "Creates", "a", "new", "worksheet", "in", "the", "desired", "spreadsheet", "." ]
def AddWorksheet(self, title, row_count, col_count, key): """Creates a new worksheet in the desired spreadsheet. The new worksheet is appended to the end of the list of worksheets. The new worksheet will only have the available number of columns and cells specified. Args: title: str The title which will be displayed in the list of worksheets. row_count: int or str The number of rows in the new worksheet. col_count: int or str The number of columns in the new worksheet. key: str The spreadsheet key to the spreadsheet to which the new worksheet should be added. Returns: A SpreadsheetsWorksheet if the new worksheet was created succesfully. """ new_worksheet = gdata.spreadsheet.SpreadsheetsWorksheet( title=atom.Title(text=title), row_count=gdata.spreadsheet.RowCount(text=str(row_count)), col_count=gdata.spreadsheet.ColCount(text=str(col_count))) return self.Post(new_worksheet, 'http://%s/feeds/worksheets/%s/private/full' % (self.server, key), converter=gdata.spreadsheet.SpreadsheetsWorksheetFromString)
[ "def", "AddWorksheet", "(", "self", ",", "title", ",", "row_count", ",", "col_count", ",", "key", ")", ":", "new_worksheet", "=", "gdata", ".", "spreadsheet", ".", "SpreadsheetsWorksheet", "(", "title", "=", "atom", ".", "Title", "(", "text", "=", "title", ")", ",", "row_count", "=", "gdata", ".", "spreadsheet", ".", "RowCount", "(", "text", "=", "str", "(", "row_count", ")", ")", ",", "col_count", "=", "gdata", ".", "spreadsheet", ".", "ColCount", "(", "text", "=", "str", "(", "col_count", ")", ")", ")", "return", "self", ".", "Post", "(", "new_worksheet", ",", "'http://%s/feeds/worksheets/%s/private/full'", "%", "(", "self", ".", "server", ",", "key", ")", ",", "converter", "=", "gdata", ".", "spreadsheet", ".", "SpreadsheetsWorksheetFromString", ")" ]
https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/spreadsheet/service.py#L128-L151
jeog/TDAmeritradeAPI
91c738afd7d57b54f6231170bd64c2550fafd34d
python/tdma_api/stream.py
python
AcctActivitySubscription.ParseResponseData
(data)
return results
Convert responses containing XML to a list-of-dict-of-[dict|str|None] The 'data' 4th arg of the callback should be passed ONLY when the callback type is of CALLBACK_TYPE_DATA and the service type is of SERVICE_TYPE_ACCT_ACTIVITY. 'data' should be of form: [ {"1":"<account>", "2":"SUBSCRIBED", "3":"", {"1":"<account>", "2":"<message_type>", "3":"<message_data xml></>", {"1":"<account>", "2":"ERROR", "3":"error message", {"1":"<account>", "2":"<message_type>", "3":"<message_data xml></>", ... ] Returns an array of dicts of one of the following forms: 1) {"account":"<account>", "message_type":"SUBSCRIBED", "message_data":""} 2) {"account":"<account>", "message_type":"ERROR", "message_data":"error message"} 3) {"account":"<account>", "message_type":"<message_type>", "message_data":dict() } Form 1 is returned initially on subscription, form 3 contains valid responses and its message_type is one of the strs represented by the MSG_TYPE_[] constants. "message_data" is a dict of (hierarchical) key/val (tag/text) pairs pulled from the returned XML. NOTES: 1) the returned dict excludes the top-level message-type tag (e.g 'OrderCancelRequestMessage') 2) all data are of type str or None 3) if xml (unexpectedly) has 'text' and child nodes the text will be added to the dict with key '#text' 4) earlier versions returned a flattend dict(changed because of naming collisions) e.g >> def callback(cb, ss, t, data): >> if cb == stream.CALLBACK_TYPE_DATA and ss == stream.SERVICE_TYPE_ACCT_ACTIVITY: >> for resp in AcctActivitySubscription.ParseResponseData(data): >> msg_ty = resp['message_type'] >> if msg_ty == MSG_TYPE_SUBSCRIBED: >> print("SUBCSRIBED") >> elif msg_ty == MSG_TYPE_ERROR: >> print("ERROR: ", resp['message_data']) >> else: >> print("ACCT ACTIVITY RESPONSE: %s" % resp['message_type']) >> print( json.dumps(resp['message_data'], indent=4) ) >> >> ... (on callback) ... >> >> ACCT ACTIVITY RESPONSE: OrderEntryRequest >> { >> "ActivityTimestamp": "2019-09-22T19:41:25.582-05:00", >> "LastUpdated": "2019-09-22T19:41:25.582-05:00", >> ... >> "Order": { >> "OpenClose": "Open", >> "Security": { >> "CUSIP": "0SPY..JI90250000", >> "SecurityType": "Call Option", >> "Symbol": "SPY_101819C250" >> }, >> ... >> ... >> } >>
Convert responses containing XML to a list-of-dict-of-[dict|str|None]
[ "Convert", "responses", "containing", "XML", "to", "a", "list", "-", "of", "-", "dict", "-", "of", "-", "[", "dict|str|None", "]" ]
def ParseResponseData(data): """Convert responses containing XML to a list-of-dict-of-[dict|str|None] The 'data' 4th arg of the callback should be passed ONLY when the callback type is of CALLBACK_TYPE_DATA and the service type is of SERVICE_TYPE_ACCT_ACTIVITY. 'data' should be of form: [ {"1":"<account>", "2":"SUBSCRIBED", "3":"", {"1":"<account>", "2":"<message_type>", "3":"<message_data xml></>", {"1":"<account>", "2":"ERROR", "3":"error message", {"1":"<account>", "2":"<message_type>", "3":"<message_data xml></>", ... ] Returns an array of dicts of one of the following forms: 1) {"account":"<account>", "message_type":"SUBSCRIBED", "message_data":""} 2) {"account":"<account>", "message_type":"ERROR", "message_data":"error message"} 3) {"account":"<account>", "message_type":"<message_type>", "message_data":dict() } Form 1 is returned initially on subscription, form 3 contains valid responses and its message_type is one of the strs represented by the MSG_TYPE_[] constants. "message_data" is a dict of (hierarchical) key/val (tag/text) pairs pulled from the returned XML. NOTES: 1) the returned dict excludes the top-level message-type tag (e.g 'OrderCancelRequestMessage') 2) all data are of type str or None 3) if xml (unexpectedly) has 'text' and child nodes the text will be added to the dict with key '#text' 4) earlier versions returned a flattend dict(changed because of naming collisions) e.g >> def callback(cb, ss, t, data): >> if cb == stream.CALLBACK_TYPE_DATA and ss == stream.SERVICE_TYPE_ACCT_ACTIVITY: >> for resp in AcctActivitySubscription.ParseResponseData(data): >> msg_ty = resp['message_type'] >> if msg_ty == MSG_TYPE_SUBSCRIBED: >> print("SUBCSRIBED") >> elif msg_ty == MSG_TYPE_ERROR: >> print("ERROR: ", resp['message_data']) >> else: >> print("ACCT ACTIVITY RESPONSE: %s" % resp['message_type']) >> print( json.dumps(resp['message_data'], indent=4) ) >> >> ... (on callback) ... >> >> ACCT ACTIVITY RESPONSE: OrderEntryRequest >> { >> "ActivityTimestamp": "2019-09-22T19:41:25.582-05:00", >> "LastUpdated": "2019-09-22T19:41:25.582-05:00", >> ... >> "Order": { >> "OpenClose": "Open", >> "Security": { >> "CUSIP": "0SPY..JI90250000", >> "SecurityType": "Call Option", >> "Symbol": "SPY_101819C250" >> }, >> ... >> ... >> } >> """ results = [] for elem in data: msg_type = elem["2"] res = {"account":elem["1"], "message_type":msg_type, "message_data":None} if msg_type == "SUBSCRIBED": res["message_data"] = "" elif msg_type == "ERROR": res["message_data"] = elem["3"] else: try: root = ElementTree.fromstring( elem["3"] ) res["message_data"] = AcctActivitySubscription.XMLtoDict(root) except ElementTree.ParseError as exc: print( "Error parsing ACCT ACTIVITY response XML: %s" % str(exc) ) except Exception as exc: print( "Error handling ACCT ACTIVITY response: %s" % str(exc) ) results.append(res) return results
[ "def", "ParseResponseData", "(", "data", ")", ":", "results", "=", "[", "]", "for", "elem", "in", "data", ":", "msg_type", "=", "elem", "[", "\"2\"", "]", "res", "=", "{", "\"account\"", ":", "elem", "[", "\"1\"", "]", ",", "\"message_type\"", ":", "msg_type", ",", "\"message_data\"", ":", "None", "}", "if", "msg_type", "==", "\"SUBSCRIBED\"", ":", "res", "[", "\"message_data\"", "]", "=", "\"\"", "elif", "msg_type", "==", "\"ERROR\"", ":", "res", "[", "\"message_data\"", "]", "=", "elem", "[", "\"3\"", "]", "else", ":", "try", ":", "root", "=", "ElementTree", ".", "fromstring", "(", "elem", "[", "\"3\"", "]", ")", "res", "[", "\"message_data\"", "]", "=", "AcctActivitySubscription", ".", "XMLtoDict", "(", "root", ")", "except", "ElementTree", ".", "ParseError", "as", "exc", ":", "print", "(", "\"Error parsing ACCT ACTIVITY response XML: %s\"", "%", "str", "(", "exc", ")", ")", "except", "Exception", "as", "exc", ":", "print", "(", "\"Error handling ACCT ACTIVITY response: %s\"", "%", "str", "(", "exc", ")", ")", "results", ".", "append", "(", "res", ")", "return", "results" ]
https://github.com/jeog/TDAmeritradeAPI/blob/91c738afd7d57b54f6231170bd64c2550fafd34d/python/tdma_api/stream.py#L403-L489
TGAC/KAT
e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216
deps/boost/tools/build/src/build/project.py
python
ProjectRegistry.attributes
(self, project)
return self.module2attributes[project]
Returns the project-attribute instance for the specified jamfile module.
Returns the project-attribute instance for the specified jamfile module.
[ "Returns", "the", "project", "-", "attribute", "instance", "for", "the", "specified", "jamfile", "module", "." ]
def attributes(self, project): """Returns the project-attribute instance for the specified jamfile module.""" assert isinstance(project, basestring) return self.module2attributes[project]
[ "def", "attributes", "(", "self", ",", "project", ")", ":", "assert", "isinstance", "(", "project", ",", "basestring", ")", "return", "self", ".", "module2attributes", "[", "project", "]" ]
https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/project.py#L587-L591
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_collections_abc.py
python
MutableMapping.setdefault
(self, key, default=None)
return default
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
[ "D", ".", "setdefault", "(", "k", "[", "d", "]", ")", "-", ">", "D", ".", "get", "(", "k", "d", ")", "also", "set", "D", "[", "k", "]", "=", "d", "if", "k", "not", "in", "D" ]
def setdefault(self, key, default=None): 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' try: return self[key] except KeyError: self[key] = default return default
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", "[", "key", "]", "except", "KeyError", ":", "self", "[", "key", "]", "=", "default", "return", "default" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_collections_abc.py#L851-L857
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/grid.py
python
Grid.GetDefaultColLabelSize
(*args, **kwargs)
return _grid.Grid_GetDefaultColLabelSize(*args, **kwargs)
GetDefaultColLabelSize(self) -> int
GetDefaultColLabelSize(self) -> int
[ "GetDefaultColLabelSize", "(", "self", ")", "-", ">", "int" ]
def GetDefaultColLabelSize(*args, **kwargs): """GetDefaultColLabelSize(self) -> int""" return _grid.Grid_GetDefaultColLabelSize(*args, **kwargs)
[ "def", "GetDefaultColLabelSize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "Grid_GetDefaultColLabelSize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L1478-L1480
generalized-intelligence/GAAS
29ab17d3e8a4ba18edef3a57c36d8db6329fac73
algorithms/src/SystemManagement/json_request_response_lib/src/third_party/nlohmann_json/third_party/cpplint/cpplint.py
python
_SetQuiet
(quiet)
return _cpplint_state.SetQuiet(quiet)
Set the module's quiet status, and return previous setting.
Set the module's quiet status, and return previous setting.
[ "Set", "the", "module", "s", "quiet", "status", "and", "return", "previous", "setting", "." ]
def _SetQuiet(quiet): """Set the module's quiet status, and return previous setting.""" return _cpplint_state.SetQuiet(quiet)
[ "def", "_SetQuiet", "(", "quiet", ")", ":", "return", "_cpplint_state", ".", "SetQuiet", "(", "quiet", ")" ]
https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/SystemManagement/json_request_response_lib/src/third_party/nlohmann_json/third_party/cpplint/cpplint.py#L1175-L1177
yushroom/FishEngine
a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9
Script/reflect/clang/cindex.py
python
Config.set_compatibility_check
(check_status)
Perform compatibility check when loading libclang The python bindings are only tested and evaluated with the version of libclang they are provided with. To ensure correct behavior a (limited) compatibility check is performed when loading the bindings. This check will throw an exception, as soon as it fails. In case these bindings are used with an older version of libclang, parts that have been stable between releases may still work. Users of the python bindings can disable the compatibility check. This will cause the python bindings to load, even though they are written for a newer version of libclang. Failures now arise if unsupported or incompatible features are accessed. The user is required to test themselves if the features they are using are available and compatible between different libclang versions.
Perform compatibility check when loading libclang
[ "Perform", "compatibility", "check", "when", "loading", "libclang" ]
def set_compatibility_check(check_status): """ Perform compatibility check when loading libclang The python bindings are only tested and evaluated with the version of libclang they are provided with. To ensure correct behavior a (limited) compatibility check is performed when loading the bindings. This check will throw an exception, as soon as it fails. In case these bindings are used with an older version of libclang, parts that have been stable between releases may still work. Users of the python bindings can disable the compatibility check. This will cause the python bindings to load, even though they are written for a newer version of libclang. Failures now arise if unsupported or incompatible features are accessed. The user is required to test themselves if the features they are using are available and compatible between different libclang versions. """ if Config.loaded: raise Exception("compatibility_check must be set before before " \ "using any other functionalities in libclang.") Config.compatibility_check = check_status
[ "def", "set_compatibility_check", "(", "check_status", ")", ":", "if", "Config", ".", "loaded", ":", "raise", "Exception", "(", "\"compatibility_check must be set before before \"", "\"using any other functionalities in libclang.\"", ")", "Config", ".", "compatibility_check", "=", "check_status" ]
https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L3814-L3835
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/linalg/sparse/sparse_csr_matrix_grad.py
python
_SparseMatrixSoftmaxGrad
(op, grad_softmax)
return sparse_csr_matrix_ops.sparse_matrix_softmax_grad( softmax, grad_softmax, type=op.get_attr("type"))
Gradient for sparse_matrix_softmax op.
Gradient for sparse_matrix_softmax op.
[ "Gradient", "for", "sparse_matrix_softmax", "op", "." ]
def _SparseMatrixSoftmaxGrad(op, grad_softmax): """Gradient for sparse_matrix_softmax op.""" softmax = op.outputs[0] return sparse_csr_matrix_ops.sparse_matrix_softmax_grad( softmax, grad_softmax, type=op.get_attr("type"))
[ "def", "_SparseMatrixSoftmaxGrad", "(", "op", ",", "grad_softmax", ")", ":", "softmax", "=", "op", ".", "outputs", "[", "0", "]", "return", "sparse_csr_matrix_ops", ".", "sparse_matrix_softmax_grad", "(", "softmax", ",", "grad_softmax", ",", "type", "=", "op", ".", "get_attr", "(", "\"type\"", ")", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/sparse/sparse_csr_matrix_grad.py#L200-L204
microsoft/ivy
9f3c7ecc0b2383129fdd0953e10890d98d09a82d
ivy/ivy_cpp_types.py
python
VariantType.isa
(self,variant_idx,expr)
return '((' + expr + ').tag == {})'.format(variant_idx)
return a test indicating whether expr is of the variant type with index variant_idx
return a test indicating whether expr is of the variant type with index variant_idx
[ "return", "a", "test", "indicating", "whether", "expr", "is", "of", "the", "variant", "type", "with", "index", "variant_idx" ]
def isa(self,variant_idx,expr): """ return a test indicating whether expr is of the variant type with index variant_idx """ return '((' + expr + ').tag == {})'.format(variant_idx)
[ "def", "isa", "(", "self", ",", "variant_idx", ",", "expr", ")", ":", "return", "'(('", "+", "expr", "+", "').tag == {})'", ".", "format", "(", "variant_idx", ")" ]
https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_cpp_types.py#L311-L314
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/html.py
python
HtmlWinParser.SetLinkColor
(*args, **kwargs)
return _html.HtmlWinParser_SetLinkColor(*args, **kwargs)
SetLinkColor(self, Colour clr)
SetLinkColor(self, Colour clr)
[ "SetLinkColor", "(", "self", "Colour", "clr", ")" ]
def SetLinkColor(*args, **kwargs): """SetLinkColor(self, Colour clr)""" return _html.HtmlWinParser_SetLinkColor(*args, **kwargs)
[ "def", "SetLinkColor", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_html", ".", "HtmlWinParser_SetLinkColor", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L344-L346
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/defchararray.py
python
partition
(a, sep)
return _to_string_or_unicode_array( _vec_string(a, object_, 'partition', (sep,)))
Partition each element in `a` around `sep`. Calls `str.partition` element-wise. For each element in `a`, split the element as the first occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 strings containing the string itself, followed by two empty strings. Parameters ---------- a : array_like, {str, unicode} Input array sep : {str, unicode} Separator to split each string element in `a`. Returns ------- out : ndarray, {str, unicode} Output array of str or unicode, depending on input type. The output array will have an extra dimension with 3 elements per input element. See also -------- str.partition
Partition each element in `a` around `sep`.
[ "Partition", "each", "element", "in", "a", "around", "sep", "." ]
def partition(a, sep): """ Partition each element in `a` around `sep`. Calls `str.partition` element-wise. For each element in `a`, split the element as the first occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return 3 strings containing the string itself, followed by two empty strings. Parameters ---------- a : array_like, {str, unicode} Input array sep : {str, unicode} Separator to split each string element in `a`. Returns ------- out : ndarray, {str, unicode} Output array of str or unicode, depending on input type. The output array will have an extra dimension with 3 elements per input element. See also -------- str.partition """ return _to_string_or_unicode_array( _vec_string(a, object_, 'partition', (sep,)))
[ "def", "partition", "(", "a", ",", "sep", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'partition'", ",", "(", "sep", ",", ")", ")", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/defchararray.py#L1109-L1141
apiaryio/snowcrash
b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3
tools/gyp/pylib/gyp/msvs_emulation.py
python
MsvsSettings.GetIdlBuildData
(self, source, config)
return outdir, output, variables, flags
Determine the implicit outputs for an idl file. Returns output directory, outputs, and variables and flags that are required.
Determine the implicit outputs for an idl file. Returns output directory, outputs, and variables and flags that are required.
[ "Determine", "the", "implicit", "outputs", "for", "an", "idl", "file", ".", "Returns", "output", "directory", "outputs", "and", "variables", "and", "flags", "that", "are", "required", "." ]
def GetIdlBuildData(self, source, config): """Determine the implicit outputs for an idl file. Returns output directory, outputs, and variables and flags that are required.""" config = self._TargetConfig(config) midl_get = self._GetWrapper(self, self.msvs_settings[config], 'VCMIDLTool') def midl(name, default=None): return self.ConvertVSMacros(midl_get(name, default=default), config=config) tlb = midl('TypeLibraryName', default='${root}.tlb') header = midl('HeaderFileName', default='${root}.h') dlldata = midl('DLLDataFileName', default='dlldata.c') iid = midl('InterfaceIdentifierFileName', default='${root}_i.c') proxy = midl('ProxyFileName', default='${root}_p.c') # Note that .tlb is not included in the outputs as it is not always # generated depending on the content of the input idl file. outdir = midl('OutputDirectory', default='') output = [header, dlldata, iid, proxy] variables = [('tlb', tlb), ('h', header), ('dlldata', dlldata), ('iid', iid), ('proxy', proxy)] # TODO(scottmg): Are there configuration settings to set these flags? target_platform = 'win32' if self.GetArch(config) == 'x86' else 'x64' flags = ['/char', 'signed', '/env', target_platform, '/Oicf'] return outdir, output, variables, flags
[ "def", "GetIdlBuildData", "(", "self", ",", "source", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "midl_get", "=", "self", ".", "_GetWrapper", "(", "self", ",", "self", ".", "msvs_settings", "[", "config", "]", ",", "'VCMIDLTool'", ")", "def", "midl", "(", "name", ",", "default", "=", "None", ")", ":", "return", "self", ".", "ConvertVSMacros", "(", "midl_get", "(", "name", ",", "default", "=", "default", ")", ",", "config", "=", "config", ")", "tlb", "=", "midl", "(", "'TypeLibraryName'", ",", "default", "=", "'${root}.tlb'", ")", "header", "=", "midl", "(", "'HeaderFileName'", ",", "default", "=", "'${root}.h'", ")", "dlldata", "=", "midl", "(", "'DLLDataFileName'", ",", "default", "=", "'dlldata.c'", ")", "iid", "=", "midl", "(", "'InterfaceIdentifierFileName'", ",", "default", "=", "'${root}_i.c'", ")", "proxy", "=", "midl", "(", "'ProxyFileName'", ",", "default", "=", "'${root}_p.c'", ")", "# Note that .tlb is not included in the outputs as it is not always", "# generated depending on the content of the input idl file.", "outdir", "=", "midl", "(", "'OutputDirectory'", ",", "default", "=", "''", ")", "output", "=", "[", "header", ",", "dlldata", ",", "iid", ",", "proxy", "]", "variables", "=", "[", "(", "'tlb'", ",", "tlb", ")", ",", "(", "'h'", ",", "header", ")", ",", "(", "'dlldata'", ",", "dlldata", ")", ",", "(", "'iid'", ",", "iid", ")", ",", "(", "'proxy'", ",", "proxy", ")", "]", "# TODO(scottmg): Are there configuration settings to set these flags?", "target_platform", "=", "'win32'", "if", "self", ".", "GetArch", "(", "config", ")", "==", "'x86'", "else", "'x64'", "flags", "=", "[", "'/char'", ",", "'signed'", ",", "'/env'", ",", "target_platform", ",", "'/Oicf'", "]", "return", "outdir", ",", "output", ",", "variables", ",", "flags" ]
https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/msvs_emulation.py#L840-L865
su2code/SU2
72b2fa977b64b9683a388920f05298a40d39e5c5
SU2_PY/SU2/io/state.py
python
State.update
(self,ztate)
Updates self given another state
Updates self given another state
[ "Updates", "self", "given", "another", "state" ]
def update(self,ztate): """ Updates self given another state """ if not ztate: return assert isinstance(ztate,State) , 'must update with another State-type' for key in self.keys(): if isinstance(ztate[key],dict): self[key].update( ztate[key] ) elif ztate[key]: self[key] = ztate[key] self.set_timestamp()
[ "def", "update", "(", "self", ",", "ztate", ")", ":", "if", "not", "ztate", ":", "return", "assert", "isinstance", "(", "ztate", ",", "State", ")", ",", "'must update with another State-type'", "for", "key", "in", "self", ".", "keys", "(", ")", ":", "if", "isinstance", "(", "ztate", "[", "key", "]", ",", "dict", ")", ":", "self", "[", "key", "]", ".", "update", "(", "ztate", "[", "key", "]", ")", "elif", "ztate", "[", "key", "]", ":", "self", "[", "key", "]", "=", "ztate", "[", "key", "]", "self", ".", "set_timestamp", "(", ")" ]
https://github.com/su2code/SU2/blob/72b2fa977b64b9683a388920f05298a40d39e5c5/SU2_PY/SU2/io/state.py#L146-L158
blackberry/Boost
fc90c3fde129c62565c023f091eddc4a7ed9902b
tools/build/v2/util/utility.py
python
replace_suffix
(name, new_suffix)
return split [0] + new_suffix
Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added.
Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added.
[ "Replaces", "the", "suffix", "of", "name", "by", "new_suffix", ".", "If", "no", "suffix", "exists", "the", "new", "one", "is", "added", "." ]
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ split = os.path.splitext (name) return split [0] + new_suffix
[ "def", "replace_suffix", "(", "name", ",", "new_suffix", ")", ":", "split", "=", "os", ".", "path", ".", "splitext", "(", "name", ")", "return", "split", "[", "0", "]", "+", "new_suffix" ]
https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/util/utility.py#L108-L113
grpc/grpc
27bc6fe7797e43298dc931b96dc57322d0852a9f
setup.py
python
check_linker_need_libatomic
()
return cpp_test.returncode == 0
Test if linker on system needs libatomic.
Test if linker on system needs libatomic.
[ "Test", "if", "linker", "on", "system", "needs", "libatomic", "." ]
def check_linker_need_libatomic(): """Test if linker on system needs libatomic.""" code_test = (b'#include <atomic>\n' + b'int main() { return std::atomic<int64_t>{}; }') cxx = os.environ.get('CXX', 'c++') cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE) cpp_test.communicate(input=code_test) if cpp_test.returncode == 0: return False # Double-check to see if -latomic actually can solve the problem. # https://github.com/grpc/grpc/issues/22491 cpp_test = subprocess.Popen( [cxx, '-x', 'c++', '-std=c++11', '-', '-latomic'], stdin=PIPE, stdout=PIPE, stderr=PIPE) cpp_test.communicate(input=code_test) return cpp_test.returncode == 0
[ "def", "check_linker_need_libatomic", "(", ")", ":", "code_test", "=", "(", "b'#include <atomic>\\n'", "+", "b'int main() { return std::atomic<int64_t>{}; }'", ")", "cxx", "=", "os", ".", "environ", ".", "get", "(", "'CXX'", ",", "'c++'", ")", "cpp_test", "=", "subprocess", ".", "Popen", "(", "[", "cxx", ",", "'-x'", ",", "'c++'", ",", "'-std=c++11'", ",", "'-'", "]", ",", "stdin", "=", "PIPE", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", "cpp_test", ".", "communicate", "(", "input", "=", "code_test", ")", "if", "cpp_test", ".", "returncode", "==", "0", ":", "return", "False", "# Double-check to see if -latomic actually can solve the problem.", "# https://github.com/grpc/grpc/issues/22491", "cpp_test", "=", "subprocess", ".", "Popen", "(", "[", "cxx", ",", "'-x'", ",", "'c++'", ",", "'-std=c++11'", ",", "'-'", ",", "'-latomic'", "]", ",", "stdin", "=", "PIPE", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", "cpp_test", ".", "communicate", "(", "input", "=", "code_test", ")", "return", "cpp_test", ".", "returncode", "==", "0" ]
https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/setup.py#L199-L219
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/mixture/_gaussian_mixture.py
python
_compute_precision_cholesky
(covariances, covariance_type)
return precisions_chol
Compute the Cholesky decomposition of the precisions. Parameters ---------- covariances : array-like The covariance matrix of the current components. The shape depends of the covariance_type. covariance_type : {'full', 'tied', 'diag', 'spherical'} The type of precision matrices. Returns ------- precisions_cholesky : array-like The cholesky decomposition of sample precisions of the current components. The shape depends of the covariance_type.
Compute the Cholesky decomposition of the precisions.
[ "Compute", "the", "Cholesky", "decomposition", "of", "the", "precisions", "." ]
def _compute_precision_cholesky(covariances, covariance_type): """Compute the Cholesky decomposition of the precisions. Parameters ---------- covariances : array-like The covariance matrix of the current components. The shape depends of the covariance_type. covariance_type : {'full', 'tied', 'diag', 'spherical'} The type of precision matrices. Returns ------- precisions_cholesky : array-like The cholesky decomposition of sample precisions of the current components. The shape depends of the covariance_type. """ estimate_precision_error_message = ( "Fitting the mixture model failed because some components have " "ill-defined empirical covariance (for instance caused by singleton " "or collapsed samples). Try to decrease the number of components, " "or increase reg_covar.") if covariance_type == 'full': n_components, n_features, _ = covariances.shape precisions_chol = np.empty((n_components, n_features, n_features)) for k, covariance in enumerate(covariances): try: cov_chol = linalg.cholesky(covariance, lower=True) except linalg.LinAlgError: raise ValueError(estimate_precision_error_message) precisions_chol[k] = linalg.solve_triangular(cov_chol, np.eye(n_features), lower=True).T elif covariance_type == 'tied': _, n_features = covariances.shape try: cov_chol = linalg.cholesky(covariances, lower=True) except linalg.LinAlgError: raise ValueError(estimate_precision_error_message) precisions_chol = linalg.solve_triangular(cov_chol, np.eye(n_features), lower=True).T else: if np.any(np.less_equal(covariances, 0.0)): raise ValueError(estimate_precision_error_message) precisions_chol = 1. / np.sqrt(covariances) return precisions_chol
[ "def", "_compute_precision_cholesky", "(", "covariances", ",", "covariance_type", ")", ":", "estimate_precision_error_message", "=", "(", "\"Fitting the mixture model failed because some components have \"", "\"ill-defined empirical covariance (for instance caused by singleton \"", "\"or collapsed samples). Try to decrease the number of components, \"", "\"or increase reg_covar.\"", ")", "if", "covariance_type", "==", "'full'", ":", "n_components", ",", "n_features", ",", "_", "=", "covariances", ".", "shape", "precisions_chol", "=", "np", ".", "empty", "(", "(", "n_components", ",", "n_features", ",", "n_features", ")", ")", "for", "k", ",", "covariance", "in", "enumerate", "(", "covariances", ")", ":", "try", ":", "cov_chol", "=", "linalg", ".", "cholesky", "(", "covariance", ",", "lower", "=", "True", ")", "except", "linalg", ".", "LinAlgError", ":", "raise", "ValueError", "(", "estimate_precision_error_message", ")", "precisions_chol", "[", "k", "]", "=", "linalg", ".", "solve_triangular", "(", "cov_chol", ",", "np", ".", "eye", "(", "n_features", ")", ",", "lower", "=", "True", ")", ".", "T", "elif", "covariance_type", "==", "'tied'", ":", "_", ",", "n_features", "=", "covariances", ".", "shape", "try", ":", "cov_chol", "=", "linalg", ".", "cholesky", "(", "covariances", ",", "lower", "=", "True", ")", "except", "linalg", ".", "LinAlgError", ":", "raise", "ValueError", "(", "estimate_precision_error_message", ")", "precisions_chol", "=", "linalg", ".", "solve_triangular", "(", "cov_chol", ",", "np", ".", "eye", "(", "n_features", ")", ",", "lower", "=", "True", ")", ".", "T", "else", ":", "if", "np", ".", "any", "(", "np", ".", "less_equal", "(", "covariances", ",", "0.0", ")", ")", ":", "raise", "ValueError", "(", "estimate_precision_error_message", ")", "precisions_chol", "=", "1.", "/", "np", ".", "sqrt", "(", "covariances", ")", "return", "precisions_chol" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/mixture/_gaussian_mixture.py#L288-L335
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py
python
TurtleScreen.listen
(self, xdummy=None, ydummy=None)
Set focus on TurtleScreen (in order to collect key-events) No arguments. Dummy arguments are provided in order to be able to pass listen to the onclick method. Example (for a TurtleScreen instance named screen): >>> screen.listen()
Set focus on TurtleScreen (in order to collect key-events)
[ "Set", "focus", "on", "TurtleScreen", "(", "in", "order", "to", "collect", "key", "-", "events", ")" ]
def listen(self, xdummy=None, ydummy=None): """Set focus on TurtleScreen (in order to collect key-events) No arguments. Dummy arguments are provided in order to be able to pass listen to the onclick method. Example (for a TurtleScreen instance named screen): >>> screen.listen() """ self._listen()
[ "def", "listen", "(", "self", ",", "xdummy", "=", "None", ",", "ydummy", "=", "None", ")", ":", "self", ".", "_listen", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py#L1428-L1438
macchina-io/macchina.io
ef24ba0e18379c3dd48fb84e6dbf991101cb8db0
platform/JS/V8/v8/src/inspector/build/rjsmin.py
python
jsmin_for_posers
(script)
return _re.sub( r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?' r'\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|' r'\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?{};\r\n])(?' r':[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*' r'(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*' r'[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(' r'?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[' r'\r\n]*)*/)[^\047"/\000-\040]*)|(?<=[\000-#%-,./:-@\[-^`{-~-]return' r')(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/' r'))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:' r'/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?' r':(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/' r'\\\[\r\n]*)*/)[^\047"/\000-\040]*)|(?<=[^\000-!#%&(*,./:-@\[\\^`{|' r'~])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)' r'*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]' r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,./' r':-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\013\01' r'4\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./:' r'-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*' r'\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013\014\016-' r'\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\000-\011\013' r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:(?:(?://[^' r'\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^' r'/*][^*]*\*+)*/))*)+', subber, '\n%s\n' % script).strip()
r""" Minify javascript based on `jsmin.c by Douglas Crockford`_\. Instead of parsing the stream char by char, it uses a regular expression approach which minifies the whole script with one big substitution regex. .. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c :Warning: This function is the digest of a _make_jsmin() call. It just utilizes the resulting regex. It's just for fun here and may vanish any time. Use the `jsmin` function instead. :Parameters: `script` : ``str`` Script to minify :Return: Minified script :Rtype: ``str``
r""" Minify javascript based on `jsmin.c by Douglas Crockford`_\.
[ "r", "Minify", "javascript", "based", "on", "jsmin", ".", "c", "by", "Douglas", "Crockford", "_", "\\", "." ]
def jsmin_for_posers(script): r""" Minify javascript based on `jsmin.c by Douglas Crockford`_\. Instead of parsing the stream char by char, it uses a regular expression approach which minifies the whole script with one big substitution regex. .. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c :Warning: This function is the digest of a _make_jsmin() call. It just utilizes the resulting regex. It's just for fun here and may vanish any time. Use the `jsmin` function instead. :Parameters: `script` : ``str`` Script to minify :Return: Minified script :Rtype: ``str`` """ def subber(match): """ Substitution callback """ groups = match.groups() return ( groups[0] or groups[1] or groups[2] or groups[3] or (groups[4] and '\n') or (groups[5] and ' ') or (groups[6] and ' ') or (groups[7] and ' ') or '') return _re.sub( r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?' r'\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|' r'\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?{};\r\n])(?' r':[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*' r'(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*' r'[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(' r'?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[' r'\r\n]*)*/)[^\047"/\000-\040]*)|(?<=[\000-#%-,./:-@\[-^`{-~-]return' r')(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/' r'))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:' r'/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?' r':(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/' r'\\\[\r\n]*)*/)[^\047"/\000-\040]*)|(?<=[^\000-!#%&(*,./:-@\[\\^`{|' r'~])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)' r'*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]' r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,./' r':-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\013\01' r'4\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./:' r'-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*' r'\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013\014\016-' r'\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\000-\011\013' r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:(?:(?://[^' r'\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^' r'/*][^*]*\*+)*/))*)+', subber, '\n%s\n' % script).strip()
[ "def", "jsmin_for_posers", "(", "script", ")", ":", "def", "subber", "(", "match", ")", ":", "\"\"\" Substitution callback \"\"\"", "groups", "=", "match", ".", "groups", "(", ")", "return", "(", "groups", "[", "0", "]", "or", "groups", "[", "1", "]", "or", "groups", "[", "2", "]", "or", "groups", "[", "3", "]", "or", "(", "groups", "[", "4", "]", "and", "'\\n'", ")", "or", "(", "groups", "[", "5", "]", "and", "' '", ")", "or", "(", "groups", "[", "6", "]", "and", "' '", ")", "or", "(", "groups", "[", "7", "]", "and", "' '", ")", "or", "''", ")", "return", "_re", ".", "sub", "(", "r'([^\\047\"/\\000-\\040]+)|((?:(?:\\047[^\\047\\\\\\r\\n]*(?:\\\\(?:[^\\r\\n]|\\r?'", "r'\\n|\\r)[^\\047\\\\\\r\\n]*)*\\047)|(?:\"[^\"\\\\\\r\\n]*(?:\\\\(?:[^\\r\\n]|\\r?\\n|'", "r'\\r)[^\"\\\\\\r\\n]*)*\"))[^\\047\"/\\000-\\040]*)|(?<=[(,=:\\[!&|?{};\\r\\n])(?'", "r':[\\000-\\011\\013\\014\\016-\\040]|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/))*'", "r'(?:(?:(?://[^\\r\\n]*)?[\\r\\n])(?:[\\000-\\011\\013\\014\\016-\\040]|(?:/\\*'", "r'[^*]*\\*+(?:[^/*][^*]*\\*+)*/))*)*((?:/(?![\\r\\n/*])[^/\\\\\\[\\r\\n]*(?:('", "r'?:\\\\[^\\r\\n]|(?:\\[[^\\\\\\]\\r\\n]*(?:\\\\[^\\r\\n][^\\\\\\]\\r\\n]*)*\\]))[^/\\\\\\['", "r'\\r\\n]*)*/)[^\\047\"/\\000-\\040]*)|(?<=[\\000-#%-,./:-@\\[-^`{-~-]return'", "r')(?:[\\000-\\011\\013\\014\\016-\\040]|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/'", "r'))*(?:(?:(?://[^\\r\\n]*)?[\\r\\n])(?:[\\000-\\011\\013\\014\\016-\\040]|(?:'", "r'/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/)))*((?:/(?![\\r\\n/*])[^/\\\\\\[\\r\\n]*(?'", "r':(?:\\\\[^\\r\\n]|(?:\\[[^\\\\\\]\\r\\n]*(?:\\\\[^\\r\\n][^\\\\\\]\\r\\n]*)*\\]))[^/'", "r'\\\\\\[\\r\\n]*)*/)[^\\047\"/\\000-\\040]*)|(?<=[^\\000-!#%&(*,./:-@\\[\\\\^`{|'", "r'~])(?:[\\000-\\011\\013\\014\\016-\\040]|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)'", "r'*/))*(?:((?:(?://[^\\r\\n]*)?[\\r\\n]))(?:[\\000-\\011\\013\\014\\016-\\040]'", "r'|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/))*)+(?=[^\\000-\\040\"#%-\\047)*,./'", "r':-@\\\\-^`|-~])|(?<=[^\\000-#%-,./:-@\\[-^`{-~-])((?:[\\000-\\011\\013\\01'", "r'4\\016-\\040]|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/)))+(?=[^\\000-#%-,./:'", "r'-@\\[-^`{-~-])|(?<=\\+)((?:[\\000-\\011\\013\\014\\016-\\040]|(?:/\\*[^*]*'", "r'\\*+(?:[^/*][^*]*\\*+)*/)))+(?=\\+)|(?<=-)((?:[\\000-\\011\\013\\014\\016-'", "r'\\040]|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/)))+(?=-)|(?:[\\000-\\011\\013'", "r'\\014\\016-\\040]|(?:/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/))+|(?:(?:(?://[^'", "r'\\r\\n]*)?[\\r\\n])(?:[\\000-\\011\\013\\014\\016-\\040]|(?:/\\*[^*]*\\*+(?:[^'", "r'/*][^*]*\\*+)*/))*)+'", ",", "subber", ",", "'\\n%s\\n'", "%", "script", ")", ".", "strip", "(", ")" ]
https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/src/inspector/build/rjsmin.py#L230-L290
CGRU/cgru
1881a4128530e3d31ac6c25314c18314fc50c2c7
plugins/maya/afanasy/maya_ui_proc.py
python
browseFile
(rootDir, control, extFilter)
browseFile :param rootDir: :param control: :param extFilter: :return:
browseFile
[ "browseFile" ]
def browseFile(rootDir, control, extFilter): """browseFile :param rootDir: :param control: :param extFilter: :return: """ path = cmds.textFieldButtonGrp(control, q=True, text=True) startDir = path if isRelative(path): startDir = os.path.join(rootDir, path) fileNames = cmds.fileDialog2( fileMode=1, startingDirectory=os.path.dirname(startDir), dialogStyle=1, fileFilter=extFilter ) if fileNames is not None: fileName = cmds.workspace(projectPath=fromNativePath(fileNames[0])) cmds.textFieldButtonGrp( control, e=True, text=fileName, forceChangeCommand=True )
[ "def", "browseFile", "(", "rootDir", ",", "control", ",", "extFilter", ")", ":", "path", "=", "cmds", ".", "textFieldButtonGrp", "(", "control", ",", "q", "=", "True", ",", "text", "=", "True", ")", "startDir", "=", "path", "if", "isRelative", "(", "path", ")", ":", "startDir", "=", "os", ".", "path", ".", "join", "(", "rootDir", ",", "path", ")", "fileNames", "=", "cmds", ".", "fileDialog2", "(", "fileMode", "=", "1", ",", "startingDirectory", "=", "os", ".", "path", ".", "dirname", "(", "startDir", ")", ",", "dialogStyle", "=", "1", ",", "fileFilter", "=", "extFilter", ")", "if", "fileNames", "is", "not", "None", ":", "fileName", "=", "cmds", ".", "workspace", "(", "projectPath", "=", "fromNativePath", "(", "fileNames", "[", "0", "]", ")", ")", "cmds", ".", "textFieldButtonGrp", "(", "control", ",", "e", "=", "True", ",", "text", "=", "fileName", ",", "forceChangeCommand", "=", "True", ")" ]
https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/plugins/maya/afanasy/maya_ui_proc.py#L294-L318
domino-team/openwrt-cc
8b181297c34d14d3ca521cc9f31430d561dbc688
package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py
python
MacTool.ExecMergeInfoPlist
(self, output, *inputs)
Merge multiple .plist files into a single .plist file.
Merge multiple .plist files into a single .plist file.
[ "Merge", "multiple", ".", "plist", "files", "into", "a", "single", ".", "plist", "file", "." ]
def ExecMergeInfoPlist(self, output, *inputs): """Merge multiple .plist files into a single .plist file.""" merged_plist = {} for path in inputs: plist = self._LoadPlistMaybeBinary(path) self._MergePlist(merged_plist, plist) plistlib.writePlist(merged_plist, output)
[ "def", "ExecMergeInfoPlist", "(", "self", ",", "output", ",", "*", "inputs", ")", ":", "merged_plist", "=", "{", "}", "for", "path", "in", "inputs", ":", "plist", "=", "self", ".", "_LoadPlistMaybeBinary", "(", "path", ")", "self", ".", "_MergePlist", "(", "merged_plist", ",", "plist", ")", "plistlib", ".", "writePlist", "(", "merged_plist", ",", "output", ")" ]
https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py#L344-L350
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/importlib_metadata/__init__.py
python
files
(distribution_name)
return distribution(distribution_name).files
Return a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution.
Return a list of files for the named package.
[ "Return", "a", "list", "of", "files", "for", "the", "named", "package", "." ]
def files(distribution_name): """Return a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution. """ return distribution(distribution_name).files
[ "def", "files", "(", "distribution_name", ")", ":", "return", "distribution", "(", "distribution_name", ")", ".", "files" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/importlib_metadata/__init__.py#L583-L589
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/framemanager.py
python
AuiManager.GetPaneByName
(self, name)
return NonePaneInfo
This version of :meth:`GetPane` looks up a pane based on a 'pane name'. :param string `name`: the pane name. :see: :meth:`GetPane`
This version of :meth:`GetPane` looks up a pane based on a 'pane name'.
[ "This", "version", "of", ":", "meth", ":", "GetPane", "looks", "up", "a", "pane", "based", "on", "a", "pane", "name", "." ]
def GetPaneByName(self, name): """ This version of :meth:`GetPane` looks up a pane based on a 'pane name'. :param string `name`: the pane name. :see: :meth:`GetPane` """ for p in self._panes: if p.name == name: return p return NonePaneInfo
[ "def", "GetPaneByName", "(", "self", ",", "name", ")", ":", "for", "p", "in", "self", ".", "_panes", ":", "if", "p", ".", "name", "==", "name", ":", "return", "p", "return", "NonePaneInfo" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L4272-L4285
wesnoth/wesnoth
6ccac5a5e8ff75303c9190c0da60580925cb32c0
data/tools/wesnoth/wmlparser.py
python
Parser.read_encoded
(self, filename)
return text
Helper for gracefully handling non-utf8 files and fixing up non-unix line endings.
Helper for gracefully handling non-utf8 files and fixing up non-unix line endings.
[ "Helper", "for", "gracefully", "handling", "non", "-", "utf8", "files", "and", "fixing", "up", "non", "-", "unix", "line", "endings", "." ]
def read_encoded(self, filename): """ Helper for gracefully handling non-utf8 files and fixing up non-unix line endings. """ try: with open(filename, encoding="utf8") as f: text = f.read() except UnicodeDecodeError: with open(filename, encoding="latin1") as f: text = f.read() except IOError: sys.stderr.write("Cannot open file %s!\n" % filename) return "" text = text.replace("\r\n", "\n").replace("\t", " ").replace("\r", "\n") if text == "" or text[-1] != "\n": text += "\n" return text
[ "def", "read_encoded", "(", "self", ",", "filename", ")", ":", "try", ":", "with", "open", "(", "filename", ",", "encoding", "=", "\"utf8\"", ")", "as", "f", ":", "text", "=", "f", ".", "read", "(", ")", "except", "UnicodeDecodeError", ":", "with", "open", "(", "filename", ",", "encoding", "=", "\"latin1\"", ")", "as", "f", ":", "text", "=", "f", ".", "read", "(", ")", "except", "IOError", ":", "sys", ".", "stderr", ".", "write", "(", "\"Cannot open file %s!\\n\"", "%", "filename", ")", "return", "\"\"", "text", "=", "text", ".", "replace", "(", "\"\\r\\n\"", ",", "\"\\n\"", ")", ".", "replace", "(", "\"\\t\"", ",", "\" \"", ")", ".", "replace", "(", "\"\\r\"", ",", "\"\\n\"", ")", "if", "text", "==", "\"\"", "or", "text", "[", "-", "1", "]", "!=", "\"\\n\"", ":", "text", "+=", "\"\\n\"", "return", "text" ]
https://github.com/wesnoth/wesnoth/blob/6ccac5a5e8ff75303c9190c0da60580925cb32c0/data/tools/wesnoth/wmlparser.py#L99-L116
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/dataview.py
python
DataViewVirtualListModel.GetRow
(*args, **kwargs)
return _dataview.DataViewVirtualListModel_GetRow(*args, **kwargs)
GetRow(self, DataViewItem item) -> unsigned int Returns the row position of item.
GetRow(self, DataViewItem item) -> unsigned int
[ "GetRow", "(", "self", "DataViewItem", "item", ")", "-", ">", "unsigned", "int" ]
def GetRow(*args, **kwargs): """ GetRow(self, DataViewItem item) -> unsigned int Returns the row position of item. """ return _dataview.DataViewVirtualListModel_GetRow(*args, **kwargs)
[ "def", "GetRow", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "DataViewVirtualListModel_GetRow", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L1056-L1062
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/profiler/internal/flops_registry.py
python
_unary_op_flops
(graph, node, ops_per_element=1)
return ops.OpStats("flops", in_shape.num_elements() * ops_per_element)
Common code which compute flops for unary operations.
Common code which compute flops for unary operations.
[ "Common", "code", "which", "compute", "flops", "for", "unary", "operations", "." ]
def _unary_op_flops(graph, node, ops_per_element=1): """Common code which compute flops for unary operations.""" in_shape = graph_util.tensor_shape_from_node_def_name(graph, node.input[0]) in_shape.assert_is_fully_defined() return ops.OpStats("flops", in_shape.num_elements() * ops_per_element)
[ "def", "_unary_op_flops", "(", "graph", ",", "node", ",", "ops_per_element", "=", "1", ")", ":", "in_shape", "=", "graph_util", ".", "tensor_shape_from_node_def_name", "(", "graph", ",", "node", ".", "input", "[", "0", "]", ")", "in_shape", ".", "assert_is_fully_defined", "(", ")", "return", "ops", ".", "OpStats", "(", "\"flops\"", ",", "in_shape", ".", "num_elements", "(", ")", "*", "ops_per_element", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/profiler/internal/flops_registry.py#L64-L68
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/stc.py
python
StyledTextCtrl.IndicatorAllOnFor
(*args, **kwargs)
return _stc.StyledTextCtrl_IndicatorAllOnFor(*args, **kwargs)
IndicatorAllOnFor(self, int position) -> int Are any indicators present at position?
IndicatorAllOnFor(self, int position) -> int
[ "IndicatorAllOnFor", "(", "self", "int", "position", ")", "-", ">", "int" ]
def IndicatorAllOnFor(*args, **kwargs): """ IndicatorAllOnFor(self, int position) -> int Are any indicators present at position? """ return _stc.StyledTextCtrl_IndicatorAllOnFor(*args, **kwargs)
[ "def", "IndicatorAllOnFor", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_IndicatorAllOnFor", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L5695-L5701
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/hermite.py
python
hermvander3d
(x, y, z, deg)
return pu._vander_nd_flat((hermvander, hermvander, hermvander), (x, y, z), deg)
Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees `deg` and sample points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`, then The pseudo-Vandermonde matrix is defined by .. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = H_i(x)*H_j(y)*H_k(z), where `0 <= i <= l`, `0 <= j <= m`, and `0 <= j <= n`. The leading indices of `V` index the points `(x, y, z)` and the last index encodes the degrees of the Hermite polynomials. If ``V = hermvander3d(x, y, z, [xdeg, ydeg, zdeg])``, then the columns of `V` correspond to the elements of a 3-D coefficient array `c` of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order .. math:: c_{000}, c_{001}, c_{002},... , c_{010}, c_{011}, c_{012},... and ``np.dot(V, c.flat)`` and ``hermval3d(x, y, z, c)`` will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D Hermite series of the same degrees and sample points. Parameters ---------- x, y, z : array_like Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays. deg : list of ints List of maximum degrees of the form [x_deg, y_deg, z_deg]. Returns ------- vander3d : ndarray The shape of the returned matrix is ``x.shape + (order,)``, where :math:`order = (deg[0]+1)*(deg([1]+1)*(deg[2]+1)`. The dtype will be the same as the converted `x`, `y`, and `z`. See Also -------- hermvander, hermvander3d, hermval2d, hermval3d Notes ----- .. versionadded:: 1.7.0
Pseudo-Vandermonde matrix of given degrees.
[ "Pseudo", "-", "Vandermonde", "matrix", "of", "given", "degrees", "." ]
def hermvander3d(x, y, z, deg): """Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees `deg` and sample points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`, then The pseudo-Vandermonde matrix is defined by .. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = H_i(x)*H_j(y)*H_k(z), where `0 <= i <= l`, `0 <= j <= m`, and `0 <= j <= n`. The leading indices of `V` index the points `(x, y, z)` and the last index encodes the degrees of the Hermite polynomials. If ``V = hermvander3d(x, y, z, [xdeg, ydeg, zdeg])``, then the columns of `V` correspond to the elements of a 3-D coefficient array `c` of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order .. math:: c_{000}, c_{001}, c_{002},... , c_{010}, c_{011}, c_{012},... and ``np.dot(V, c.flat)`` and ``hermval3d(x, y, z, c)`` will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D Hermite series of the same degrees and sample points. Parameters ---------- x, y, z : array_like Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays. deg : list of ints List of maximum degrees of the form [x_deg, y_deg, z_deg]. Returns ------- vander3d : ndarray The shape of the returned matrix is ``x.shape + (order,)``, where :math:`order = (deg[0]+1)*(deg([1]+1)*(deg[2]+1)`. The dtype will be the same as the converted `x`, `y`, and `z`. See Also -------- hermvander, hermvander3d, hermval2d, hermval3d Notes ----- .. versionadded:: 1.7.0 """ return pu._vander_nd_flat((hermvander, hermvander, hermvander), (x, y, z), deg)
[ "def", "hermvander3d", "(", "x", ",", "y", ",", "z", ",", "deg", ")", ":", "return", "pu", ".", "_vander_nd_flat", "(", "(", "hermvander", ",", "hermvander", ",", "hermvander", ")", ",", "(", "x", ",", "y", ",", "z", ")", ",", "deg", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/hermite.py#L1199-L1250
SequoiaDB/SequoiaDB
2894ed7e5bd6fe57330afc900cf76d0ff0df9f64
tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py
python
xpathParserContext.xpathConcatFunction
(self, nargs)
Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments.
Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments.
[ "Implement", "the", "concat", "()", "XPath", "function", "string", "concat", "(", "string", "string", "string", "*", ")", "The", "concat", "function", "returns", "the", "concatenation", "of", "its", "arguments", "." ]
def xpathConcatFunction(self, nargs): """Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments. """ libxml2mod.xmlXPathConcatFunction(self._o, nargs)
[ "def", "xpathConcatFunction", "(", "self", ",", "nargs", ")", ":", "libxml2mod", ".", "xmlXPathConcatFunction", "(", "self", ".", "_o", ",", "nargs", ")" ]
https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L7417-L7421
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2.py
python
uCSIsHiragana
(code)
return ret
Check whether the character is part of Hiragana UCS Block
Check whether the character is part of Hiragana UCS Block
[ "Check", "whether", "the", "character", "is", "part", "of", "Hiragana", "UCS", "Block" ]
def uCSIsHiragana(code): """Check whether the character is part of Hiragana UCS Block """ ret = libxml2mod.xmlUCSIsHiragana(code) return ret
[ "def", "uCSIsHiragana", "(", "code", ")", ":", "ret", "=", "libxml2mod", ".", "xmlUCSIsHiragana", "(", "code", ")", "return", "ret" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2608-L2611
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/grid.py
python
GridCellAttr.GetRenderer
(*args, **kwargs)
return _grid.GridCellAttr_GetRenderer(*args, **kwargs)
GetRenderer(self, Grid grid, int row, int col) -> GridCellRenderer
GetRenderer(self, Grid grid, int row, int col) -> GridCellRenderer
[ "GetRenderer", "(", "self", "Grid", "grid", "int", "row", "int", "col", ")", "-", ">", "GridCellRenderer" ]
def GetRenderer(*args, **kwargs): """GetRenderer(self, Grid grid, int row, int col) -> GridCellRenderer""" return _grid.GridCellAttr_GetRenderer(*args, **kwargs)
[ "def", "GetRenderer", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridCellAttr_GetRenderer", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L643-L645
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/ed_menu.py
python
KeyBinder.GetBinding
(self, item_id)
return unicode(shortcut)
Get the keybinding string for use in a menu @param item_id: Menu Item Id @return: string
Get the keybinding string for use in a menu @param item_id: Menu Item Id @return: string
[ "Get", "the", "keybinding", "string", "for", "use", "in", "a", "menu", "@param", "item_id", ":", "Menu", "Item", "Id", "@return", ":", "string" ]
def GetBinding(self, item_id): """Get the keybinding string for use in a menu @param item_id: Menu Item Id @return: string """ rbind = self.GetRawBinding(item_id) shortcut = u'' if rbind is not None: shortcut = u"+".join(rbind) if len(shortcut): shortcut = u"\t" + shortcut return unicode(shortcut)
[ "def", "GetBinding", "(", "self", ",", "item_id", ")", ":", "rbind", "=", "self", ".", "GetRawBinding", "(", "item_id", ")", "shortcut", "=", "u''", "if", "rbind", "is", "not", "None", ":", "shortcut", "=", "u\"+\"", ".", "join", "(", "rbind", ")", "if", "len", "(", "shortcut", ")", ":", "shortcut", "=", "u\"\\t\"", "+", "shortcut", "return", "unicode", "(", "shortcut", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_menu.py#L248-L260
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/richtext.py
python
RichTextCtrl.SetListStyle
(*args, **kwargs)
return _richtext.RichTextCtrl_SetListStyle(*args, **kwargs)
SetListStyle(self, RichTextRange range, String defName, int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1) -> bool
SetListStyle(self, RichTextRange range, String defName, int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1) -> bool
[ "SetListStyle", "(", "self", "RichTextRange", "range", "String", "defName", "int", "flags", "=", "RICHTEXT_SETSTYLE_WITH_UNDO", "int", "startFrom", "=", "1", "int", "specifiedLevel", "=", "-", "1", ")", "-", ">", "bool" ]
def SetListStyle(*args, **kwargs): """ SetListStyle(self, RichTextRange range, String defName, int flags=RICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1) -> bool """ return _richtext.RichTextCtrl_SetListStyle(*args, **kwargs)
[ "def", "SetListStyle", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextCtrl_SetListStyle", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L3185-L3190
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/mozjar.py
python
JarLog.canonicalize
(url)
The jar path is stored in a MOZ_JAR_LOG_FILE log as a url. This method returns a unique value corresponding to such urls. - file:///{path} becomes {path} - jar:file:///{path}!/{subpath} becomes ({path}, {subpath}) - jar:jar:file:///{path}!/{subpath}!/{subpath2} becomes ({path}, {subpath}, {subpath2})
The jar path is stored in a MOZ_JAR_LOG_FILE log as a url. This method returns a unique value corresponding to such urls. - file:///{path} becomes {path} - jar:file:///{path}!/{subpath} becomes ({path}, {subpath}) - jar:jar:file:///{path}!/{subpath}!/{subpath2} becomes ({path}, {subpath}, {subpath2})
[ "The", "jar", "path", "is", "stored", "in", "a", "MOZ_JAR_LOG_FILE", "log", "as", "a", "url", ".", "This", "method", "returns", "a", "unique", "value", "corresponding", "to", "such", "urls", ".", "-", "file", ":", "///", "{", "path", "}", "becomes", "{", "path", "}", "-", "jar", ":", "file", ":", "///", "{", "path", "}", "!", "/", "{", "subpath", "}", "becomes", "(", "{", "path", "}", "{", "subpath", "}", ")", "-", "jar", ":", "jar", ":", "file", ":", "///", "{", "path", "}", "!", "/", "{", "subpath", "}", "!", "/", "{", "subpath2", "}", "becomes", "(", "{", "path", "}", "{", "subpath", "}", "{", "subpath2", "}", ")" ]
def canonicalize(url): ''' The jar path is stored in a MOZ_JAR_LOG_FILE log as a url. This method returns a unique value corresponding to such urls. - file:///{path} becomes {path} - jar:file:///{path}!/{subpath} becomes ({path}, {subpath}) - jar:jar:file:///{path}!/{subpath}!/{subpath2} becomes ({path}, {subpath}, {subpath2}) ''' if not isinstance(url, ParseResult): # Assume that if it doesn't start with jar: or file:, it's a path. if not url.startswith(('jar:', 'file:')): url = 'file:///' + os.path.abspath(url) url = urlparse(url) assert url.scheme assert url.scheme in ('jar', 'file') if url.scheme == 'jar': path = JarLog.canonicalize(url.path) if isinstance(path, tuple): return path[:-1] + tuple(path[-1].split('!/', 1)) return tuple(path.split('!/', 1)) if url.scheme == 'file': assert os.path.isabs(url.path) path = url.path # On Windows, url.path will be /drive:/path ; on Unix systems, # /path. As we want drive:/path instead of /drive:/path on Windows, # remove the leading /. if os.path.isabs(path[1:]): path = path[1:] path = os.path.realpath(path) return mozpath.normsep(os.path.normcase(path))
[ "def", "canonicalize", "(", "url", ")", ":", "if", "not", "isinstance", "(", "url", ",", "ParseResult", ")", ":", "# Assume that if it doesn't start with jar: or file:, it's a path.", "if", "not", "url", ".", "startswith", "(", "(", "'jar:'", ",", "'file:'", ")", ")", ":", "url", "=", "'file:///'", "+", "os", ".", "path", ".", "abspath", "(", "url", ")", "url", "=", "urlparse", "(", "url", ")", "assert", "url", ".", "scheme", "assert", "url", ".", "scheme", "in", "(", "'jar'", ",", "'file'", ")", "if", "url", ".", "scheme", "==", "'jar'", ":", "path", "=", "JarLog", ".", "canonicalize", "(", "url", ".", "path", ")", "if", "isinstance", "(", "path", ",", "tuple", ")", ":", "return", "path", "[", ":", "-", "1", "]", "+", "tuple", "(", "path", "[", "-", "1", "]", ".", "split", "(", "'!/'", ",", "1", ")", ")", "return", "tuple", "(", "path", ".", "split", "(", "'!/'", ",", "1", ")", ")", "if", "url", ".", "scheme", "==", "'file'", ":", "assert", "os", ".", "path", ".", "isabs", "(", "url", ".", "path", ")", "path", "=", "url", ".", "path", "# On Windows, url.path will be /drive:/path ; on Unix systems,", "# /path. As we want drive:/path instead of /drive:/path on Windows,", "# remove the leading /.", "if", "os", ".", "path", ".", "isabs", "(", "path", "[", "1", ":", "]", ")", ":", "path", "=", "path", "[", "1", ":", "]", "path", "=", "os", ".", "path", ".", "realpath", "(", "path", ")", "return", "mozpath", ".", "normsep", "(", "os", ".", "path", ".", "normcase", "(", "path", ")", ")" ]
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/mozjar.py#L776-L806
godlikepanos/anki-3d-engine
e2f65e5045624492571ea8527a4dbf3fad8d2c0a
AnKi/Script/LuaGlueGen.py
python
args
(args_el, stack_index)
return args_str
Write the pop code for argument parsing and return the arg list
Write the pop code for argument parsing and return the arg list
[ "Write", "the", "pop", "code", "for", "argument", "parsing", "and", "return", "the", "arg", "list" ]
def args(args_el, stack_index): """ Write the pop code for argument parsing and return the arg list """ if args_el is None: return "" wglue("// Pop arguments") arg_index = 0 # Do the work args_str = "" arg_index = 0 for arg_el in args_el.iter("arg"): arg(arg_el.text, stack_index, arg_index) args_str += "arg%d, " % arg_index wglue("") stack_index += 1 arg_index += 1 if len(args_str) > 0: args_str = args_str[:-2] return args_str
[ "def", "args", "(", "args_el", ",", "stack_index", ")", ":", "if", "args_el", "is", "None", ":", "return", "\"\"", "wglue", "(", "\"// Pop arguments\"", ")", "arg_index", "=", "0", "# Do the work", "args_str", "=", "\"\"", "arg_index", "=", "0", "for", "arg_el", "in", "args_el", ".", "iter", "(", "\"arg\"", ")", ":", "arg", "(", "arg_el", ".", "text", ",", "stack_index", ",", "arg_index", ")", "args_str", "+=", "\"arg%d, \"", "%", "arg_index", "wglue", "(", "\"\"", ")", "stack_index", "+=", "1", "arg_index", "+=", "1", "if", "len", "(", "args_str", ")", ">", "0", ":", "args_str", "=", "args_str", "[", ":", "-", "2", "]", "return", "args_str" ]
https://github.com/godlikepanos/anki-3d-engine/blob/e2f65e5045624492571ea8527a4dbf3fad8d2c0a/AnKi/Script/LuaGlueGen.py#L210-L232
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py
python
_find_adapter
(registry, ob)
Return an adapter factory for `ob` from `registry`
Return an adapter factory for `ob` from `registry`
[ "Return", "an", "adapter", "factory", "for", "ob", "from", "registry" ]
def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob)))) for t in types: if t in registry: return registry[t]
[ "def", "_find_adapter", "(", "registry", ",", "ob", ")", ":", "types", "=", "_always_object", "(", "inspect", ".", "getmro", "(", "getattr", "(", "ob", ",", "'__class__'", ",", "type", "(", "ob", ")", ")", ")", ")", "for", "t", "in", "types", ":", "if", "t", "in", "registry", ":", "return", "registry", "[", "t", "]" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py#L3172-L3177
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/turtle.py
python
TNavigator.circle
(self, radius, extent = None, steps = None)
Draw a circle with given radius. Arguments: radius -- a number extent (optional) -- a number steps (optional) -- an integer Draw a circle with given radius. The center is radius units left of the turtle; extent - an angle - determines which part of the circle is drawn. If extent is not given, draw the entire circle. If extent is not a full circle, one endpoint of the arc is the current pen position. Draw the arc in counterclockwise direction if radius is positive, otherwise in clockwise direction. Finally the direction of the turtle is changed by the amount of extent. As the circle is approximated by an inscribed regular polygon, steps determines the number of steps to use. If not given, it will be calculated automatically. Maybe used to draw regular polygons. call: circle(radius) # full circle --or: circle(radius, extent) # arc --or: circle(radius, extent, steps) --or: circle(radius, steps=6) # 6-sided polygon Example (for a Turtle instance named turtle): >>> turtle.circle(50) >>> turtle.circle(120, 180) # semicircle
Draw a circle with given radius.
[ "Draw", "a", "circle", "with", "given", "radius", "." ]
def circle(self, radius, extent = None, steps = None): """ Draw a circle with given radius. Arguments: radius -- a number extent (optional) -- a number steps (optional) -- an integer Draw a circle with given radius. The center is radius units left of the turtle; extent - an angle - determines which part of the circle is drawn. If extent is not given, draw the entire circle. If extent is not a full circle, one endpoint of the arc is the current pen position. Draw the arc in counterclockwise direction if radius is positive, otherwise in clockwise direction. Finally the direction of the turtle is changed by the amount of extent. As the circle is approximated by an inscribed regular polygon, steps determines the number of steps to use. If not given, it will be calculated automatically. Maybe used to draw regular polygons. call: circle(radius) # full circle --or: circle(radius, extent) # arc --or: circle(radius, extent, steps) --or: circle(radius, steps=6) # 6-sided polygon Example (for a Turtle instance named turtle): >>> turtle.circle(50) >>> turtle.circle(120, 180) # semicircle """ if self.undobuffer: self.undobuffer.push(["seq"]) self.undobuffer.cumulate = True speed = self.speed() if extent is None: extent = self._fullcircle if steps is None: frac = abs(extent)/self._fullcircle steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac) w = 1.0 * extent / steps w2 = 0.5 * w l = 2.0 * radius * math.sin(w2*math.pi/180.0*self._degreesPerAU) if radius < 0: l, w, w2 = -l, -w, -w2 tr = self._tracer() dl = self._delay() if speed == 0: self._tracer(0, 0) else: self.speed(0) self._rotate(w2) for i in range(steps): self.speed(speed) self._go(l) self.speed(0) self._rotate(w) self._rotate(-w2) if speed == 0: self._tracer(tr, dl) self.speed(speed) if self.undobuffer: self.undobuffer.cumulate = False
[ "def", "circle", "(", "self", ",", "radius", ",", "extent", "=", "None", ",", "steps", "=", "None", ")", ":", "if", "self", ".", "undobuffer", ":", "self", ".", "undobuffer", ".", "push", "(", "[", "\"seq\"", "]", ")", "self", ".", "undobuffer", ".", "cumulate", "=", "True", "speed", "=", "self", ".", "speed", "(", ")", "if", "extent", "is", "None", ":", "extent", "=", "self", ".", "_fullcircle", "if", "steps", "is", "None", ":", "frac", "=", "abs", "(", "extent", ")", "/", "self", ".", "_fullcircle", "steps", "=", "1", "+", "int", "(", "min", "(", "11", "+", "abs", "(", "radius", ")", "/", "6.0", ",", "59.0", ")", "*", "frac", ")", "w", "=", "1.0", "*", "extent", "/", "steps", "w2", "=", "0.5", "*", "w", "l", "=", "2.0", "*", "radius", "*", "math", ".", "sin", "(", "w2", "*", "math", ".", "pi", "/", "180.0", "*", "self", ".", "_degreesPerAU", ")", "if", "radius", "<", "0", ":", "l", ",", "w", ",", "w2", "=", "-", "l", ",", "-", "w", ",", "-", "w2", "tr", "=", "self", ".", "_tracer", "(", ")", "dl", "=", "self", ".", "_delay", "(", ")", "if", "speed", "==", "0", ":", "self", ".", "_tracer", "(", "0", ",", "0", ")", "else", ":", "self", ".", "speed", "(", "0", ")", "self", ".", "_rotate", "(", "w2", ")", "for", "i", "in", "range", "(", "steps", ")", ":", "self", ".", "speed", "(", "speed", ")", "self", ".", "_go", "(", "l", ")", "self", ".", "speed", "(", "0", ")", "self", ".", "_rotate", "(", "w", ")", "self", ".", "_rotate", "(", "-", "w2", ")", "if", "speed", "==", "0", ":", "self", ".", "_tracer", "(", "tr", ",", "dl", ")", "self", ".", "speed", "(", "speed", ")", "if", "self", ".", "undobuffer", ":", "self", ".", "undobuffer", ".", "cumulate", "=", "False" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/turtle.py#L1938-L1999
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/control_flow_ops.py
python
WhileContext.AddForwardLoopCounter
(self, outer_grad_state)
return total_iterations, next_n
Adds a loop that counts the number of iterations. This is added to the forward loop at the time when we start to create the loop for backprop gradient computation. Called in the outer context of this forward context. The pseudocode is: `n = 0; while (_pivot) { n++; }` Note that a control dependency is added to `n` to ensure the correct execution order of stack push ops. Args: outer_grad_state: The outer grad state. None if not nested. Returns: The number of iterations taken by the forward loop and the loop index.
Adds a loop that counts the number of iterations.
[ "Adds", "a", "loop", "that", "counts", "the", "number", "of", "iterations", "." ]
def AddForwardLoopCounter(self, outer_grad_state): """Adds a loop that counts the number of iterations. This is added to the forward loop at the time when we start to create the loop for backprop gradient computation. Called in the outer context of this forward context. The pseudocode is: `n = 0; while (_pivot) { n++; }` Note that a control dependency is added to `n` to ensure the correct execution order of stack push ops. Args: outer_grad_state: The outer grad state. None if not nested. Returns: The number of iterations taken by the forward loop and the loop index. """ n = constant_op.constant(0, name="f_count") if outer_grad_state is not None: # Force the stack pushes of i-th execution of an inner loop to be ordered # before the pushes of (i+1)-th execution of the same inner loop. outer_add_op = outer_grad_state.forward_index.op.inputs[0].op n.op._add_control_input(outer_add_op) # pylint: disable=protected-access self.Enter() self.AddName(n.name) enter_n = _Enter(n, self._name, is_constant=False, parallel_iterations=self._parallel_iterations, name="f_count") self.loop_enters.append(enter_n) merge_n = merge([enter_n, enter_n])[0] switch_n = switch(merge_n, self._pivot) index = math_ops.add(switch_n[1], 1) next_n = _NextIteration(index) merge_n.op._update_input(1, next_n) total_iterations = exit(switch_n[0], name="f_count") self.loop_exits.append(total_iterations) self.ExitResult([total_iterations]) self.Exit() return total_iterations, next_n
[ "def", "AddForwardLoopCounter", "(", "self", ",", "outer_grad_state", ")", ":", "n", "=", "constant_op", ".", "constant", "(", "0", ",", "name", "=", "\"f_count\"", ")", "if", "outer_grad_state", "is", "not", "None", ":", "# Force the stack pushes of i-th execution of an inner loop to be ordered", "# before the pushes of (i+1)-th execution of the same inner loop.", "outer_add_op", "=", "outer_grad_state", ".", "forward_index", ".", "op", ".", "inputs", "[", "0", "]", ".", "op", "n", ".", "op", ".", "_add_control_input", "(", "outer_add_op", ")", "# pylint: disable=protected-access", "self", ".", "Enter", "(", ")", "self", ".", "AddName", "(", "n", ".", "name", ")", "enter_n", "=", "_Enter", "(", "n", ",", "self", ".", "_name", ",", "is_constant", "=", "False", ",", "parallel_iterations", "=", "self", ".", "_parallel_iterations", ",", "name", "=", "\"f_count\"", ")", "self", ".", "loop_enters", ".", "append", "(", "enter_n", ")", "merge_n", "=", "merge", "(", "[", "enter_n", ",", "enter_n", "]", ")", "[", "0", "]", "switch_n", "=", "switch", "(", "merge_n", ",", "self", ".", "_pivot", ")", "index", "=", "math_ops", ".", "add", "(", "switch_n", "[", "1", "]", ",", "1", ")", "next_n", "=", "_NextIteration", "(", "index", ")", "merge_n", ".", "op", ".", "_update_input", "(", "1", ",", "next_n", ")", "total_iterations", "=", "exit", "(", "switch_n", "[", "0", "]", ",", "name", "=", "\"f_count\"", ")", "self", ".", "loop_exits", ".", "append", "(", "total_iterations", ")", "self", ".", "ExitResult", "(", "[", "total_iterations", "]", ")", "self", ".", "Exit", "(", ")", "return", "total_iterations", ",", "next_n" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/control_flow_ops.py#L2251-L2295
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py
python
ConfigObj._str
(self, value)
Used by ``stringify`` within validate, to turn non-string values into strings.
Used by ``stringify`` within validate, to turn non-string values into strings.
[ "Used", "by", "stringify", "within", "validate", "to", "turn", "non", "-", "string", "values", "into", "strings", "." ]
def _str(self, value): """ Used by ``stringify`` within validate, to turn non-string values into strings. """ if not isinstance(value, basestring): return str(value) else: return value
[ "def", "_str", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "basestring", ")", ":", "return", "str", "(", "value", ")", "else", ":", "return", "value" ]
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/configobj/configobj.py#L1522-L1530
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_core.py
python
Window.InheritsBackgroundColour
(*args, **kwargs)
return _core_.Window_InheritsBackgroundColour(*args, **kwargs)
InheritsBackgroundColour(self) -> bool
InheritsBackgroundColour(self) -> bool
[ "InheritsBackgroundColour", "(", "self", ")", "-", ">", "bool" ]
def InheritsBackgroundColour(*args, **kwargs): """InheritsBackgroundColour(self) -> bool""" return _core_.Window_InheritsBackgroundColour(*args, **kwargs)
[ "def", "InheritsBackgroundColour", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Window_InheritsBackgroundColour", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L10902-L10904
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/req/req_uninstall.py
python
UninstallPathSet._allowed_to_proceed
(self, verbose)
return ask('Proceed (y/n)? ', ('y', 'n')) == 'y'
Display which files would be deleted and prompt for confirmation
Display which files would be deleted and prompt for confirmation
[ "Display", "which", "files", "would", "be", "deleted", "and", "prompt", "for", "confirmation" ]
def _allowed_to_proceed(self, verbose): # type: (bool) -> bool """Display which files would be deleted and prompt for confirmation """ def _display(msg, paths): # type: (str, Iterable[str]) -> None if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(paths)): logger.info(path) if not verbose: will_remove, will_skip = compress_for_output_listing(self.paths) else: # In verbose mode, display all the files that are going to be # deleted. will_remove = set(self.paths) will_skip = set() _display('Would remove:', will_remove) _display('Would not remove (might be manually added):', will_skip) _display('Would not remove (outside of prefix):', self._refuse) if verbose: _display('Will actually move:', compress_for_rename(self.paths)) return ask('Proceed (y/n)? ', ('y', 'n')) == 'y'
[ "def", "_allowed_to_proceed", "(", "self", ",", "verbose", ")", ":", "# type: (bool) -> bool", "def", "_display", "(", "msg", ",", "paths", ")", ":", "# type: (str, Iterable[str]) -> None", "if", "not", "paths", ":", "return", "logger", ".", "info", "(", "msg", ")", "with", "indent_log", "(", ")", ":", "for", "path", "in", "sorted", "(", "compact", "(", "paths", ")", ")", ":", "logger", ".", "info", "(", "path", ")", "if", "not", "verbose", ":", "will_remove", ",", "will_skip", "=", "compress_for_output_listing", "(", "self", ".", "paths", ")", "else", ":", "# In verbose mode, display all the files that are going to be", "# deleted.", "will_remove", "=", "set", "(", "self", ".", "paths", ")", "will_skip", "=", "set", "(", ")", "_display", "(", "'Would remove:'", ",", "will_remove", ")", "_display", "(", "'Would not remove (might be manually added):'", ",", "will_skip", ")", "_display", "(", "'Would not remove (outside of prefix):'", ",", "self", ".", "_refuse", ")", "if", "verbose", ":", "_display", "(", "'Will actually move:'", ",", "compress_for_rename", "(", "self", ".", "paths", ")", ")", "return", "ask", "(", "'Proceed (y/n)? '", ",", "(", "'y'", ",", "'n'", ")", ")", "==", "'y'" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/req/req_uninstall.py#L408-L437
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/ntpath.py
python
split
(p)
return d + head, tail
Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.
Split a pathname.
[ "Split", "a", "pathname", "." ]
def split(p): """Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.""" d, p = splitdrive(p) # set i to index beyond p's last slash i = len(p) while i and p[i-1] not in '/\\': i = i - 1 head, tail = p[:i], p[i:] # now tail has no slashes # remove trailing slashes from head, unless it's all slashes head2 = head while head2 and head2[-1] in '/\\': head2 = head2[:-1] head = head2 or head return d + head, tail
[ "def", "split", "(", "p", ")", ":", "d", ",", "p", "=", "splitdrive", "(", "p", ")", "# set i to index beyond p's last slash", "i", "=", "len", "(", "p", ")", "while", "i", "and", "p", "[", "i", "-", "1", "]", "not", "in", "'/\\\\'", ":", "i", "=", "i", "-", "1", "head", ",", "tail", "=", "p", "[", ":", "i", "]", ",", "p", "[", "i", ":", "]", "# now tail has no slashes", "# remove trailing slashes from head, unless it's all slashes", "head2", "=", "head", "while", "head2", "and", "head2", "[", "-", "1", "]", "in", "'/\\\\'", ":", "head2", "=", "head2", "[", ":", "-", "1", "]", "head", "=", "head2", "or", "head", "return", "d", "+", "head", ",", "tail" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/ntpath.py#L164-L181
trilinos/Trilinos
6168be6dd51e35e1cd681e9c4b24433e709df140
packages/seacas/scripts/exomerge3.py
python
ExodusModel.create_side_set_from_expression
(self, side_set_id, expression, element_block_ids='all', tolerance='auto', timesteps='last_if_any', zero_member_warning=True)
Create a side set from faces which satisfy an expression. Only external element faces of the given element blocks are checked. For example, if the model had a symmetry plane at 'Y = 0', the expression 'Y == 0' would select all element faces on this plane. Example: >>> model.create_side_set_from_expression(1, 'Y == 0')
Create a side set from faces which satisfy an expression.
[ "Create", "a", "side", "set", "from", "faces", "which", "satisfy", "an", "expression", "." ]
def create_side_set_from_expression(self, side_set_id, expression, element_block_ids='all', tolerance='auto', timesteps='last_if_any', zero_member_warning=True): """ Create a side set from faces which satisfy an expression. Only external element faces of the given element blocks are checked. For example, if the model had a symmetry plane at 'Y = 0', the expression 'Y == 0' would select all element faces on this plane. Example: >>> model.create_side_set_from_expression(1, 'Y == 0') """ timesteps = self._format_id_list(timesteps, self.get_timesteps(), 'timestep') if len(timesteps) > 2: self._error( 'Too many timesteps specified.', 'We were expecting zero or one timesteps but instead ' 'found %d specified.' % len(timesteps)) if tolerance == 'auto': tolerance = self.get_length_scale() * 1e-6 if self.side_set_exists(side_set_id): self._exists_warning(side_set_id, 'side set') external_faces_by_block = self._order_element_faces_by_block( self._get_external_element_faces(element_block_ids)) members = [] # create list of variable names and modify them in the expression variable_names = set(['X', 'Y', 'Z']) if timesteps: timestep_index = self._get_internal_timestep_index(timesteps[0]) variable_names.update(['time']) variable_names.update(self.get_global_variable_names()) variable_names.update(self.get_node_field_names()) expression = self._transform_expression(expression) eval_expression = self._transform_eval_expression( expression, variable_names) var = dict() function = eval('lambda var: ' + eval_expression) if timesteps: var['time'] = timesteps[0] for name, values in list(self.global_variables.items()): var[name] = values[timestep_index] try: for id_, external_faces in list(external_faces_by_block.items()): connectivity = self.get_connectivity(id_) face_mapping = self._get_face_mapping( self._get_element_type(id_)) nodes_per_element = self.get_nodes_per_element(id_) for element_index, face_index in external_faces: node_indices = [ connectivity[element_index * nodes_per_element + x] for x in face_mapping[face_index][1] ] all_passed = True for node_index in node_indices: # set coordinate values var['X'] = self.nodes[node_index][0] var['Y'] = self.nodes[node_index][1] var['Z'] = self.nodes[node_index][2] # set node field values if timesteps: for name, values in list(self.node_fields.items()): var[name] = values[timestep_index][node_index] value = float(function(var)) if not abs(value) <= tolerance: all_passed = False break if all_passed: members.append((id_, element_index, face_index)) except (SyntaxError, NameError): self._error_evaluating_expression("%s" % (eval_expression), var) # create the side set self.create_side_set(side_set_id, members) if zero_member_warning and not members: self._warning( 'Empty side set.', 'No external element faces satisfied the given ' 'expression. An empty side set was created.')
[ "def", "create_side_set_from_expression", "(", "self", ",", "side_set_id", ",", "expression", ",", "element_block_ids", "=", "'all'", ",", "tolerance", "=", "'auto'", ",", "timesteps", "=", "'last_if_any'", ",", "zero_member_warning", "=", "True", ")", ":", "timesteps", "=", "self", ".", "_format_id_list", "(", "timesteps", ",", "self", ".", "get_timesteps", "(", ")", ",", "'timestep'", ")", "if", "len", "(", "timesteps", ")", ">", "2", ":", "self", ".", "_error", "(", "'Too many timesteps specified.'", ",", "'We were expecting zero or one timesteps but instead '", "'found %d specified.'", "%", "len", "(", "timesteps", ")", ")", "if", "tolerance", "==", "'auto'", ":", "tolerance", "=", "self", ".", "get_length_scale", "(", ")", "*", "1e-6", "if", "self", ".", "side_set_exists", "(", "side_set_id", ")", ":", "self", ".", "_exists_warning", "(", "side_set_id", ",", "'side set'", ")", "external_faces_by_block", "=", "self", ".", "_order_element_faces_by_block", "(", "self", ".", "_get_external_element_faces", "(", "element_block_ids", ")", ")", "members", "=", "[", "]", "# create list of variable names and modify them in the expression", "variable_names", "=", "set", "(", "[", "'X'", ",", "'Y'", ",", "'Z'", "]", ")", "if", "timesteps", ":", "timestep_index", "=", "self", ".", "_get_internal_timestep_index", "(", "timesteps", "[", "0", "]", ")", "variable_names", ".", "update", "(", "[", "'time'", "]", ")", "variable_names", ".", "update", "(", "self", ".", "get_global_variable_names", "(", ")", ")", "variable_names", ".", "update", "(", "self", ".", "get_node_field_names", "(", ")", ")", "expression", "=", "self", ".", "_transform_expression", "(", "expression", ")", "eval_expression", "=", "self", ".", "_transform_eval_expression", "(", "expression", ",", "variable_names", ")", "var", "=", "dict", "(", ")", "function", "=", "eval", "(", "'lambda var: '", "+", "eval_expression", ")", "if", "timesteps", ":", "var", "[", "'time'", "]", "=", "timesteps", "[", "0", "]", "for", "name", ",", "values", "in", "list", "(", "self", ".", "global_variables", ".", "items", "(", ")", ")", ":", "var", "[", "name", "]", "=", "values", "[", "timestep_index", "]", "try", ":", "for", "id_", ",", "external_faces", "in", "list", "(", "external_faces_by_block", ".", "items", "(", ")", ")", ":", "connectivity", "=", "self", ".", "get_connectivity", "(", "id_", ")", "face_mapping", "=", "self", ".", "_get_face_mapping", "(", "self", ".", "_get_element_type", "(", "id_", ")", ")", "nodes_per_element", "=", "self", ".", "get_nodes_per_element", "(", "id_", ")", "for", "element_index", ",", "face_index", "in", "external_faces", ":", "node_indices", "=", "[", "connectivity", "[", "element_index", "*", "nodes_per_element", "+", "x", "]", "for", "x", "in", "face_mapping", "[", "face_index", "]", "[", "1", "]", "]", "all_passed", "=", "True", "for", "node_index", "in", "node_indices", ":", "# set coordinate values", "var", "[", "'X'", "]", "=", "self", ".", "nodes", "[", "node_index", "]", "[", "0", "]", "var", "[", "'Y'", "]", "=", "self", ".", "nodes", "[", "node_index", "]", "[", "1", "]", "var", "[", "'Z'", "]", "=", "self", ".", "nodes", "[", "node_index", "]", "[", "2", "]", "# set node field values", "if", "timesteps", ":", "for", "name", ",", "values", "in", "list", "(", "self", ".", "node_fields", ".", "items", "(", ")", ")", ":", "var", "[", "name", "]", "=", "values", "[", "timestep_index", "]", "[", "node_index", "]", "value", "=", "float", "(", "function", "(", "var", ")", ")", "if", "not", "abs", "(", "value", ")", "<=", "tolerance", ":", "all_passed", "=", "False", "break", "if", "all_passed", ":", "members", ".", "append", "(", "(", "id_", ",", "element_index", ",", "face_index", ")", ")", "except", "(", "SyntaxError", ",", "NameError", ")", ":", "self", ".", "_error_evaluating_expression", "(", "\"%s\"", "%", "(", "eval_expression", ")", ",", "var", ")", "# create the side set", "self", ".", "create_side_set", "(", "side_set_id", ",", "members", ")", "if", "zero_member_warning", "and", "not", "members", ":", "self", ".", "_warning", "(", "'Empty side set.'", ",", "'No external element faces satisfied the given '", "'expression. An empty side set was created.'", ")" ]
https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge3.py#L4357-L4441
NVIDIAGameWorks/kaolin
e5148d05e9c1e2ce92a07881ce3593b1c5c3f166
kaolin/io/usd.py
python
create_stage
(file_path, up_axis='Y')
return stage
r"""Create a new USD file and return an empty stage. Args: file_path (str): Path to usd file (\*.usd, \*.usda). up_axis (['Y', 'Z']): Specify the stage up axis. Choose from ``['Y', 'Z']``. Returns: (Usd.Stage) Example: >>> stage = create_stage('./new_stage.usd', up_axis='Z') >>> type(stage) <class 'pxr.Usd.Stage'>
r"""Create a new USD file and return an empty stage.
[ "r", "Create", "a", "new", "USD", "file", "and", "return", "an", "empty", "stage", "." ]
def create_stage(file_path, up_axis='Y'): r"""Create a new USD file and return an empty stage. Args: file_path (str): Path to usd file (\*.usd, \*.usda). up_axis (['Y', 'Z']): Specify the stage up axis. Choose from ``['Y', 'Z']``. Returns: (Usd.Stage) Example: >>> stage = create_stage('./new_stage.usd', up_axis='Z') >>> type(stage) <class 'pxr.Usd.Stage'> """ assert os.path.exists(os.path.dirname(file_path)), f'Directory {os.path.dirname(file_path)} not found.' stage = Usd.Stage.CreateNew(str(file_path)) world = stage.DefinePrim('/World', 'Xform') stage.SetDefaultPrim(world) UsdGeom.SetStageUpAxis(stage, up_axis) return stage
[ "def", "create_stage", "(", "file_path", ",", "up_axis", "=", "'Y'", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "file_path", ")", ")", ",", "f'Directory {os.path.dirname(file_path)} not found.'", "stage", "=", "Usd", ".", "Stage", ".", "CreateNew", "(", "str", "(", "file_path", ")", ")", "world", "=", "stage", ".", "DefinePrim", "(", "'/World'", ",", "'Xform'", ")", "stage", ".", "SetDefaultPrim", "(", "world", ")", "UsdGeom", ".", "SetStageUpAxis", "(", "stage", ",", "up_axis", ")", "return", "stage" ]
https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/io/usd.py#L358-L378
D-X-Y/caffe-faster-rcnn
eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb
tools/extra/parse_log.py
python
save_csv_files
(logfile_path, output_dir, train_dict_list, test_dict_list, delimiter=',', verbose=False)
Save CSV files to output_dir If the input log file is, e.g., caffe.INFO, the names will be caffe.INFO.train and caffe.INFO.test
Save CSV files to output_dir
[ "Save", "CSV", "files", "to", "output_dir" ]
def save_csv_files(logfile_path, output_dir, train_dict_list, test_dict_list, delimiter=',', verbose=False): """Save CSV files to output_dir If the input log file is, e.g., caffe.INFO, the names will be caffe.INFO.train and caffe.INFO.test """ log_basename = os.path.basename(logfile_path) train_filename = os.path.join(output_dir, log_basename + '.train') write_csv(train_filename, train_dict_list, delimiter, verbose) test_filename = os.path.join(output_dir, log_basename + '.test') write_csv(test_filename, test_dict_list, delimiter, verbose)
[ "def", "save_csv_files", "(", "logfile_path", ",", "output_dir", ",", "train_dict_list", ",", "test_dict_list", ",", "delimiter", "=", "','", ",", "verbose", "=", "False", ")", ":", "log_basename", "=", "os", ".", "path", ".", "basename", "(", "logfile_path", ")", "train_filename", "=", "os", ".", "path", ".", "join", "(", "output_dir", ",", "log_basename", "+", "'.train'", ")", "write_csv", "(", "train_filename", ",", "train_dict_list", ",", "delimiter", ",", "verbose", ")", "test_filename", "=", "os", ".", "path", ".", "join", "(", "output_dir", ",", "log_basename", "+", "'.test'", ")", "write_csv", "(", "test_filename", ",", "test_dict_list", ",", "delimiter", ",", "verbose", ")" ]
https://github.com/D-X-Y/caffe-faster-rcnn/blob/eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb/tools/extra/parse_log.py#L141-L154
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/scipy/sparse/linalg.py
python
arnoldi_iteration
(k, A, M, V, H)
return V, H, breakdown
Performs a single (the k'th) step of the Arnoldi process.
Performs a single (the k'th) step of the Arnoldi process.
[ "Performs", "a", "single", "(", "the", "k", "th", ")", "step", "of", "the", "Arnoldi", "process", "." ]
def arnoldi_iteration(k, A, M, V, H): """ Performs a single (the k'th) step of the Arnoldi process.""" v_ = V[..., k] v = M(A(v_)) v, h = gram_schmidt(V, v) _, v_norm_0 = _safe_normalize(v) tol = _eps(v) * v_norm_0 unit_v, v_norm_1 = _safe_normalize(v, tol) V[..., k + 1] = unit_v h[k + 1] = v_norm_1 H[k, :] = h breakdown = v_norm_1 == 0 return V, H, breakdown
[ "def", "arnoldi_iteration", "(", "k", ",", "A", ",", "M", ",", "V", ",", "H", ")", ":", "v_", "=", "V", "[", "...", ",", "k", "]", "v", "=", "M", "(", "A", "(", "v_", ")", ")", "v", ",", "h", "=", "gram_schmidt", "(", "V", ",", "v", ")", "_", ",", "v_norm_0", "=", "_safe_normalize", "(", "v", ")", "tol", "=", "_eps", "(", "v", ")", "*", "v_norm_0", "unit_v", ",", "v_norm_1", "=", "_safe_normalize", "(", "v", ",", "tol", ")", "V", "[", "...", ",", "k", "+", "1", "]", "=", "unit_v", "h", "[", "k", "+", "1", "]", "=", "v_norm_1", "H", "[", "k", ",", ":", "]", "=", "h", "breakdown", "=", "v_norm_1", "==", "0", "return", "V", ",", "H", ",", "breakdown" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/scipy/sparse/linalg.py#L35-L47
naver/sling
5671cd445a2caae0b4dd0332299e4cfede05062c
webkit/Tools/Scripts/webkitpy/thirdparty/irc/ircbot.py
python
SingleServerIRCBot._on_join
(self, c, e)
[Internal]
[Internal]
[ "[", "Internal", "]" ]
def _on_join(self, c, e): """[Internal]""" ch = e.target() nick = nm_to_n(e.source()) if nick == c.get_nickname(): self.channels[ch] = Channel() self.channels[ch].add_user(nick)
[ "def", "_on_join", "(", "self", ",", "c", ",", "e", ")", ":", "ch", "=", "e", ".", "target", "(", ")", "nick", "=", "nm_to_n", "(", "e", ".", "source", "(", ")", ")", "if", "nick", "==", "c", ".", "get_nickname", "(", ")", ":", "self", ".", "channels", "[", "ch", "]", "=", "Channel", "(", ")", "self", ".", "channels", "[", "ch", "]", ".", "add_user", "(", "nick", ")" ]
https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/irc/ircbot.py#L106-L112
chromiumembedded/cef
80caf947f3fe2210e5344713c5281d8af9bdc295
tools/cef_version.py
python
VersionFormatter.get_cef_version_components
(self)
return self._cef_version
Returns CEF version components.
Returns CEF version components.
[ "Returns", "CEF", "version", "components", "." ]
def get_cef_version_components(self): """ Returns CEF version components. """ if not bool(self._cef_version): file_path = os.path.join(self.cef_path, 'VERSION.in') assert os.path.isfile(file_path), file_path read_version_file(file_path, self._cef_version) return self._cef_version
[ "def", "get_cef_version_components", "(", "self", ")", ":", "if", "not", "bool", "(", "self", ".", "_cef_version", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "cef_path", ",", "'VERSION.in'", ")", "assert", "os", ".", "path", ".", "isfile", "(", "file_path", ")", ",", "file_path", "read_version_file", "(", "file_path", ",", "self", ".", "_cef_version", ")", "return", "self", ".", "_cef_version" ]
https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cef_version.py#L52-L58
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pyio.py
python
FileIO.readable
(self)
return self._readable
True if file was opened in a read mode.
True if file was opened in a read mode.
[ "True", "if", "file", "was", "opened", "in", "a", "read", "mode", "." ]
def readable(self): """True if file was opened in a read mode.""" self._checkClosed() return self._readable
[ "def", "readable", "(", "self", ")", ":", "self", ".", "_checkClosed", "(", ")", "return", "self", ".", "_readable" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pyio.py#L1723-L1726
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_gdi.py
python
IconBundle.__init__
(self, *args, **kwargs)
__init__(self) -> IconBundle
__init__(self) -> IconBundle
[ "__init__", "(", "self", ")", "-", ">", "IconBundle" ]
def __init__(self, *args, **kwargs): """__init__(self) -> IconBundle""" _gdi_.IconBundle_swiginit(self,_gdi_.new_IconBundle(*args, **kwargs))
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_gdi_", ".", "IconBundle_swiginit", "(", "self", ",", "_gdi_", ".", "new_IconBundle", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1383-L1385
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/inplace_ops.py
python
alias_inplace_sub
(x, i, v)
return _inplace_helper(x, i, v, gen_array_ops.inplace_sub)
Applies an inplace sub on input x at index i with value v. Aliases x. If i is None, x and v must be the same shape. Computes x -= v; If i is a scalar, x has a rank 1 higher than v's. Computes x[i, :] -= v; Otherwise, x and v must have the same rank. Computes x[i, :] -= v; Args: x: A Tensor. i: None, a scalar or a vector. v: A Tensor. Returns: Returns x.
Applies an inplace sub on input x at index i with value v. Aliases x.
[ "Applies", "an", "inplace", "sub", "on", "input", "x", "at", "index", "i", "with", "value", "v", ".", "Aliases", "x", "." ]
def alias_inplace_sub(x, i, v): """Applies an inplace sub on input x at index i with value v. Aliases x. If i is None, x and v must be the same shape. Computes x -= v; If i is a scalar, x has a rank 1 higher than v's. Computes x[i, :] -= v; Otherwise, x and v must have the same rank. Computes x[i, :] -= v; Args: x: A Tensor. i: None, a scalar or a vector. v: A Tensor. Returns: Returns x. """ return _inplace_helper(x, i, v, gen_array_ops.inplace_sub)
[ "def", "alias_inplace_sub", "(", "x", ",", "i", ",", "v", ")", ":", "return", "_inplace_helper", "(", "x", ",", "i", ",", "v", ",", "gen_array_ops", ".", "inplace_sub", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/inplace_ops.py#L119-L138
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
tools/isolate/trace_inputs.py
python
get_native_path_case
(root, relative_path)
Returns the native path case.
Returns the native path case.
[ "Returns", "the", "native", "path", "case", "." ]
def get_native_path_case(root, relative_path): """Returns the native path case.""" if sys.platform == 'win32': # Windows used to have an option to turn on case sensitivity on non Win32 # subsystem but that's out of scope here and isn't supported anymore. # First process root. if root: root = GetLongPathName(GetShortPathName(root)) + os.path.sep path = os.path.join(root, relative_path) if root else relative_path # Go figure why GetShortPathName() is needed. return GetLongPathName(GetShortPathName(path))[len(root):] elif sys.platform == 'darwin': # Technically, it's only HFS+ on OSX that is case insensitive. It's # the default setting on HFS+ but can be changed. root_ref, _ = Carbon.File.FSPathMakeRef(root) rel_ref, _ = Carbon.File.FSPathMakeRef(os.path.join(root, relative_path)) return rel_ref.FSRefMakePath()[len(root_ref.FSRefMakePath())+1:] else: # Give up on cygwin, as GetLongPathName() can't be called. return relative_path
[ "def", "get_native_path_case", "(", "root", ",", "relative_path", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "# Windows used to have an option to turn on case sensitivity on non Win32", "# subsystem but that's out of scope here and isn't supported anymore.", "# First process root.", "if", "root", ":", "root", "=", "GetLongPathName", "(", "GetShortPathName", "(", "root", ")", ")", "+", "os", ".", "path", ".", "sep", "path", "=", "os", ".", "path", ".", "join", "(", "root", ",", "relative_path", ")", "if", "root", "else", "relative_path", "# Go figure why GetShortPathName() is needed.", "return", "GetLongPathName", "(", "GetShortPathName", "(", "path", ")", ")", "[", "len", "(", "root", ")", ":", "]", "elif", "sys", ".", "platform", "==", "'darwin'", ":", "# Technically, it's only HFS+ on OSX that is case insensitive. It's", "# the default setting on HFS+ but can be changed.", "root_ref", ",", "_", "=", "Carbon", ".", "File", ".", "FSPathMakeRef", "(", "root", ")", "rel_ref", ",", "_", "=", "Carbon", ".", "File", ".", "FSPathMakeRef", "(", "os", ".", "path", ".", "join", "(", "root", ",", "relative_path", ")", ")", "return", "rel_ref", ".", "FSRefMakePath", "(", ")", "[", "len", "(", "root_ref", ".", "FSRefMakePath", "(", ")", ")", "+", "1", ":", "]", "else", ":", "# Give up on cygwin, as GetLongPathName() can't be called.", "return", "relative_path" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/isolate/trace_inputs.py#L147-L166
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/buildscripts/idl/idl/syntax.py
python
Field.__init__
(self, file_name, line, column)
Construct a Field.
Construct a Field.
[ "Construct", "a", "Field", "." ]
def __init__(self, file_name, line, column): # type: (unicode, int, int) -> None """Construct a Field.""" self.name = None # type: unicode self.cpp_name = None # type: unicode self.description = None # type: unicode self.type = None # type: unicode self.ignore = False # type: bool self.optional = False # type: bool self.default = None # type: unicode self.supports_doc_sequence = False # type: bool # Internal fields - not generated by parser self.serialize_op_msg_request_only = False # type: bool self.constructed = False # type: bool super(Field, self).__init__(file_name, line, column)
[ "def", "__init__", "(", "self", ",", "file_name", ",", "line", ",", "column", ")", ":", "# type: (unicode, int, int) -> None", "self", ".", "name", "=", "None", "# type: unicode", "self", ".", "cpp_name", "=", "None", "# type: unicode", "self", ".", "description", "=", "None", "# type: unicode", "self", ".", "type", "=", "None", "# type: unicode", "self", ".", "ignore", "=", "False", "# type: bool", "self", ".", "optional", "=", "False", "# type: bool", "self", ".", "default", "=", "None", "# type: unicode", "self", ".", "supports_doc_sequence", "=", "False", "# type: bool", "# Internal fields - not generated by parser", "self", ".", "serialize_op_msg_request_only", "=", "False", "# type: bool", "self", ".", "constructed", "=", "False", "# type: bool", "super", "(", "Field", ",", "self", ")", ".", "__init__", "(", "file_name", ",", "line", ",", "column", ")" ]
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/syntax.py#L277-L293
ideawu/ssdb-rocks
a3cbb322cafb2f493252829c608e2239df98c9ac
deps/cpy/antlr3/tree.py
python
TreeNodeStream.setUniqueNavigationNodes
(self, uniqueNavigationNodes)
As we flatten the tree, we use UP, DOWN nodes to represent the tree structure. When debugging we need unique nodes so we have to instantiate new ones. When doing normal tree parsing, it's slow and a waste of memory to create unique navigation nodes. Default should be false;
As we flatten the tree, we use UP, DOWN nodes to represent the tree structure. When debugging we need unique nodes so we have to instantiate new ones. When doing normal tree parsing, it's slow and a waste of memory to create unique navigation nodes. Default should be false;
[ "As", "we", "flatten", "the", "tree", "we", "use", "UP", "DOWN", "nodes", "to", "represent", "the", "tree", "structure", ".", "When", "debugging", "we", "need", "unique", "nodes", "so", "we", "have", "to", "instantiate", "new", "ones", ".", "When", "doing", "normal", "tree", "parsing", "it", "s", "slow", "and", "a", "waste", "of", "memory", "to", "create", "unique", "navigation", "nodes", ".", "Default", "should", "be", "false", ";" ]
def setUniqueNavigationNodes(self, uniqueNavigationNodes): """ As we flatten the tree, we use UP, DOWN nodes to represent the tree structure. When debugging we need unique nodes so we have to instantiate new ones. When doing normal tree parsing, it's slow and a waste of memory to create unique navigation nodes. Default should be false; """ raise NotImplementedError
[ "def", "setUniqueNavigationNodes", "(", "self", ",", "uniqueNavigationNodes", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/cpy/antlr3/tree.py#L1613-L1622
bayandin/chromedriver
d40a2092b50f2fca817221eeb5ea093e0e642c10
log_replay/client_replay.py
python
_Payload.SubstituteIds
(self, id_map, binary, base_url="", init_session=False)
Replace old IDs in the given payload with ones for the current session. Args: id_map: mapping from logged IDs to current-session ones binary: binary to add into this command, if |init_session| is True base_url: base url to replace in the payload for navigation commands init_session: whether this payload belongs to an InitSession command.
Replace old IDs in the given payload with ones for the current session.
[ "Replace", "old", "IDs", "in", "the", "given", "payload", "with", "ones", "for", "the", "current", "session", "." ]
def SubstituteIds(self, id_map, binary, base_url="", init_session=False): """Replace old IDs in the given payload with ones for the current session. Args: id_map: mapping from logged IDs to current-session ones binary: binary to add into this command, if |init_session| is True base_url: base url to replace in the payload for navigation commands init_session: whether this payload belongs to an InitSession command. """ if self.is_error or self.is_empty: return _ReplaceWindowAndElementIds(self.payload_raw, id_map) _ReplaceSessionId(self.payload_raw, id_map) if init_session: _ReplaceBinary(self.payload_raw, binary) _ReplaceUrl(self.payload_raw, base_url)
[ "def", "SubstituteIds", "(", "self", ",", "id_map", ",", "binary", ",", "base_url", "=", "\"\"", ",", "init_session", "=", "False", ")", ":", "if", "self", ".", "is_error", "or", "self", ".", "is_empty", ":", "return", "_ReplaceWindowAndElementIds", "(", "self", ".", "payload_raw", ",", "id_map", ")", "_ReplaceSessionId", "(", "self", ".", "payload_raw", ",", "id_map", ")", "if", "init_session", ":", "_ReplaceBinary", "(", "self", ".", "payload_raw", ",", "binary", ")", "_ReplaceUrl", "(", "self", ".", "payload_raw", ",", "base_url", ")" ]
https://github.com/bayandin/chromedriver/blob/d40a2092b50f2fca817221eeb5ea093e0e642c10/log_replay/client_replay.py#L426-L444
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2class.py
python
catalogSetDebug
(level)
return ret
Used to set the debug level for catalog operation, 0 disable debugging, 1 enable it
Used to set the debug level for catalog operation, 0 disable debugging, 1 enable it
[ "Used", "to", "set", "the", "debug", "level", "for", "catalog", "operation", "0", "disable", "debugging", "1", "enable", "it" ]
def catalogSetDebug(level): """Used to set the debug level for catalog operation, 0 disable debugging, 1 enable it """ ret = libxml2mod.xmlCatalogSetDebug(level) return ret
[ "def", "catalogSetDebug", "(", "level", ")", ":", "ret", "=", "libxml2mod", ".", "xmlCatalogSetDebug", "(", "level", ")", "return", "ret" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L177-L181
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
src/python/m5/util/fdthelper.py
python
FdtState.addrCells
(self, addr)
return self.int_to_cells(addr, self.addr_cells)
Format an integer type according to the address_cells value of this state.
Format an integer type according to the address_cells value of this state.
[ "Format", "an", "integer", "type", "according", "to", "the", "address_cells", "value", "of", "this", "state", "." ]
def addrCells(self, addr): """Format an integer type according to the address_cells value of this state.""" return self.int_to_cells(addr, self.addr_cells)
[ "def", "addrCells", "(", "self", ",", "addr", ")", ":", "return", "self", ".", "int_to_cells", "(", "addr", ",", "self", ".", "addr_cells", ")" ]
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/util/fdthelper.py#L128-L131
rdkit/rdkit
ede860ae316d12d8568daf5ee800921c3389c84e
External/INCHI-API/python/inchi.py
python
MolToInchiKey
(mol, options="")
return rdinchi.MolToInchiKey(mol,options)
Returns the standard InChI key for a molecule Returns: the standard InChI key returned by InChI API for the input molecule
Returns the standard InChI key for a molecule
[ "Returns", "the", "standard", "InChI", "key", "for", "a", "molecule" ]
def MolToInchiKey(mol, options=""): """Returns the standard InChI key for a molecule Returns: the standard InChI key returned by InChI API for the input molecule """ return rdinchi.MolToInchiKey(mol,options)
[ "def", "MolToInchiKey", "(", "mol", ",", "options", "=", "\"\"", ")", ":", "return", "rdinchi", ".", "MolToInchiKey", "(", "mol", ",", "options", ")" ]
https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/External/INCHI-API/python/inchi.py#L221-L227
microsoft/CNTK
e9396480025b9ca457d26b6f33dd07c474c6aa04
bindings/python/cntk/ops/__init__.py
python
tan
(x, name='')
return tan(x, name)
Computes the element-wise tangent of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.tan([-1, 0, 1]).eval(), 5) array([-1.55741, 0. , 1.55741], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function`
Computes the element-wise tangent of ``x``:
[ "Computes", "the", "element", "-", "wise", "tangent", "of", "x", ":" ]
def tan(x, name=''): ''' Computes the element-wise tangent of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.tan([-1, 0, 1]).eval(), 5) array([-1.55741, 0. , 1.55741], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import tan x = sanitize_input(x) return tan(x, name)
[ "def", "tan", "(", "x", ",", "name", "=", "''", ")", ":", "from", "cntk", ".", "cntk_py", "import", "tan", "x", "=", "sanitize_input", "(", "x", ")", "return", "tan", "(", "x", ",", "name", ")" ]
https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/ops/__init__.py#L1727-L1745
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/numbers.py
python
Real.imag
(self)
return 0
Real numbers have no imaginary component.
Real numbers have no imaginary component.
[ "Real", "numbers", "have", "no", "imaginary", "component", "." ]
def imag(self): """Real numbers have no imaginary component.""" return 0
[ "def", "imag", "(", "self", ")", ":", "return", "0" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/numbers.py#L259-L261
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/traci/main.py
python
close
(wait=True)
Tells TraCI to close the connection.
Tells TraCI to close the connection.
[ "Tells", "TraCI", "to", "close", "the", "connection", "." ]
def close(wait=True): """ Tells TraCI to close the connection. """ if "" not in _connections: raise FatalTraCIError("Not connected.") _connections[""].close(wait) _connections[""].simulation._setConnection(None) del _connections[_currentLabel[0]] del _connections[""] if _currentLabel[0] in _traceFile: del _traceFile[_currentLabel[0]]
[ "def", "close", "(", "wait", "=", "True", ")", ":", "if", "\"\"", "not", "in", "_connections", ":", "raise", "FatalTraCIError", "(", "\"Not connected.\"", ")", "_connections", "[", "\"\"", "]", ".", "close", "(", "wait", ")", "_connections", "[", "\"\"", "]", ".", "simulation", ".", "_setConnection", "(", "None", ")", "del", "_connections", "[", "_currentLabel", "[", "0", "]", "]", "del", "_connections", "[", "\"\"", "]", "if", "_currentLabel", "[", "0", "]", "in", "_traceFile", ":", "del", "_traceFile", "[", "_currentLabel", "[", "0", "]", "]" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/main.py#L278-L289
ucbrise/confluo
578883a4f7fbbb4aea78c342d366f5122ef598f7
pyclient/confluo/rpc/schema.py
python
make_schema
(s)
return Schema(sb.build())
Converts a JSON-like string representation of the schema to our internal representation of the schema. Args: s: A JSON-like schema string Returns: Our internal representation of the schema.
Converts a JSON-like string representation of the schema to our internal representation of the schema.
[ "Converts", "a", "JSON", "-", "like", "string", "representation", "of", "the", "schema", "to", "our", "internal", "representation", "of", "the", "schema", "." ]
def make_schema(s): """Converts a JSON-like string representation of the schema to our internal representation of the schema. Args: s: A JSON-like schema string Returns: Our internal representation of the schema. """ def ordered_load(stream): class OrderedLoader(yaml.Loader): pass def construct_mapping(loader, node): loader.flatten_mapping(node) return OrderedDict(loader.construct_pairs(node)) OrderedLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, construct_mapping) return yaml.load(stream, OrderedLoader) s_parsed = ordered_load(s) sb = SchemaBuilder() for k in s_parsed: sb.add_column(data_types.make_type(s_parsed[k]), k) return Schema(sb.build())
[ "def", "make_schema", "(", "s", ")", ":", "def", "ordered_load", "(", "stream", ")", ":", "class", "OrderedLoader", "(", "yaml", ".", "Loader", ")", ":", "pass", "def", "construct_mapping", "(", "loader", ",", "node", ")", ":", "loader", ".", "flatten_mapping", "(", "node", ")", "return", "OrderedDict", "(", "loader", ".", "construct_pairs", "(", "node", ")", ")", "OrderedLoader", ".", "add_constructor", "(", "yaml", ".", "resolver", ".", "BaseResolver", ".", "DEFAULT_MAPPING_TAG", ",", "construct_mapping", ")", "return", "yaml", ".", "load", "(", "stream", ",", "OrderedLoader", ")", "s_parsed", "=", "ordered_load", "(", "s", ")", "sb", "=", "SchemaBuilder", "(", ")", "for", "k", "in", "s_parsed", ":", "sb", ".", "add_column", "(", "data_types", ".", "make_type", "(", "s_parsed", "[", "k", "]", ")", ",", "k", ")", "return", "Schema", "(", "sb", ".", "build", "(", ")", ")" ]
https://github.com/ucbrise/confluo/blob/578883a4f7fbbb4aea78c342d366f5122ef598f7/pyclient/confluo/rpc/schema.py#L236-L259
pirobot/rbx2
2a6544799fcf062e7b6bd5cf2981b2a84c0c7d2a
rbx2_utils/src/rbx2_utils/srv/_LaunchProcess.py
python
LaunchProcessResponse._get_types
(self)
return self._slot_types
internal API method
internal API method
[ "internal", "API", "method" ]
def _get_types(self): """ internal API method """ return self._slot_types
[ "def", "_get_types", "(", "self", ")", ":", "return", "self", ".", "_slot_types" ]
https://github.com/pirobot/rbx2/blob/2a6544799fcf062e7b6bd5cf2981b2a84c0c7d2a/rbx2_utils/src/rbx2_utils/srv/_LaunchProcess.py#L160-L164
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py2/setuptools/dist.py
python
Distribution.get_cmdline_options
(self)
return d
Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. Note that options provided by config files are intentionally excluded.
Return a '{cmd: {opt:val}}' map of all command-line options
[ "Return", "a", "{", "cmd", ":", "{", "opt", ":", "val", "}}", "map", "of", "all", "command", "-", "line", "options" ]
def get_cmdline_options(self): """Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. Note that options provided by config files are intentionally excluded. """ d = {} for cmd, opts in self.command_options.items(): for opt, (src, val) in opts.items(): if src != "command line": continue opt = opt.replace('_', '-') if val == 0: cmdobj = self.get_command_obj(cmd) neg_opt = self.negative_opt.copy() neg_opt.update(getattr(cmdobj, 'negative_opt', {})) for neg, pos in neg_opt.items(): if pos == opt: opt = neg val = None break else: raise AssertionError("Shouldn't be able to get here") elif val == 1: val = None d.setdefault(cmd, {})[opt] = val return d
[ "def", "get_cmdline_options", "(", "self", ")", ":", "d", "=", "{", "}", "for", "cmd", ",", "opts", "in", "self", ".", "command_options", ".", "items", "(", ")", ":", "for", "opt", ",", "(", "src", ",", "val", ")", "in", "opts", ".", "items", "(", ")", ":", "if", "src", "!=", "\"command line\"", ":", "continue", "opt", "=", "opt", ".", "replace", "(", "'_'", ",", "'-'", ")", "if", "val", "==", "0", ":", "cmdobj", "=", "self", ".", "get_command_obj", "(", "cmd", ")", "neg_opt", "=", "self", ".", "negative_opt", ".", "copy", "(", ")", "neg_opt", ".", "update", "(", "getattr", "(", "cmdobj", ",", "'negative_opt'", ",", "{", "}", ")", ")", "for", "neg", ",", "pos", "in", "neg_opt", ".", "items", "(", ")", ":", "if", "pos", "==", "opt", ":", "opt", "=", "neg", "val", "=", "None", "break", "else", ":", "raise", "AssertionError", "(", "\"Shouldn't be able to get here\"", ")", "elif", "val", "==", "1", ":", "val", "=", "None", "d", ".", "setdefault", "(", "cmd", ",", "{", "}", ")", "[", "opt", "]", "=", "val", "return", "d" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/dist.py#L1025-L1063
mingchen/protobuf-ios
0958df34558cd54cb7b6e6ca5c8855bf3d475046
compiler/python/google/protobuf/text_format.py
python
_Tokenizer.ConsumeInt64
(self)
return result
Consumes a signed 64bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 64bit integer couldn't be consumed.
Consumes a signed 64bit integer number.
[ "Consumes", "a", "signed", "64bit", "integer", "number", "." ]
def ConsumeInt64(self): """Consumes a signed 64bit integer number. Returns: The integer parsed. Raises: ParseError: If a signed 64bit integer couldn't be consumed. """ try: result = self._ParseInteger(self.token, is_signed=True, is_long=True) except ValueError, e: raise self._IntegerParseError(e) self.NextToken() return result
[ "def", "ConsumeInt64", "(", "self", ")", ":", "try", ":", "result", "=", "self", ".", "_ParseInteger", "(", "self", ".", "token", ",", "is_signed", "=", "True", ",", "is_long", "=", "True", ")", "except", "ValueError", ",", "e", ":", "raise", "self", ".", "_IntegerParseError", "(", "e", ")", "self", ".", "NextToken", "(", ")", "return", "result" ]
https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/text_format.py#L431-L445
bigartm/bigartm
47e37f982de87aa67bfd475ff1f39da696b181b3
utils/cpplint.py
python
GetLineWidth
(line)
Determines the width of the line in column positions. Args: line: A string, which may be a Unicode string. Returns: The width of the line in column positions, accounting for Unicode combining characters and wide characters.
Determines the width of the line in column positions.
[ "Determines", "the", "width", "of", "the", "line", "in", "column", "positions", "." ]
def GetLineWidth(line): """Determines the width of the line in column positions. Args: line: A string, which may be a Unicode string. Returns: The width of the line in column positions, accounting for Unicode combining characters and wide characters. """ if isinstance(line, unicode): width = 0 for uc in unicodedata.normalize('NFC', line): if unicodedata.east_asian_width(uc) in ('W', 'F'): width += 2 elif not unicodedata.combining(uc): width += 1 return width else: return len(line)
[ "def", "GetLineWidth", "(", "line", ")", ":", "if", "isinstance", "(", "line", ",", "unicode", ")", ":", "width", "=", "0", "for", "uc", "in", "unicodedata", ".", "normalize", "(", "'NFC'", ",", "line", ")", ":", "if", "unicodedata", ".", "east_asian_width", "(", "uc", ")", "in", "(", "'W'", ",", "'F'", ")", ":", "width", "+=", "2", "elif", "not", "unicodedata", ".", "combining", "(", "uc", ")", ":", "width", "+=", "1", "return", "width", "else", ":", "return", "len", "(", "line", ")" ]
https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/utils/cpplint.py#L4355-L4374
jackaudio/jack2
21b293dbc37d42446141a08922cdec0d2550c6a0
waflib/Task.py
python
set_file_constraints
(tasks)
Updates the ``run_after`` attribute of all tasks based on the task inputs and outputs :param tasks: tasks :type tasks: list of :py:class:`waflib.Task.Task`
Updates the ``run_after`` attribute of all tasks based on the task inputs and outputs
[ "Updates", "the", "run_after", "attribute", "of", "all", "tasks", "based", "on", "the", "task", "inputs", "and", "outputs" ]
def set_file_constraints(tasks): """ Updates the ``run_after`` attribute of all tasks based on the task inputs and outputs :param tasks: tasks :type tasks: list of :py:class:`waflib.Task.Task` """ ins = Utils.defaultdict(set) outs = Utils.defaultdict(set) for x in tasks: for a in x.inputs: ins[a].add(x) for a in x.dep_nodes: ins[a].add(x) for a in x.outputs: outs[a].add(x) links = set(ins.keys()).intersection(outs.keys()) for k in links: for a in ins[k]: a.run_after.update(outs[k])
[ "def", "set_file_constraints", "(", "tasks", ")", ":", "ins", "=", "Utils", ".", "defaultdict", "(", "set", ")", "outs", "=", "Utils", ".", "defaultdict", "(", "set", ")", "for", "x", "in", "tasks", ":", "for", "a", "in", "x", ".", "inputs", ":", "ins", "[", "a", "]", ".", "add", "(", "x", ")", "for", "a", "in", "x", ".", "dep_nodes", ":", "ins", "[", "a", "]", ".", "add", "(", "x", ")", "for", "a", "in", "x", ".", "outputs", ":", "outs", "[", "a", "]", ".", "add", "(", "x", ")", "links", "=", "set", "(", "ins", ".", "keys", "(", ")", ")", ".", "intersection", "(", "outs", ".", "keys", "(", ")", ")", "for", "k", "in", "links", ":", "for", "a", "in", "ins", "[", "k", "]", ":", "a", ".", "run_after", ".", "update", "(", "outs", "[", "k", "]", ")" ]
https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Task.py#L949-L969
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py
python
xmlTextReader.NewMemory
(self, buffer, size, URL, encoding, options)
return ret
Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.
Setup an xmltextReader to parse an XML in-memory document. The parsing flags
[ "Setup", "an", "xmltextReader", "to", "parse", "an", "XML", "in", "-", "memory", "document", ".", "The", "parsing", "flags" ]
def NewMemory(self, buffer, size, URL, encoding, options): """Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader. """ ret = libxml2mod.xmlReaderNewMemory(self._o, buffer, size, URL, encoding, options) return ret
[ "def", "NewMemory", "(", "self", ",", "buffer", ",", "size", ",", "URL", ",", "encoding", ",", "options", ")", ":", "ret", "=", "libxml2mod", ".", "xmlReaderNewMemory", "(", "self", ".", "_o", ",", "buffer", ",", "size", ",", "URL", ",", "encoding", ",", "options", ")", "return", "ret" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L6759-L6765