nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/command/install_lib.py
python
install_lib._gen_exclusion_paths
()
Generate file paths to be excluded for namespace packages (bytecode cache files).
Generate file paths to be excluded for namespace packages (bytecode cache files).
[ "Generate", "file", "paths", "to", "be", "excluded", "for", "namespace", "packages", "(", "bytecode", "cache", "files", ")", "." ]
def _gen_exclusion_paths(): """ Generate file paths to be excluded for namespace packages (bytecode cache files). """ # always exclude the package module itself yield '__init__.py' yield '__init__.pyc' yield '__init__.pyo' if not hasattr(imp, 'ge...
[ "def", "_gen_exclusion_paths", "(", ")", ":", "# always exclude the package module itself", "yield", "'__init__.py'", "yield", "'__init__.pyc'", "yield", "'__init__.pyo'", "if", "not", "hasattr", "(", "imp", ",", "'get_tag'", ")", ":", "return", "base", "=", "os", "...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/command/install_lib.py#L66-L84
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/docutils-0.14/docutils/writers/html4css1/__init__.py
python
HTMLTranslator.visit_enumerated_list
(self, node)
The 'start' attribute does not conform to HTML 4.01's strict.dtd, but cannot be emulated in CSS1 (HTML 5 reincludes it).
The 'start' attribute does not conform to HTML 4.01's strict.dtd, but cannot be emulated in CSS1 (HTML 5 reincludes it).
[ "The", "start", "attribute", "does", "not", "conform", "to", "HTML", "4", ".", "01", "s", "strict", ".", "dtd", "but", "cannot", "be", "emulated", "in", "CSS1", "(", "HTML", "5", "reincludes", "it", ")", "." ]
def visit_enumerated_list(self, node): """ The 'start' attribute does not conform to HTML 4.01's strict.dtd, but cannot be emulated in CSS1 (HTML 5 reincludes it). """ atts = {} if 'start' in node: atts['start'] = node['start'] if 'enumtype' in node: ...
[ "def", "visit_enumerated_list", "(", "self", ",", "node", ")", ":", "atts", "=", "{", "}", "if", "'start'", "in", "node", ":", "atts", "[", "'start'", "]", "=", "node", "[", "'start'", "]", "if", "'enumtype'", "in", "node", ":", "atts", "[", "'class'...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/writers/html4css1/__init__.py#L369-L387
zhaoolee/StarsAndClown
b2d4039cad2f9232b691e5976f787b49a0a2c113
node_modules/npmi/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
python
_MSBuildOnly
(tool, name, setting_type)
Defines a setting that is only found in MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting.
Defines a setting that is only found in MSBuild.
[ "Defines", "a", "setting", "that", "is", "only", "found", "in", "MSBuild", "." ]
def _MSBuildOnly(tool, name, setting_type): """Defines a setting that is only found in MSBuild. Args: tool: a dictionary that gives the names of the tool for MSVS and MSBuild. name: the name of the setting. setting_type: the type of this setting. """ def _Translate(value, msbuild_settings): # ...
[ "def", "_MSBuildOnly", "(", "tool", ",", "name", ",", "setting_type", ")", ":", "def", "_Translate", "(", "value", ",", "msbuild_settings", ")", ":", "# Let msbuild-only properties get translated as-is from msvs_settings.", "tool_settings", "=", "msbuild_settings", ".", ...
https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npmi/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py#L309-L324
ChenglongChen/tensorflow-DSMM
52a499a162f3837aa11bb1bb4c1029accfe5743d
src/tf_common/nadam.py
python
NadamOptimizer._apply_dense
(self, grad, var)
return training_ops.apply_adam( var, m, v, math_ops.cast(self._beta1_power, var.dtype.base_dtype), math_ops.cast(self._beta2_power, var.dtype.base_dtype), math_ops.cast(self._lr_t, var.dtype.base_dtype), math_ops.cast(self._beta1_t, var...
[]
def _apply_dense(self, grad, var): m = self.get_slot(var, "m") v = self.get_slot(var, "v") return training_ops.apply_adam( var, m, v, math_ops.cast(self._beta1_power, var.dtype.base_dtype), math_ops.cast(self._beta2_power, var.dtype.bas...
[ "def", "_apply_dense", "(", "self", ",", "grad", ",", "var", ")", ":", "m", "=", "self", ".", "get_slot", "(", "var", ",", "\"m\"", ")", "v", "=", "self", ".", "get_slot", "(", "var", ",", "\"v\"", ")", "return", "training_ops", ".", "apply_adam", ...
https://github.com/ChenglongChen/tensorflow-DSMM/blob/52a499a162f3837aa11bb1bb4c1029accfe5743d/src/tf_common/nadam.py#L126-L141
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/future/backports/xmlrpc/server.py
python
SimpleXMLRPCRequestHandler.log_request
(self, code='-', size='-')
Selectively log an accepted request.
Selectively log an accepted request.
[ "Selectively", "log", "an", "accepted", "request", "." ]
def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" if self.server.logRequests: BaseHTTPRequestHandler.log_request(self, code, size)
[ "def", "log_request", "(", "self", ",", "code", "=", "'-'", ",", "size", "=", "'-'", ")", ":", "if", "self", ".", "server", ".", "logRequests", ":", "BaseHTTPRequestHandler", ".", "log_request", "(", "self", ",", "code", ",", "size", ")" ]
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/future/backports/xmlrpc/server.py#L560-L564
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/lib-tk/ttk.py
python
Notebook.index
(self, tab_id)
return self.tk.call(self._w, 'index', tab_id)
Returns the numeric index of the tab specified by tab_id, or the total number of tabs if tab_id is the string "end".
Returns the numeric index of the tab specified by tab_id, or the total number of tabs if tab_id is the string "end".
[ "Returns", "the", "numeric", "index", "of", "the", "tab", "specified", "by", "tab_id", "or", "the", "total", "number", "of", "tabs", "if", "tab_id", "is", "the", "string", "end", "." ]
def index(self, tab_id): """Returns the numeric index of the tab specified by tab_id, or the total number of tabs if tab_id is the string "end".""" return self.tk.call(self._w, 'index', tab_id)
[ "def", "index", "(", "self", ",", "tab_id", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'index'", ",", "tab_id", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/lib-tk/ttk.py#L782-L785
marcomusy/vedo
246bb78a406c4f97fe6f7d2a4d460909c830de87
vedo/utils.py
python
grep
(filename, tag, firstOccurrence=False)
return content
Greps the line that starts with a specific `tag` string inside the file.
Greps the line that starts with a specific `tag` string inside the file.
[ "Greps", "the", "line", "that", "starts", "with", "a", "specific", "tag", "string", "inside", "the", "file", "." ]
def grep(filename, tag, firstOccurrence=False): """Greps the line that starts with a specific `tag` string inside the file.""" import re try: afile = open(filename, "r") except FileNotFoundError: printc("Error in utils.grep(): cannot open file", filename, c='r') return [] c...
[ "def", "grep", "(", "filename", ",", "tag", ",", "firstOccurrence", "=", "False", ")", ":", "import", "re", "try", ":", "afile", "=", "open", "(", "filename", ",", "\"r\"", ")", "except", "FileNotFoundError", ":", "printc", "(", "\"Error in utils.grep(): can...
https://github.com/marcomusy/vedo/blob/246bb78a406c4f97fe6f7d2a4d460909c830de87/vedo/utils.py#L863-L882
tensorflow/graphics
86997957324bfbdd85848daae989b4c02588faa0
tensorflow_graphics/datasets/modelnet40/modelnet40.py
python
ModelNet40._generate_examples
(self, filename_list_path)
Yields examples.
Yields examples.
[ "Yields", "examples", "." ]
def _generate_examples(self, filename_list_path): """Yields examples.""" ancestor_path = os.path.dirname(os.path.dirname(filename_list_path)) with tf.io.gfile.GFile(filename_list_path, 'r') as fid: filename_list = fid.readlines() filename_list = [line.rstrip()[5:] for line in filename_list] ...
[ "def", "_generate_examples", "(", "self", ",", "filename_list_path", ")", ":", "ancestor_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "filename_list_path", ")", ")", "with", "tf", ".", "io", ".", "gfile", "....
https://github.com/tensorflow/graphics/blob/86997957324bfbdd85848daae989b4c02588faa0/tensorflow_graphics/datasets/modelnet40/modelnet40.py#L97-L119
ownthink/Jiagu
824519282456097bcc8af5460b17cebdf095ba17
train/perceptron.py
python
Perceptron._get_features
(self, i, word, context, prev, prev2)
return features
Map tokens into a feature representation, implemented as a {hashable: float} dict. If the features change, a new model must be trained.
Map tokens into a feature representation, implemented as a {hashable: float} dict. If the features change, a new model must be trained.
[ "Map", "tokens", "into", "a", "feature", "representation", "implemented", "as", "a", "{", "hashable", ":", "float", "}", "dict", ".", "If", "the", "features", "change", "a", "new", "model", "must", "be", "trained", "." ]
def _get_features(self, i, word, context, prev, prev2): '''Map tokens into a feature representation, implemented as a {hashable: float} dict. If the features change, a new model must be trained. ''' def add(name, *args): features[' '.join((name,) + tuple(args))] += 1 i += len(self.START) features = de...
[ "def", "_get_features", "(", "self", ",", "i", ",", "word", ",", "context", ",", "prev", ",", "prev2", ")", ":", "def", "add", "(", "name", ",", "*", "args", ")", ":", "features", "[", "' '", ".", "join", "(", "(", "name", ",", ")", "+", "tuple...
https://github.com/ownthink/Jiagu/blob/824519282456097bcc8af5460b17cebdf095ba17/train/perceptron.py#L127-L152
trakt/Plex-Trakt-Scrobbler
aeb0bfbe62fad4b06c164f1b95581da7f35dce0b
Trakttv.bundle/Contents/Libraries/Shared/arrow/arrow.py
python
Arrow.shift
(self, **kwargs)
return self.fromdatetime(current)
Returns a new :class:`Arrow <arrow.arrow.Arrow>` object with attributes updated according to inputs. Use plural property names to shift their current value relatively: >>> import arrow >>> arw = arrow.utcnow() >>> arw <Arrow [2013-05-11T22:27:34.787885+00:00]> >...
Returns a new :class:`Arrow <arrow.arrow.Arrow>` object with attributes updated according to inputs.
[ "Returns", "a", "new", ":", "class", ":", "Arrow", "<arrow", ".", "arrow", ".", "Arrow", ">", "object", "with", "attributes", "updated", "according", "to", "inputs", "." ]
def shift(self, **kwargs): ''' Returns a new :class:`Arrow <arrow.arrow.Arrow>` object with attributes updated according to inputs. Use plural property names to shift their current value relatively: >>> import arrow >>> arw = arrow.utcnow() >>> arw <Arrow [2013-...
[ "def", "shift", "(", "self", ",", "*", "*", "kwargs", ")", ":", "relative_kwargs", "=", "{", "}", "for", "key", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "if", "key", "in", "self", ".", "_ATTRS_PLURAL", "or", "key", "in", "[", "'...
https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/arrow/arrow.py#L439-L469
360netlab/DGA
f6e1a197556e9925903b1940d401b02b3650e573
code/enviserv/dga.py
python
dga
(seed, nr, tlds)
[]
def dga(seed, nr, tlds): for i in range(nr): seed_str = seed + str(i) #print seed_str s = hashlib.md5() s.update(seed_str.encode('latin1')) x = s.digest() domain = "" for j in range(5): domain += "%02x" %(x[j]) domain += '.' + tlds[i % 6...
[ "def", "dga", "(", "seed", ",", "nr", ",", "tlds", ")", ":", "for", "i", "in", "range", "(", "nr", ")", ":", "seed_str", "=", "seed", "+", "str", "(", "i", ")", "#print seed_str", "s", "=", "hashlib", ".", "md5", "(", ")", "s", ".", "update", ...
https://github.com/360netlab/DGA/blob/f6e1a197556e9925903b1940d401b02b3650e573/code/enviserv/dga.py#L9-L24
redis/redis-py
0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7
redis/commands/cluster.py
python
ClusterMultiKeyCommands.unlink
(self, *keys)
return self._split_command_across_slots("UNLINK", *keys)
Remove the specified keys in a different thread. The keys are first split up into slots and then an TOUCH command is sent for every slot Non-existant keys are ignored. Returns the number of keys that were unlinked.
Remove the specified keys in a different thread.
[ "Remove", "the", "specified", "keys", "in", "a", "different", "thread", "." ]
def unlink(self, *keys): """ Remove the specified keys in a different thread. The keys are first split up into slots and then an TOUCH command is sent for every slot Non-existant keys are ignored. Returns the number of keys that were unlinked. """ return...
[ "def", "unlink", "(", "self", ",", "*", "keys", ")", ":", "return", "self", ".", "_split_command_across_slots", "(", "\"UNLINK\"", ",", "*", "keys", ")" ]
https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/commands/cluster.py#L134-L144
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/html5lib/trie/_base.py
python
Trie.longest_prefix_item
(self, prefix)
return (lprefix, self[lprefix])
[]
def longest_prefix_item(self, prefix): lprefix = self.longest_prefix(prefix) return (lprefix, self[lprefix])
[ "def", "longest_prefix_item", "(", "self", ",", "prefix", ")", ":", "lprefix", "=", "self", ".", "longest_prefix", "(", "prefix", ")", "return", "(", "lprefix", ",", "self", "[", "lprefix", "]", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/html5lib/trie/_base.py#L35-L37
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/core/bcp/bcp_transport.py
python
BcpTransportManager.shutdown
(self, **kwargs)
Prepare the BCP clients for MPF shutdown.
Prepare the BCP clients for MPF shutdown.
[ "Prepare", "the", "BCP", "clients", "for", "MPF", "shutdown", "." ]
def shutdown(self, **kwargs): """Prepare the BCP clients for MPF shutdown.""" del kwargs for client in list(self._transports): client.stop() self.unregister_transport(client)
[ "def", "shutdown", "(", "self", ",", "*", "*", "kwargs", ")", ":", "del", "kwargs", "for", "client", "in", "list", "(", "self", ".", "_transports", ")", ":", "client", ".", "stop", "(", ")", "self", ".", "unregister_transport", "(", "client", ")" ]
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/core/bcp/bcp_transport.py#L113-L118
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/platform.py
python
linux_distribution
(distname='', version='', id='', supported_dists=_supported_dists, full_distribution_name=1)
return distname, version, id
Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. supported_dists may be given to define the set of Linux distributions to l...
Tries to determine the name of the Linux OS distribution name.
[ "Tries", "to", "determine", "the", "name", "of", "the", "Linux", "OS", "distribution", "name", "." ]
def linux_distribution(distname='', version='', id='', supported_dists=_supported_dists, full_distribution_name=1): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and...
[ "def", "linux_distribution", "(", "distname", "=", "''", ",", "version", "=", "''", ",", "id", "=", "''", ",", "supported_dists", "=", "_supported_dists", ",", "full_distribution_name", "=", "1", ")", ":", "try", ":", "etc", "=", "os", ".", "listdir", "(...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/platform.py#L291-L343
out0fmemory/GoAgent-Always-Available
c4254984fea633ce3d1893fe5901debd9f22c2a9
server/lib/webob/response.py
python
Response._text__get
(self)
return body.decode(self.charset, self.unicode_errors)
Get/set the text value of the body (using the charset of the Content-Type)
Get/set the text value of the body (using the charset of the Content-Type)
[ "Get", "/", "set", "the", "text", "value", "of", "the", "body", "(", "using", "the", "charset", "of", "the", "Content", "-", "Type", ")" ]
def _text__get(self): """ Get/set the text value of the body (using the charset of the Content-Type) """ if not self.charset: raise AttributeError( "You cannot access Response.text unless charset is set") body = self.body return body.de...
[ "def", "_text__get", "(", "self", ")", ":", "if", "not", "self", ".", "charset", ":", "raise", "AttributeError", "(", "\"You cannot access Response.text unless charset is set\"", ")", "body", "=", "self", ".", "body", "return", "body", ".", "decode", "(", "self"...
https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/webob/response.py#L403-L412
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/threading.py
python
_RLock._release_save
(self)
return (count, owner)
[]
def _release_save(self): if __debug__: self._note("%s._release_save()", self) count = self.__count self.__count = 0 owner = self.__owner self.__owner = None self.__block.release() return (count, owner)
[ "def", "_release_save", "(", "self", ")", ":", "if", "__debug__", ":", "self", ".", "_note", "(", "\"%s._release_save()\"", ",", "self", ")", "count", "=", "self", ".", "__count", "self", ".", "__count", "=", "0", "owner", "=", "self", ".", "__owner", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/threading.py#L228-L236
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/analyze_plugins/analyze_utilities/mouse_tool_base.py
python
MouseToolBase.keyPressUp
(self, event)
The up arrow was pressed.
The up arrow was pressed.
[ "The", "up", "arrow", "was", "pressed", "." ]
def keyPressUp(self, event): "The up arrow was pressed." pass
[ "def", "keyPressUp", "(", "self", ",", "event", ")", ":", "pass" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/analyze_plugins/analyze_utilities/mouse_tool_base.py#L69-L71
simons-public/protonfixes
24ecb378bc4e99bfe698090661d255dcbb5b677f
protonfixes/download.py
python
gdrive_download
(gdrive_id, path)
Download a file from gdrive given the fileid and a path to save
Download a file from gdrive given the fileid and a path to save
[ "Download", "a", "file", "from", "gdrive", "given", "the", "fileid", "and", "a", "path", "to", "save" ]
def gdrive_download(gdrive_id, path): """ Download a file from gdrive given the fileid and a path to save """ url = GDRIVE_URL.format(gdrive_id) cjar = http.cookiejar.CookieJar() opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cjar)) urllib.request.install_opener(opener) ...
[ "def", "gdrive_download", "(", "gdrive_id", ",", "path", ")", ":", "url", "=", "GDRIVE_URL", ".", "format", "(", "gdrive_id", ")", "cjar", "=", "http", ".", "cookiejar", ".", "CookieJar", "(", ")", "opener", "=", "urllib", ".", "request", ".", "build_ope...
https://github.com/simons-public/protonfixes/blob/24ecb378bc4e99bfe698090661d255dcbb5b677f/protonfixes/download.py#L27-L44
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/django/db/backends/__init__.py
python
BaseDatabaseOperations.convert_values
(self, value, field)
return value
Coerce the value returned by the database backend into a consistent type that is compatible with the field type.
Coerce the value returned by the database backend into a consistent type that is compatible with the field type.
[ "Coerce", "the", "value", "returned", "by", "the", "database", "backend", "into", "a", "consistent", "type", "that", "is", "compatible", "with", "the", "field", "type", "." ]
def convert_values(self, value, field): """ Coerce the value returned by the database backend into a consistent type that is compatible with the field type. """ if value is None: return value internal_type = field.get_internal_type() if internal_type =...
[ "def", "convert_values", "(", "self", ",", "value", ",", "field", ")", ":", "if", "value", "is", "None", ":", "return", "value", "internal_type", "=", "field", ".", "get_internal_type", "(", ")", "if", "internal_type", "==", "'FloatField'", ":", "return", ...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/db/backends/__init__.py#L893-L906
cjdrake/pyeda
554ee53aa678f4b61bcd7e07ba2c74ddc749d665
pyeda/boolalg/bfarray.py
python
farray.__and__
(self, other)
return self.__class__(items, shape, self.ftype)
Bit-wise AND operator
Bit-wise AND operator
[ "Bit", "-", "wise", "AND", "operator" ]
def __and__(self, other): """Bit-wise AND operator""" shape = self._op_shape(other) items = [x & y for x, y in zip(self.flat, other.flat)] return self.__class__(items, shape, self.ftype)
[ "def", "__and__", "(", "self", ",", "other", ")", ":", "shape", "=", "self", ".", "_op_shape", "(", "other", ")", "items", "=", "[", "x", "&", "y", "for", "x", ",", "y", "in", "zip", "(", "self", ".", "flat", ",", "other", ".", "flat", ")", "...
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/boolalg/bfarray.py#L535-L539
bastibe/SoundCard
8f07897a518300545048e396450aff171e888c2c
soundcard/pulseaudio.py
python
all_microphones
(include_loopback=False, exclude_monitors=True)
A list of all connected microphones. By default, this does not include loopbacks (virtual microphones that record the output of a speaker). Parameters ---------- include_loopback : bool allow recording of speaker outputs exclude_monitors : bool deprecated version of ``include_l...
A list of all connected microphones.
[ "A", "list", "of", "all", "connected", "microphones", "." ]
def all_microphones(include_loopback=False, exclude_monitors=True): """A list of all connected microphones. By default, this does not include loopbacks (virtual microphones that record the output of a speaker). Parameters ---------- include_loopback : bool allow recording of speaker ou...
[ "def", "all_microphones", "(", "include_loopback", "=", "False", ",", "exclude_monitors", "=", "True", ")", ":", "if", "not", "exclude_monitors", ":", "warnings", ".", "warn", "(", "\"The exclude_monitors flag is being replaced by the include_loopback flag\"", ",", "Depre...
https://github.com/bastibe/SoundCard/blob/8f07897a518300545048e396450aff171e888c2c/soundcard/pulseaudio.py#L309-L336
microsoft/debugpy
be8dd607f6837244e0b565345e497aff7a0c08bf
src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/window.py
python
Window.get_screen_rect
(self)
return win32.GetWindowRect( self.get_handle() )
Get the window coordinates in the desktop. @rtype: L{win32.Rect} @return: Rectangle occupied by the window in the desktop. @raise WindowsError: An error occured while processing this request.
Get the window coordinates in the desktop.
[ "Get", "the", "window", "coordinates", "in", "the", "desktop", "." ]
def get_screen_rect(self): """ Get the window coordinates in the desktop. @rtype: L{win32.Rect} @return: Rectangle occupied by the window in the desktop. @raise WindowsError: An error occured while processing this request. """ return win32.GetWindowRect( self.g...
[ "def", "get_screen_rect", "(", "self", ")", ":", "return", "win32", ".", "GetWindowRect", "(", "self", ".", "get_handle", "(", ")", ")" ]
https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/window.py#L342-L351
landlab/landlab
a5dd80b8ebfd03d1ba87ef6c4368c409485f222c
landlab/components/lake_fill/lake_fill_barnes.py
python
LakeMapperBarnes.lake_depths
(self)
return self._fill_surface - self._surface
Return the change in surface elevation at each node this step. Requires that surface and fill_surface were not the same array at instantiation. Examples -------- >>> import numpy as np >>> from landlab import RasterModelGrid >>> from landlab.components import Lak...
Return the change in surface elevation at each node this step. Requires that surface and fill_surface were not the same array at instantiation.
[ "Return", "the", "change", "in", "surface", "elevation", "at", "each", "node", "this", "step", ".", "Requires", "that", "surface", "and", "fill_surface", "were", "not", "the", "same", "array", "at", "instantiation", "." ]
def lake_depths(self): """Return the change in surface elevation at each node this step. Requires that surface and fill_surface were not the same array at instantiation. Examples -------- >>> import numpy as np >>> from landlab import RasterModelGrid >>> ...
[ "def", "lake_depths", "(", "self", ")", ":", "if", "self", ".", "_inplace", ":", "raise", "ValueError", "(", "\"surface and fill_surface must be different fields or \"", "+", "\"arrays to enable the property lake_depths!\"", ")", "return", "self", ".", "_fill_surface", "-...
https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/lake_fill/lake_fill_barnes.py#L1975-L2032
sharpdeep/WxRobot
7598124f914e21647c45f0749dda71fa05a6e331
WxRobot/webwxapi.py
python
WebWxAPI.sendTextMsg
(self,name,text,isfile = False)
[]
def sendTextMsg(self,name,text,isfile = False): id = self.getUserId(name) if id: if self.webwxsendtextmsg(text,id): return True,None else: return False,'api调用失败' else: return False,'用户不存在'
[ "def", "sendTextMsg", "(", "self", ",", "name", ",", "text", ",", "isfile", "=", "False", ")", ":", "id", "=", "self", ".", "getUserId", "(", "name", ")", "if", "id", ":", "if", "self", ".", "webwxsendtextmsg", "(", "text", ",", "id", ")", ":", "...
https://github.com/sharpdeep/WxRobot/blob/7598124f914e21647c45f0749dda71fa05a6e331/WxRobot/webwxapi.py#L317-L325
calebstewart/pwncat
d67865bdaac60dd0761d0698062e7b443a62c6db
pwncat/gtfobins.py
python
Method.__init__
(self, binary: "Binary", cap: Capability, data: Dict[str, Any])
Create a new method associated with the given binary.
Create a new method associated with the given binary.
[ "Create", "a", "new", "method", "associated", "with", "the", "given", "binary", "." ]
def __init__(self, binary: "Binary", cap: Capability, data: Dict[str, Any]): """Create a new method associated with the given binary.""" try: self.stream = Stream._member_map_[data.get("stream", "PRINT").upper()] except KeyError: raise ValueError(f"invalid stream specifi...
[ "def", "__init__", "(", "self", ",", "binary", ":", "\"Binary\"", ",", "cap", ":", "Capability", ",", "data", ":", "Dict", "[", "str", ",", "Any", "]", ")", ":", "try", ":", "self", ".", "stream", "=", "Stream", ".", "_member_map_", "[", "data", "....
https://github.com/calebstewart/pwncat/blob/d67865bdaac60dd0761d0698062e7b443a62c6db/pwncat/gtfobins.py#L80-L95
vispy/vispy
26256fdc2574259dd227022fbce0767cae4e244b
vispy/visuals/tube.py
python
_frenet_frames
(points, closed)
return tangents, normals, binormals
Calculates and returns the tangents, normals and binormals for the tube.
Calculates and returns the tangents, normals and binormals for the tube.
[ "Calculates", "and", "returns", "the", "tangents", "normals", "and", "binormals", "for", "the", "tube", "." ]
def _frenet_frames(points, closed): """Calculates and returns the tangents, normals and binormals for the tube. """ tangents = np.zeros((len(points), 3)) normals = np.zeros((len(points), 3)) epsilon = 0.0001 # Compute tangent vectors for each segment tangents = np.roll(points, -1, axis...
[ "def", "_frenet_frames", "(", "points", ",", "closed", ")", ":", "tangents", "=", "np", ".", "zeros", "(", "(", "len", "(", "points", ")", ",", "3", ")", ")", "normals", "=", "np", ".", "zeros", "(", "(", "len", "(", "points", ")", ",", "3", ")...
https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/visuals/tube.py#L121-L173
topazproject/topaz
bf4a56adbe03ae9ab4984729c733fcbc64a164c4
topaz/parser.py
python
Parser.undef_list_undef_list
(self, p)
return self.append_to_list(p[0], p[3])
undef_list ',' { lexer.setState(LexState.EXPR_FNAME); } fitem { $$ = support.appendToBlock($1, support.newUndef($1.getPosition(), $4)); }
undef_list ',' { lexer.setState(LexState.EXPR_FNAME); } fitem { $$ = support.appendToBlock($1, support.newUndef($1.getPosition(), $4)); }
[ "undef_list", "{", "lexer", ".", "setState", "(", "LexState", ".", "EXPR_FNAME", ")", ";", "}", "fitem", "{", "$$", "=", "support", ".", "appendToBlock", "(", "$1", "support", ".", "newUndef", "(", "$1", ".", "getPosition", "()", "$4", "))", ";", "}" ]
def undef_list_undef_list(self, p): """ undef_list ',' { lexer.setState(LexState.EXPR_FNAME); } fitem { $$ = support.appendToBlock($1, support.newUndef($1.getPosition(), $4)); } """ return self.append_to_list(p[0], p...
[ "def", "undef_list_undef_list", "(", "self", ",", "p", ")", ":", "return", "self", ".", "append_to_list", "(", "p", "[", "0", "]", ",", "p", "[", "3", "]", ")" ]
https://github.com/topazproject/topaz/blob/bf4a56adbe03ae9ab4984729c733fcbc64a164c4/topaz/parser.py#L1173-L1181
cortex-lab/phy
9a330b9437a3d0b40a37a201d147224e6e7fb462
phy/gui/qt.py
python
create_app
()
return QT_APP
Create a Qt application.
Create a Qt application.
[ "Create", "a", "Qt", "application", "." ]
def create_app(): """Create a Qt application.""" global QT_APP QT_APP = QApplication.instance() if QT_APP is None: # pragma: no cover QT_APP = QApplication(sys.argv) return QT_APP
[ "def", "create_app", "(", ")", ":", "global", "QT_APP", "QT_APP", "=", "QApplication", ".", "instance", "(", ")", "if", "QT_APP", "is", "None", ":", "# pragma: no cover", "QT_APP", "=", "QApplication", "(", "sys", ".", "argv", ")", "return", "QT_APP" ]
https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/gui/qt.py#L99-L105
sassoftware/python-dlpy
6082b1eeaab7406cce22715a35a1f4308943d522
dlpy/utils.py
python
get_info_for_object_detection
( sess, table)
return classes, max_no_of_objects
parameters ---------- sess : CAS Session Specifies the CAS session table : CAS table Specifies the table containing the object detection metadata Returns ------- classes : dict Specifies the frequency distribution of the classes in the metadata max_no_of_objects : in...
[]
def get_info_for_object_detection( sess, table): ''' parameters ---------- sess : CAS Session Specifies the CAS session table : CAS table Specifies the table containing the object detection metadata Returns ------- classes : dict Specifies the frequency distribu...
[ "def", "get_info_for_object_detection", "(", "sess", ",", "table", ")", ":", "if", "isinstance", "(", "table", ",", "str", ")", ":", "t", "=", "sess", ".", "CASTable", "(", "table", ")", "else", ":", "t", "=", "table", "r", "=", "table", ".", "summar...
https://github.com/sassoftware/python-dlpy/blob/6082b1eeaab7406cce22715a35a1f4308943d522/dlpy/utils.py#L1936-L1977
hasanirtiza/Pedestron
3bdcf8476edc0741f28a80dd4cb161ac532507ee
tools/ECPB/statistics.py
python
MrFppi.create_plot
(self, title=None, label=None)
return fig
[]
def create_plot(self, title=None, label=None): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.loglog() ax.set_xlabel('FPPI') ax.set_ylabel('Miss Rate') ax.grid(b=True, which='major', linestyle='-') ax.yaxis.grid(b=True, which='minor', linestyle='--') ...
[ "def", "create_plot", "(", "self", ",", "title", "=", "None", ",", "label", "=", "None", ")", ":", "fig", "=", "plt", ".", "figure", "(", ")", "ax", "=", "fig", ".", "add_subplot", "(", "1", ",", "1", ",", "1", ")", "ax", ".", "loglog", "(", ...
https://github.com/hasanirtiza/Pedestron/blob/3bdcf8476edc0741f28a80dd4cb161ac532507ee/tools/ECPB/statistics.py#L14-L35
CouchPotato/CouchPotatoV1
135b3331d1b88ef645e29b76f2d4cc4a732c9232
library/markupsafe/_native.py
python
soft_unicode
(s)
return s
Make a string unicode if it isn't already. That way a markup string is not converted back to unicode.
Make a string unicode if it isn't already. That way a markup string is not converted back to unicode.
[ "Make", "a", "string", "unicode", "if", "it", "isn", "t", "already", ".", "That", "way", "a", "markup", "string", "is", "not", "converted", "back", "to", "unicode", "." ]
def soft_unicode(s): """Make a string unicode if it isn't already. That way a markup string is not converted back to unicode. """ if not isinstance(s, unicode): s = unicode(s) return s
[ "def", "soft_unicode", "(", "s", ")", ":", "if", "not", "isinstance", "(", "s", ",", "unicode", ")", ":", "s", "=", "unicode", "(", "s", ")", "return", "s" ]
https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/markupsafe/_native.py#L30-L36
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/node_port_status_snapshot_dto.py
python
NodePortStatusSnapshotDTO.__init__
(self, node_id=None, address=None, api_port=None, status_snapshot=None)
NodePortStatusSnapshotDTO - a model defined in Swagger
NodePortStatusSnapshotDTO - a model defined in Swagger
[ "NodePortStatusSnapshotDTO", "-", "a", "model", "defined", "in", "Swagger" ]
def __init__(self, node_id=None, address=None, api_port=None, status_snapshot=None): """ NodePortStatusSnapshotDTO - a model defined in Swagger """ self._node_id = None self._address = None self._api_port = None self._status_snapshot = None if node_id is...
[ "def", "__init__", "(", "self", ",", "node_id", "=", "None", ",", "address", "=", "None", ",", "api_port", "=", "None", ",", "status_snapshot", "=", "None", ")", ":", "self", ".", "_node_id", "=", "None", "self", ".", "_address", "=", "None", "self", ...
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/node_port_status_snapshot_dto.py#L47-L64
awslabs/aws-ec2rescue-linux
8ecf40e7ea0d2563dac057235803fca2221029d2
lib/urllib3/fields.py
python
RequestField._render_parts
(self, header_parts)
return u"; ".join(parts)
Helper function to format and quote a single header. Useful for single headers that are composed of multiple items. E.g., 'Content-Disposition' fields. :param header_parts: A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format as `k1="v1"; k2="v2"; ...`.
Helper function to format and quote a single header.
[ "Helper", "function", "to", "format", "and", "quote", "a", "single", "header", "." ]
def _render_parts(self, header_parts): """ Helper function to format and quote a single header. Useful for single headers that are composed of multiple items. E.g., 'Content-Disposition' fields. :param header_parts: A sequence of (k, v) tuples or a :class:`dict` of ...
[ "def", "_render_parts", "(", "self", ",", "header_parts", ")", ":", "parts", "=", "[", "]", "iterable", "=", "header_parts", "if", "isinstance", "(", "header_parts", ",", "dict", ")", ":", "iterable", "=", "header_parts", ".", "items", "(", ")", "for", "...
https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/urllib3/fields.py#L207-L227
adamchainz/django-mysql
389594dc078f73c9f204306014332344fe4b6d04
src/django_mysql/models/fields/sizes.py
python
SizedBinaryField.__init__
(self, *args: Any, size_class: int = 4, **kwargs: Any)
[]
def __init__(self, *args: Any, size_class: int = 4, **kwargs: Any) -> None: self.size_class = size_class super().__init__(*args, **kwargs)
[ "def", "__init__", "(", "self", ",", "*", "args", ":", "Any", ",", "size_class", ":", "int", "=", "4", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "self", ".", "size_class", "=", "size_class", "super", "(", ")", ".", "__init__", ...
https://github.com/adamchainz/django-mysql/blob/389594dc078f73c9f204306014332344fe4b6d04/src/django_mysql/models/fields/sizes.py#L11-L13
chainer/chainer
e9da1423255c58c37be9733f51b158aa9b39dc93
chainer/functions/activation/rrelu.py
python
rrelu
(x, l=1. / 8, u=1. / 3, **kwargs)
return out
rrelu(x, l=1. / 8, u=1. / 3, *, r=None, return_r=False) Randomized Leaky Rectified Liner Unit function. This function is expressed as .. math:: f(x)=\\max(x, rx), where :math:`r` is a random number sampled from a uniform distribution :math:`U(l, u)`. .. note:: The :math:`r` corresp...
rrelu(x, l=1. / 8, u=1. / 3, *, r=None, return_r=False)
[ "rrelu", "(", "x", "l", "=", "1", ".", "/", "8", "u", "=", "1", ".", "/", "3", "*", "r", "=", "None", "return_r", "=", "False", ")" ]
def rrelu(x, l=1. / 8, u=1. / 3, **kwargs): """rrelu(x, l=1. / 8, u=1. / 3, *, r=None, return_r=False) Randomized Leaky Rectified Liner Unit function. This function is expressed as .. math:: f(x)=\\max(x, rx), where :math:`r` is a random number sampled from a uniform distribution :math:`U(l,...
[ "def", "rrelu", "(", "x", ",", "l", "=", "1.", "/", "8", ",", "u", "=", "1.", "/", "3", ",", "*", "*", "kwargs", ")", ":", "r", "=", "None", "return_r", "=", "False", "if", "kwargs", ":", "r", ",", "return_r", "=", "argument", ".", "parse_kwa...
https://github.com/chainer/chainer/blob/e9da1423255c58c37be9733f51b158aa9b39dc93/chainer/functions/activation/rrelu.py#L92-L161
datitran/object_detector_app
44e8eddeb931cced5d8cf1e283383c720a5706bf
object_detection/core/box_coder.py
python
BoxCoder._decode
(self, rel_codes, anchors)
Method to be overriden by implementations. Args: rel_codes: a tensor representing N relative-encoded boxes anchors: BoxList of anchors Returns: boxlist: BoxList holding N boxes encoded in the ordinary way (i.e., with corners y_min, x_min, y_max, x_max)
Method to be overriden by implementations.
[ "Method", "to", "be", "overriden", "by", "implementations", "." ]
def _decode(self, rel_codes, anchors): """Method to be overriden by implementations. Args: rel_codes: a tensor representing N relative-encoded boxes anchors: BoxList of anchors Returns: boxlist: BoxList holding N boxes encoded in the ordinary way (i.e., with corners y_min, x_min,...
[ "def", "_decode", "(", "self", ",", "rel_codes", ",", "anchors", ")", ":", "pass" ]
https://github.com/datitran/object_detector_app/blob/44e8eddeb931cced5d8cf1e283383c720a5706bf/object_detection/core/box_coder.py#L102-L113
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/paramiko/sftp_si.py
python
SFTPServerInterface.symlink
(self, target_path, path)
return SFTP_OP_UNSUPPORTED
Create a symbolic link on the server, as new pathname ``path``, with ``target_path`` as the target of the link. :param str target_path: path (relative or absolute) of the target for this new symbolic link. :param str path: path (relative or absolute) ...
Create a symbolic link on the server, as new pathname ``path``, with ``target_path`` as the target of the link. :param str target_path: path (relative or absolute) of the target for this new symbolic link. :param str path: path (relative or absolute) ...
[ "Create", "a", "symbolic", "link", "on", "the", "server", "as", "new", "pathname", "path", "with", "target_path", "as", "the", "target", "of", "the", "link", ".", ":", "param", "str", "target_path", ":", "path", "(", "relative", "or", "absolute", ")", "o...
def symlink(self, target_path, path): """ Create a symbolic link on the server, as new pathname ``path``, with ``target_path`` as the target of the link. :param str target_path: path (relative or absolute) of the target for this new symbolic link. ...
[ "def", "symlink", "(", "self", ",", "target_path", ",", "path", ")", ":", "return", "SFTP_OP_UNSUPPORTED" ]
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/paramiko/sftp_si.py#L284-L296
biocore/qiime
76d633c0389671e93febbe1338b5ded658eba31f
qiime/denoiser/flowgram_clustering.py
python
log_remaining_rounds
(ids, cluster_mapping, bail_out, log_fh=None)
return remaining_rounds
estimate the worst case number of rounds remaining ids: dict of active ids cluster_mapping: cluster mapping as dict bail_out: minimally required cluster size log_fh: log file handle
estimate the worst case number of rounds remaining
[ "estimate", "the", "worst", "case", "number", "of", "rounds", "remaining" ]
def log_remaining_rounds(ids, cluster_mapping, bail_out, log_fh=None): """estimate the worst case number of rounds remaining ids: dict of active ids cluster_mapping: cluster mapping as dict bail_out: minimally required cluster size log_fh: log file handle """ # this doesn't look very cl...
[ "def", "log_remaining_rounds", "(", "ids", ",", "cluster_mapping", ",", "bail_out", ",", "log_fh", "=", "None", ")", ":", "# this doesn't look very clever and might run a lot faster if rewritten", "remaining_rounds", "=", "len", "(", "[", "id", "for", "id", "in", "ids...
https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/denoiser/flowgram_clustering.py#L403-L421
SecureAuthCorp/impacket
10e53952e64e290712d49e263420b70b681bbc73
impacket/dot11.py
python
Dot11DataFrame.set_sequence_control
(self, value)
Set the 802.11 \'Data\' data frame \'Sequence Control\' field
Set the 802.11 \'Data\' data frame \'Sequence Control\' field
[ "Set", "the", "802", ".", "11", "\\", "Data", "\\", "data", "frame", "\\", "Sequence", "Control", "\\", "field" ]
def set_sequence_control(self, value): 'Set the 802.11 \'Data\' data frame \'Sequence Control\' field' # set the bits nb = value & 0xFFFF self.header.set_word(20, nb, "<")
[ "def", "set_sequence_control", "(", "self", ",", "value", ")", ":", "# set the bits", "nb", "=", "value", "&", "0xFFFF", "self", ".", "header", ".", "set_word", "(", "20", ",", "nb", ",", "\"<\"", ")" ]
https://github.com/SecureAuthCorp/impacket/blob/10e53952e64e290712d49e263420b70b681bbc73/impacket/dot11.py#L807-L811
devitocodes/devito
6abd441e3f5f091775ad332be6b95e017b8cbd16
devito/passes/iet/langbase.py
python
LangBB._map_to
(cls, f, imask=None, queueid=None)
Allocate and copy Function from host to device memory.
Allocate and copy Function from host to device memory.
[ "Allocate", "and", "copy", "Function", "from", "host", "to", "device", "memory", "." ]
def _map_to(cls, f, imask=None, queueid=None): """ Allocate and copy Function from host to device memory. """ raise NotImplementedError
[ "def", "_map_to", "(", "cls", ",", "f", ",", "imask", "=", "None", ",", "queueid", "=", "None", ")", ":", "raise", "NotImplementedError" ]
https://github.com/devitocodes/devito/blob/6abd441e3f5f091775ad332be6b95e017b8cbd16/devito/passes/iet/langbase.py#L47-L51
ronreiter/interactive-tutorials
d026d1ae58941863d60eb30a8a94a8650d2bd4bf
suds/xsd/sxbase.py
python
Iter.next
(self)
Get the next item. @return: A tuple: the next (child, ancestry). @rtype: (L{SchemaObject}, [L{SchemaObject},..]) @raise StopIteration: A the end.
Get the next item.
[ "Get", "the", "next", "item", "." ]
def next(self): """ Get the next item. @return: A tuple: the next (child, ancestry). @rtype: (L{SchemaObject}, [L{SchemaObject},..]) @raise StopIteration: A the end. """ frame = self.top() while True: result = frame.next() if result...
[ "def", "next", "(", "self", ")", ":", "frame", "=", "self", ".", "top", "(", ")", "while", "True", ":", "result", "=", "frame", ".", "next", "(", ")", "if", "result", "is", "None", ":", "self", ".", "pop", "(", ")", "return", "self", ".", "next...
https://github.com/ronreiter/interactive-tutorials/blob/d026d1ae58941863d60eb30a8a94a8650d2bd4bf/suds/xsd/sxbase.py#L582-L599
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/oscar/OscarBuddies.py
python
OscarBuddy.get_online
(self)
return self._status != 'offline' and self._status != 'unknown'
Returns True if the buddy is not offline
Returns True if the buddy is not offline
[ "Returns", "True", "if", "the", "buddy", "is", "not", "offline" ]
def get_online(self): 'Returns True if the buddy is not offline' return self._status != 'offline' and self._status != 'unknown'
[ "def", "get_online", "(", "self", ")", ":", "return", "self", ".", "_status", "!=", "'offline'", "and", "self", ".", "_status", "!=", "'unknown'" ]
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/oscar/OscarBuddies.py#L836-L838
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django_redis/client/sharded.py
python
ShardClient.incr
(self, key, delta=1, version=None, client=None)
return super(ShardClient, self)\ .incr(key=key, delta=delta, version=version, client=client)
[]
def incr(self, key, delta=1, version=None, client=None): if client is None: key = self.make_key(key, version=version) client = self.get_server(key) return super(ShardClient, self)\ .incr(key=key, delta=delta, version=version, client=client)
[ "def", "incr", "(", "self", ",", "key", ",", "delta", "=", "1", ",", "version", "=", "None", ",", "client", "=", "None", ")", ":", "if", "client", "is", "None", ":", "key", "=", "self", ".", "make_key", "(", "key", ",", "version", "=", "version",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django_redis/client/sharded.py#L174-L180
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
frontend/match.py
python
SimpleLexer.Next
(self)
return tok_id, val
Note: match_func will return Id.Eol_Tok repeatedly the terminating NUL
Note: match_func will return Id.Eol_Tok repeatedly the terminating NUL
[ "Note", ":", "match_func", "will", "return", "Id", ".", "Eol_Tok", "repeatedly", "the", "terminating", "NUL" ]
def Next(self): # type: () -> Tuple[Id_t, str] """ Note: match_func will return Id.Eol_Tok repeatedly the terminating NUL """ tok_id, end_pos = self.match_func(self.s, self.pos) val = self.s[self.pos:end_pos] self.pos = end_pos return tok_id, val
[ "def", "Next", "(", "self", ")", ":", "# type: () -> Tuple[Id_t, str]", "tok_id", ",", "end_pos", "=", "self", ".", "match_func", "(", "self", ".", "s", ",", "self", ".", "pos", ")", "val", "=", "self", ".", "s", "[", "self", ".", "pos", ":", "end_po...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/frontend/match.py#L181-L189
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/xml/sax/handler.py
python
ContentHandler.startElement
(self, name, attrs)
Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.
Signals the start of an element in non-namespace mode.
[ "Signals", "the", "start", "of", "an", "element", "in", "non", "-", "namespace", "mode", "." ]
def startElement(self, name, attrs): """Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the elem...
[ "def", "startElement", "(", "self", ",", "name", ",", "attrs", ")", ":" ]
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/xml/sax/handler.py#L126-L132
winpython/winpython
5af92920d1d6b4e12702d1816a1f7bbb95a3d949
winpython/py3compat.py
python
is_string
(obj)
return is_text_string(obj) or is_binary_string(obj)
Return True if `obj` is a text or binary Python string object, False if it is anything else, like a QString (Python 2, PyQt API #1)
Return True if `obj` is a text or binary Python string object, False if it is anything else, like a QString (Python 2, PyQt API #1)
[ "Return", "True", "if", "obj", "is", "a", "text", "or", "binary", "Python", "string", "object", "False", "if", "it", "is", "anything", "else", "like", "a", "QString", "(", "Python", "2", "PyQt", "API", "#1", ")" ]
def is_string(obj): """Return True if `obj` is a text or binary Python string object, False if it is anything else, like a QString (Python 2, PyQt API #1)""" return is_text_string(obj) or is_binary_string(obj)
[ "def", "is_string", "(", "obj", ")", ":", "return", "is_text_string", "(", "obj", ")", "or", "is_binary_string", "(", "obj", ")" ]
https://github.com/winpython/winpython/blob/5af92920d1d6b4e12702d1816a1f7bbb95a3d949/winpython/py3compat.py#L125-L128
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/tablib-0.12.1/tablib/packages/dbfpy/fields.py
python
DbfNumericFieldDef.encodeValue
(self, value)
return _rv
Return string containing encoded ``value``.
Return string containing encoded ``value``.
[ "Return", "string", "containing", "encoded", "value", "." ]
def encodeValue(self, value): """Return string containing encoded ``value``.""" _rv = ("%*.*f" % (self.length, self.decimalCount, value)) if len(_rv) > self.length: _ppos = _rv.find(".") if 0 <= _ppos <= self.length: _rv = _rv[:self.length] els...
[ "def", "encodeValue", "(", "self", ",", "value", ")", ":", "_rv", "=", "(", "\"%*.*f\"", "%", "(", "self", ".", "length", ",", "self", ".", "decimalCount", ",", "value", ")", ")", "if", "len", "(", "_rv", ")", ">", "self", ".", "length", ":", "_p...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/tablib-0.12.1/tablib/packages/dbfpy/fields.py#L248-L258
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/requests/utils.py
python
prepend_scheme_if_needed
(url, new_scheme)
return urlunparse((scheme, netloc, path, params, query, fragment))
Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str
Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument.
[ "Given", "a", "URL", "that", "may", "or", "may", "not", "have", "a", "scheme", "prepend", "the", "given", "scheme", ".", "Does", "not", "replace", "a", "present", "scheme", "with", "the", "one", "provided", "as", "an", "argument", "." ]
def prepend_scheme_if_needed(url, new_scheme): """Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str """ scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme) # urlpars...
[ "def", "prepend_scheme_if_needed", "(", "url", ",", "new_scheme", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "params", ",", "query", ",", "fragment", "=", "urlparse", "(", "url", ",", "new_scheme", ")", "# urlparse is a finicky beast, and sometimes decid...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/requests/utils.py#L816-L830
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py
python
HyperellipticCurve_padic_field.teichmuller
(self, P)
r""" Find a Teichm\:uller point in the same residue class of `P`. Because this lift of frobenius acts as `x \mapsto x^p`, take the Teichmuller lift of `x` and then find a matching `y` from that. EXAMPLES:: sage: K = pAdicField(7, 5) sage: E = EllipticCu...
r""" Find a Teichm\:uller point in the same residue class of `P`.
[ "r", "Find", "a", "Teichm", "\\", ":", "uller", "point", "in", "the", "same", "residue", "class", "of", "P", "." ]
def teichmuller(self, P): r""" Find a Teichm\:uller point in the same residue class of `P`. Because this lift of frobenius acts as `x \mapsto x^p`, take the Teichmuller lift of `x` and then find a matching `y` from that. EXAMPLES:: sage: K = pAdicField(7, 5...
[ "def", "teichmuller", "(", "self", ",", "P", ")", ":", "K", "=", "P", "[", "0", "]", ".", "parent", "(", ")", "x", "=", "K", ".", "teichmuller", "(", "P", "[", "0", "]", ")", "pts", "=", "self", ".", "lift_x", "(", "x", ",", "all", "=", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py#L450-L478
muricoca/crab
beb355538acc419b82beae3c6845d1e1cff5d26b
scikits/crab/metrics/metrics.py
python
f1_score
(y_real, y_pred)
return fbeta_score(y_real, y_pred, 1)
Compute f1 score The F1 score can be interpreted as a weighted average of the precision and recall, where an F1 score reaches its best value at 1 and worst score at 0. The relative contribution of precision and recall to the f1 score are equal. F_1 = 2 * (precision * recall) / (precision + rec...
Compute f1 score
[ "Compute", "f1", "score" ]
def f1_score(y_real, y_pred): """Compute f1 score The F1 score can be interpreted as a weighted average of the precision and recall, where an F1 score reaches its best value at 1 and worst score at 0. The relative contribution of precision and recall to the f1 score are equal. F_1 = 2 * (p...
[ "def", "f1_score", "(", "y_real", ",", "y_pred", ")", ":", "return", "fbeta_score", "(", "y_real", ",", "y_pred", ",", "1", ")" ]
https://github.com/muricoca/crab/blob/beb355538acc419b82beae3c6845d1e1cff5d26b/scikits/crab/metrics/metrics.py#L187-L222
skyfielders/python-skyfield
0e68757a5c1081f784c58fd7a76635c6deb98451
contrib/almanac2/almanac2.py
python
_lha
(observer, body, t)
return _local_sidereal(observer, t) - _ra(observer, body, t)
Returns the local hour angle of `body` in degrees when seen from `observer` at terrestrial time `t`.
Returns the local hour angle of `body` in degrees when seen from `observer` at terrestrial time `t`.
[ "Returns", "the", "local", "hour", "angle", "of", "body", "in", "degrees", "when", "seen", "from", "observer", "at", "terrestrial", "time", "t", "." ]
def _lha(observer, body, t): """Returns the local hour angle of `body` in degrees when seen from `observer` at terrestrial time `t`. """ return _local_sidereal(observer, t) - _ra(observer, body, t)
[ "def", "_lha", "(", "observer", ",", "body", ",", "t", ")", ":", "return", "_local_sidereal", "(", "observer", ",", "t", ")", "-", "_ra", "(", "observer", ",", "body", ",", "t", ")" ]
https://github.com/skyfielders/python-skyfield/blob/0e68757a5c1081f784c58fd7a76635c6deb98451/contrib/almanac2/almanac2.py#L214-L218
avidLearnerInProgress/python-automation-scripts
859cbbf72571673500cfc0fbcf493beaed48b7c5
comics-scraper/myXcbdScraper.py
python
batchDownloader
()
[]
def batchDownloader(): url = 'https://xkcd.com' #check to make sure it's not the first page while not url.endswith('#'): #print out the current page print('Current page: %s' % url) res = requests.get(url) res.raise_for_status() #returns None as the request received is 200 wh...
[ "def", "batchDownloader", "(", ")", ":", "url", "=", "'https://xkcd.com'", "#check to make sure it's not the first page", "while", "not", "url", ".", "endswith", "(", "'#'", ")", ":", "#print out the current page", "print", "(", "'Current page: %s'", "%", "url", ")", ...
https://github.com/avidLearnerInProgress/python-automation-scripts/blob/859cbbf72571673500cfc0fbcf493beaed48b7c5/comics-scraper/myXcbdScraper.py#L73-L109
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/two_factor/oath.py
python
hotp
(key, counter, digits=6)
return hotp
Implementation of the HOTP algorithm from `RFC 4226 <http://tools.ietf.org/html/rfc4226#section-5>`_. :param bytes key: The shared secret. A 20-byte string is recommended. :param int counter: The password counter. :param int digits: The number of decimal digits to generate. :returns: The HOTP toke...
Implementation of the HOTP algorithm from `RFC 4226 <http://tools.ietf.org/html/rfc4226#section-5>`_.
[ "Implementation", "of", "the", "HOTP", "algorithm", "from", "RFC", "4226", "<http", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc4226#section", "-", "5", ">", "_", "." ]
def hotp(key, counter, digits=6): """ Implementation of the HOTP algorithm from `RFC 4226 <http://tools.ietf.org/html/rfc4226#section-5>`_. :param bytes key: The shared secret. A 20-byte string is recommended. :param int counter: The password counter. :param int digits: The number of decimal di...
[ "def", "hotp", "(", "key", ",", "counter", ",", "digits", "=", "6", ")", ":", "msg", "=", "pack", "(", "b'>Q'", ",", "counter", ")", "hs", "=", "hmac", ".", "new", "(", "key", ",", "msg", ",", "sha1", ")", ".", "digest", "(", ")", "hs", "=", ...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/two_factor/oath.py#L18-L52
dcsync/pycobalt
d3a630bfadaeeb6c99aad28f226abe48f6b4acca
pycobalt/aggressor.py
python
berror
(*args, fork=None, sync=True)
return engine.call('berror', args, fork=fork, sync=sync)
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Publish an error message to the Beacon transcript Arguments $1 - the id for the beacon to post to $2 - the text to post Example alias donotrun { berror($1, "You should n...
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
[ "r", "Documentation", "from", "https", ":", "//", "www", ".", "cobaltstrike", ".", "com", "/", "aggressor", "-", "script", "/", "functions", ".", "html", ":" ]
def berror(*args, fork=None, sync=True): r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Publish an error message to the Beacon transcript Arguments $1 - the id for the beacon to post to $2 - the text to post Example alias do...
[ "def", "berror", "(", "*", "args", ",", "fork", "=", "None", ",", "sync", "=", "True", ")", ":", "return", "engine", ".", "call", "(", "'berror'", ",", "args", ",", "fork", "=", "fork", ",", "sync", "=", "sync", ")" ]
https://github.com/dcsync/pycobalt/blob/d3a630bfadaeeb6c99aad28f226abe48f6b4acca/pycobalt/aggressor.py#L1802-L1817
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/messaging/credential_definitions/routes.py
python
on_cred_def_event
(profile: Profile, event: Event)
Handle any events we need to support.
Handle any events we need to support.
[ "Handle", "any", "events", "we", "need", "to", "support", "." ]
async def on_cred_def_event(profile: Profile, event: Event): """Handle any events we need to support.""" schema_id = event.payload["context"]["schema_id"] cred_def_id = event.payload["context"]["cred_def_id"] issuer_did = event.payload["context"]["issuer_did"] # after the ledger record is written, ...
[ "async", "def", "on_cred_def_event", "(", "profile", ":", "Profile", ",", "event", ":", "Event", ")", ":", "schema_id", "=", "event", ".", "payload", "[", "\"context\"", "]", "[", "\"schema_id\"", "]", "cred_def_id", "=", "event", ".", "payload", "[", "\"c...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/credential_definitions/routes.py#L450-L490
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/binhex.py
python
HexBin.__init__
(self, ifp)
[]
def __init__(self, ifp): if isinstance(ifp, str): ifp = io.open(ifp, 'rb') # # Find initial colon. # while True: ch = ifp.read(1) if not ch: raise Error("No binhex data found") # Cater for \r\n terminated lines (whic...
[ "def", "__init__", "(", "self", ",", "ifp", ")", ":", "if", "isinstance", "(", "ifp", ",", "str", ")", ":", "ifp", "=", "io", ".", "open", "(", "ifp", ",", "'rb'", ")", "#", "# Find initial colon.", "#", "while", "True", ":", "ch", "=", "ifp", "....
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/binhex.py#L351-L371
deepchem/deepchem
054eb4b2b082e3df8e1a8e77f36a52137ae6e375
deepchem/models/sklearn_models/sklearn_model.py
python
SklearnModel.reload
(self)
Loads scikit-learn model from joblib file on disk.
Loads scikit-learn model from joblib file on disk.
[ "Loads", "scikit", "-", "learn", "model", "from", "joblib", "file", "on", "disk", "." ]
def reload(self): """Loads scikit-learn model from joblib file on disk.""" self.model = load_from_disk(self.get_model_filename(self.model_dir))
[ "def", "reload", "(", "self", ")", ":", "self", ".", "model", "=", "load_from_disk", "(", "self", ".", "get_model_filename", "(", "self", ".", "model_dir", ")", ")" ]
https://github.com/deepchem/deepchem/blob/054eb4b2b082e3df8e1a8e77f36a52137ae6e375/deepchem/models/sklearn_models/sklearn_model.py#L153-L155
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py
python
build_inputs_with_special_tokens
(self, token_ids_0, token_ids_1=None)
return output + [self.eos_token_id] + token_ids_1 + [self.eos_token_id]
[]
def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None): output = [self.bos_token_id] + token_ids_0 + [self.eos_token_id] if token_ids_1 is None: return output return output + [self.eos_token_id] + token_ids_1 + [self.eos_token_id]
[ "def", "build_inputs_with_special_tokens", "(", "self", ",", "token_ids_0", ",", "token_ids_1", "=", "None", ")", ":", "output", "=", "[", "self", ".", "bos_token_id", "]", "+", "token_ids_0", "+", "[", "self", ".", "eos_token_id", "]", "if", "token_ids_1", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py#L304-L309
sublimelsp/LSP
19a01aa045de04bcc805e56043923656548050e0
plugin/session_buffer.py
python
SessionBuffer._if_view_unchanged
(self, f: Callable[[sublime.View, Any], None], version: int)
return handler
Ensures that the view is at the same version when we were called, before calling the `f` function.
Ensures that the view is at the same version when we were called, before calling the `f` function.
[ "Ensures", "that", "the", "view", "is", "at", "the", "same", "version", "when", "we", "were", "called", "before", "calling", "the", "f", "function", "." ]
def _if_view_unchanged(self, f: Callable[[sublime.View, Any], None], version: int) -> Callable[[Any], None]: """ Ensures that the view is at the same version when we were called, before calling the `f` function. """ def handler(*args: Any) -> None: view = self.some_view() ...
[ "def", "_if_view_unchanged", "(", "self", ",", "f", ":", "Callable", "[", "[", "sublime", ".", "View", ",", "Any", "]", ",", "None", "]", ",", "version", ":", "int", ")", "->", "Callable", "[", "[", "Any", "]", ",", "None", "]", ":", "def", "hand...
https://github.com/sublimelsp/LSP/blob/19a01aa045de04bcc805e56043923656548050e0/plugin/session_buffer.py#L310-L319
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/internet/interfaces.py
python
IReactorTCP.listenTCP
(port, factory, backlog=50, interface='')
Connects a given protocol factory to the given numeric TCP/IP port. @param port: a port number on which to listen @param factory: a L{twisted.internet.protocol.ServerFactory} instance @param backlog: size of the listen queue @param interface: the hostname to bind to, defaults to '' (...
Connects a given protocol factory to the given numeric TCP/IP port.
[ "Connects", "a", "given", "protocol", "factory", "to", "the", "given", "numeric", "TCP", "/", "IP", "port", "." ]
def listenTCP(port, factory, backlog=50, interface=''): """ Connects a given protocol factory to the given numeric TCP/IP port. @param port: a port number on which to listen @param factory: a L{twisted.internet.protocol.ServerFactory} instance @param backlog: size of the liste...
[ "def", "listenTCP", "(", "port", ",", "factory", ",", "backlog", "=", "50", ",", "interface", "=", "''", ")", ":" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/internet/interfaces.py#L243-L261
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/venv/lib/python3.7/site-packages/pip/_vendor/requests/utils.py
python
from_key_val_list
(value)
return OrderedDict(value)
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') ValueError: cannot encode...
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g.,
[ "Take", "an", "object", "and", "test", "to", "see", "if", "it", "can", "be", "represented", "as", "a", "dictionary", ".", "Unless", "it", "can", "not", "be", "represented", "as", "such", "return", "an", "OrderedDict", "e", ".", "g", "." ]
def from_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('strin...
[ "def", "from_key_val_list", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "str", ",", "bytes", ",", "bool", ",", "int", ")", ")", ":", "raise", "ValueError", "(", "'cannot encode...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/requests/utils.py#L259-L281
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/providers/openstack/os_virtual_machine.py
python
OpenStackVirtualMachine.GetResourceMetadata
(self)
return result
Returns a dict containing metadata about the VM. Returns: dict mapping string property key to value.
Returns a dict containing metadata about the VM.
[ "Returns", "a", "dict", "containing", "metadata", "about", "the", "VM", "." ]
def GetResourceMetadata(self): """Returns a dict containing metadata about the VM. Returns: dict mapping string property key to value. """ result = super(OpenStackVirtualMachine, self).GetResourceMetadata() if self.post_provisioning_script: result['post_provisioning_script'] = self.post...
[ "def", "GetResourceMetadata", "(", "self", ")", ":", "result", "=", "super", "(", "OpenStackVirtualMachine", ",", "self", ")", ".", "GetResourceMetadata", "(", ")", "if", "self", ".", "post_provisioning_script", ":", "result", "[", "'post_provisioning_script'", "]...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/openstack/os_virtual_machine.py#L402-L411
zsdonghao/text-to-image
c1fbfa4349f5aa1c74c9fe17743cc0cff34f1aab
model.py
python
generator_txt2img_resnet
(input_z, t_txt=None, is_train=True, reuse=False, batch_size=batch_size)
return net_ho, logits
z + (txt) --> 64x64
z + (txt) --> 64x64
[ "z", "+", "(", "txt", ")", "--", ">", "64x64" ]
def generator_txt2img_resnet(input_z, t_txt=None, is_train=True, reuse=False, batch_size=batch_size): """ z + (txt) --> 64x64 """ # https://github.com/hanzhanggit/StackGAN/blob/master/stageI/model.py s = image_size # output image size [64] s2, s4, s8, s16 = int(s/2), int(s/4), int(s/8), int(s/16) gf...
[ "def", "generator_txt2img_resnet", "(", "input_z", ",", "t_txt", "=", "None", ",", "is_train", "=", "True", ",", "reuse", "=", "False", ",", "batch_size", "=", "batch_size", ")", ":", "# https://github.com/hanzhanggit/StackGAN/blob/master/stageI/model.py", "s", "=", ...
https://github.com/zsdonghao/text-to-image/blob/c1fbfa4349f5aa1c74c9fe17743cc0cff34f1aab/model.py#L978-L1070
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/tts/losses/stftlosses.py
python
MultiResolutionSTFTLoss.forward
(self, *, x, y, input_lengths=None)
return sc_loss, mag_loss
Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). y (Tensor): Groundtruth signal (B, T). input_lengths (Tensor): Length of groundtruth sample in samples (B). Returns: List[Tensor]: Multi resolution spectral convergence loss value. ...
Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). y (Tensor): Groundtruth signal (B, T). input_lengths (Tensor): Length of groundtruth sample in samples (B). Returns: List[Tensor]: Multi resolution spectral convergence loss value. ...
[ "Calculate", "forward", "propagation", ".", "Args", ":", "x", "(", "Tensor", ")", ":", "Predicted", "signal", "(", "B", "T", ")", ".", "y", "(", "Tensor", ")", ":", "Groundtruth", "signal", "(", "B", "T", ")", ".", "input_lengths", "(", "Tensor", ")"...
def forward(self, *, x, y, input_lengths=None): """Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). y (Tensor): Groundtruth signal (B, T). input_lengths (Tensor): Length of groundtruth sample in samples (B). Returns: List[T...
[ "def", "forward", "(", "self", ",", "*", ",", "x", ",", "y", ",", "input_lengths", "=", "None", ")", ":", "sc_loss", "=", "[", "0.0", "]", "*", "len", "(", "self", ".", "stft_losses", ")", "mag_loss", "=", "[", "0.0", "]", "*", "len", "(", "sel...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/tts/losses/stftlosses.py#L230-L247
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/collections.py
python
OrderedDict.__reduce__
(self)
return self.__class__, (items,)
Return state information for pickling
Return state information for pickling
[ "Return", "state", "information", "for", "pickling" ]
def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return ...
[ "def", "__reduce__", "(", "self", ")", ":", "items", "=", "[", "[", "k", ",", "self", "[", "k", "]", "]", "for", "k", "in", "self", "]", "inst_dict", "=", "vars", "(", "self", ")", ".", "copy", "(", ")", "for", "k", "in", "vars", "(", "Ordere...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/collections.py#L182-L190
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/lib2to3/pytree.py
python
WildcardPattern._recursive_matches
(self, nodes, count)
Helper to recursively yield the matches.
Helper to recursively yield the matches.
[ "Helper", "to", "recursively", "yield", "the", "matches", "." ]
def _recursive_matches(self, nodes, count): """Helper to recursively yield the matches.""" assert self.content is not None if count >= self.min: yield 0, {} if count < self.max: for alt in self.content: for c0, r0 in generate_matches(alt, nodes): ...
[ "def", "_recursive_matches", "(", "self", ",", "nodes", ",", "count", ")", ":", "assert", "self", ".", "content", "is", "not", "None", "if", "count", ">=", "self", ".", "min", ":", "yield", "0", ",", "{", "}", "if", "count", "<", "self", ".", "max"...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib2to3/pytree.py#L812-L824
cloudant/bigcouch
8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe
couchjs/scons/scons-local-2.0.1/SCons/compat/_scons_sets.py
python
BaseSet.__contains__
(self, element)
Report whether an element is a member of a set. (Called in response to the expression `element in self'.)
Report whether an element is a member of a set.
[ "Report", "whether", "an", "element", "is", "a", "member", "of", "a", "set", "." ]
def __contains__(self, element): """Report whether an element is a member of a set. (Called in response to the expression `element in self'.) """ try: return element in self._data except TypeError: transform = getattr(element, "__as_temporarily_immutable_...
[ "def", "__contains__", "(", "self", ",", "element", ")", ":", "try", ":", "return", "element", "in", "self", ".", "_data", "except", "TypeError", ":", "transform", "=", "getattr", "(", "element", ",", "\"__as_temporarily_immutable__\"", ",", "None", ")", "if...
https://github.com/cloudant/bigcouch/blob/8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe/couchjs/scons/scons-local-2.0.1/SCons/compat/_scons_sets.py#L272-L283
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_scattersmith.py
python
Scattersmith.fill
(self)
return self["fill"]
Sets the area to fill with a solid color. Use with `fillcolor` if not "none". scattersmith has a subset of the options available to scatter. "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. "tonext" fills the space between tw...
Sets the area to fill with a solid color. Use with `fillcolor` if not "none". scattersmith has a subset of the options available to scatter. "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. "tonext" fills the space between tw...
[ "Sets", "the", "area", "to", "fill", "with", "a", "solid", "color", ".", "Use", "with", "fillcolor", "if", "not", "none", ".", "scattersmith", "has", "a", "subset", "of", "the", "options", "available", "to", "scatter", ".", "toself", "connects", "the", "...
def fill(self): """ Sets the area to fill with a solid color. Use with `fillcolor` if not "none". scattersmith has a subset of the options available to scatter. "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape....
[ "def", "fill", "(", "self", ")", ":", "return", "self", "[", "\"fill\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_scattersmith.py#L152-L172
timothycrosley/deprecated.pies
83405a8e45904e9b16b2681c15419735e654a0a6
pies/_utils.py
python
with_metaclass
(meta, *bases)
return metaclass('temporary_class', None, {})
Enables use of meta classes across Python Versions. taken from jinja2/_compat.py. Use it like this:: class BaseForm(object): pass class FormType(type): pass class Form(with_metaclass(FormType, BaseForm)): pass
Enables use of meta classes across Python Versions. taken from jinja2/_compat.py.
[ "Enables", "use", "of", "meta", "classes", "across", "Python", "Versions", ".", "taken", "from", "jinja2", "/", "_compat", ".", "py", "." ]
def with_metaclass(meta, *bases): """Enables use of meta classes across Python Versions. taken from jinja2/_compat.py. Use it like this:: class BaseForm(object): pass class FormType(type): pass class Form(with_metaclass(FormType, BaseForm)): pass ...
[ "def", "with_metaclass", "(", "meta", ",", "*", "bases", ")", ":", "class", "metaclass", "(", "meta", ")", ":", "__call__", "=", "type", ".", "__call__", "__init__", "=", "type", ".", "__init__", "def", "__new__", "(", "cls", ",", "name", ",", "this_ba...
https://github.com/timothycrosley/deprecated.pies/blob/83405a8e45904e9b16b2681c15419735e654a0a6/pies/_utils.py#L26-L48
seopbo/nlp_classification
21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf
Stochastic_Answer_Networks_for_Natural_Language_Inference/model/data.py
python
Corpus.__init__
(self, filepath: str, transform_fn: Callable[[str], List[int]])
Instantiating Corpus class Args: filepath (str): filepath transform_fn (Callable): a function that can act as a transformer
Instantiating Corpus class
[ "Instantiating", "Corpus", "class" ]
def __init__(self, filepath: str, transform_fn: Callable[[str], List[int]]) -> None: """Instantiating Corpus class Args: filepath (str): filepath transform_fn (Callable): a function that can act as a transformer """ self._corpus = pd.read_csv(filepath, sep="\t") ...
[ "def", "__init__", "(", "self", ",", "filepath", ":", "str", ",", "transform_fn", ":", "Callable", "[", "[", "str", "]", ",", "List", "[", "int", "]", "]", ")", "->", "None", ":", "self", ".", "_corpus", "=", "pd", ".", "read_csv", "(", "filepath",...
https://github.com/seopbo/nlp_classification/blob/21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf/Stochastic_Answer_Networks_for_Natural_Language_Inference/model/data.py#L11-L19
iocast/featureserver
2828532294fe232f1ddf358cfbd2cc81af102e56
vectorformats/lib/shapefile.py
python
Reader.load
(self, shapefile=None)
Opens a shapefile from a filename or file-like object. Normally this method would be called by the constructor with the file object or file name as an argument.
Opens a shapefile from a filename or file-like object. Normally this method would be called by the constructor with the file object or file name as an argument.
[ "Opens", "a", "shapefile", "from", "a", "filename", "or", "file", "-", "like", "object", ".", "Normally", "this", "method", "would", "be", "called", "by", "the", "constructor", "with", "the", "file", "object", "or", "file", "name", "as", "an", "argument", ...
def load(self, shapefile=None): """Opens a shapefile from a filename or file-like object. Normally this method would be called by the constructor with the file object or file name as an argument.""" if shapefile: (shapeName, ext) = os.path.splitext(shapefile) ...
[ "def", "load", "(", "self", ",", "shapefile", "=", "None", ")", ":", "if", "shapefile", ":", "(", "shapeName", ",", "ext", ")", "=", "os", ".", "path", ".", "splitext", "(", "shapefile", ")", "self", ".", "shapeName", "=", "shapeName", "try", ":", ...
https://github.com/iocast/featureserver/blob/2828532294fe232f1ddf358cfbd2cc81af102e56/vectorformats/lib/shapefile.py#L153-L176
googleapis/google-api-python-client
f48a01fde4dae27aa62412364f47411684562d23
googleapiclient/model.py
python
BaseModel.deserialize
(self, content)
Perform the actual deserialization from response string to Python object. Args: content: string, the body of the HTTP response Returns: The body de-serialized as a Python object.
Perform the actual deserialization from response string to Python object.
[ "Perform", "the", "actual", "deserialization", "from", "response", "string", "to", "Python", "object", "." ]
def deserialize(self, content): """Perform the actual deserialization from response string to Python object. Args: content: string, the body of the HTTP response Returns: The body de-serialized as a Python object. """ _abstract()
[ "def", "deserialize", "(", "self", ",", "content", ")", ":", "_abstract", "(", ")" ]
https://github.com/googleapis/google-api-python-client/blob/f48a01fde4dae27aa62412364f47411684562d23/googleapiclient/model.py#L234-L244
TUDelft-CNS-ATM/bluesky
55a538a3cd936f33cff9df650c38924aa97557b1
bluesky/traffic/asas/mvp.py
python
MVP.resolve
(self, conf, ownship, intruder)
return newtrack, newgscapped, vscapped, alt
Resolve all current conflicts
Resolve all current conflicts
[ "Resolve", "all", "current", "conflicts" ]
def resolve(self, conf, ownship, intruder): ''' Resolve all current conflicts ''' # Initialize an array to store the resolution velocity vector for all A/C dv = np.zeros((ownship.ntraf, 3)) # Initialize an array to store time needed to resolve vertically timesolveV = np.ones(own...
[ "def", "resolve", "(", "self", ",", "conf", ",", "ownship", ",", "intruder", ")", ":", "# Initialize an array to store the resolution velocity vector for all A/C", "dv", "=", "np", ".", "zeros", "(", "(", "ownship", ".", "ntraf", ",", "3", ")", ")", "# Initializ...
https://github.com/TUDelft-CNS-ATM/bluesky/blob/55a538a3cd936f33cff9df650c38924aa97557b1/bluesky/traffic/asas/mvp.py#L162-L265
chainer/chainercv
7159616642e0be7c5b3ef380b848e16b7e99355b
examples/senet/caffe2npz.py
python
main
()
[]
def main(): parser = argparse.ArgumentParser() parser.add_argument( 'model_name', choices=( 'se-resnet50', 'se-resnet101', 'se-resnet152', 'se-resnext50', 'se-resnext101', )) parser.add_argument('caffemodel') parser.add_argument('output', nargs='?', default=None)...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'model_name'", ",", "choices", "=", "(", "'se-resnet50'", ",", "'se-resnet101'", ",", "'se-resnet152'", ",", "'se-resnext50'", ",", ...
https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/examples/senet/caffe2npz.py#L143-L181
CellProfiler/CellProfiler
a90e17e4d258c6f3900238be0f828e0b4bd1b293
cellprofiler/gui/imagesetctrl.py
python
ColLabelRenderer.remove_icon_rect
(self, rect, label_size, last)
return self.get_icon_rect(rect, label_size, 3 if last else 2, last, False)
The position of the remove button
The position of the remove button
[ "The", "position", "of", "the", "remove", "button" ]
def remove_icon_rect(self, rect, label_size, last): """The position of the remove button""" return self.get_icon_rect(rect, label_size, 3 if last else 2, last, False)
[ "def", "remove_icon_rect", "(", "self", ",", "rect", ",", "label_size", ",", "last", ")", ":", "return", "self", ".", "get_icon_rect", "(", "rect", ",", "label_size", ",", "3", "if", "last", "else", "2", ",", "last", ",", "False", ")" ]
https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/gui/imagesetctrl.py#L1316-L1318
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/imaplib.py
python
IMAP4.status
(self, mailbox, names)
return self._untagged_response(typ, dat, name)
Request named status conditions for mailbox. (typ, [data]) = <instance>.status(mailbox, names)
Request named status conditions for mailbox.
[ "Request", "named", "status", "conditions", "for", "mailbox", "." ]
def status(self, mailbox, names): """Request named status conditions for mailbox. (typ, [data]) = <instance>.status(mailbox, names) """ name = 'STATUS' #if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide! # raise self.error('%s unimplemented in IMAP4 (obta...
[ "def", "status", "(", "self", ",", "mailbox", ",", "names", ")", ":", "name", "=", "'STATUS'", "#if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide!", "# raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name)", "typ", ",", "dat", ...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/imaplib.py#L759-L768
myano/jenni
d2e9f86b4d0826f43806bf6baf134147500027db
configs.py
python
Configs.__init__
(self, config_paths)
[]
def __init__(self, config_paths): self.config_paths = config_paths
[ "def", "__init__", "(", "self", ",", "config_paths", ")", ":", "self", ".", "config_paths", "=", "config_paths" ]
https://github.com/myano/jenni/blob/d2e9f86b4d0826f43806bf6baf134147500027db/configs.py#L19-L20
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txweb2/http_headers.py
python
HeaderHandler.addParser
(self, name, value)
Add an individual parser chain for the given header. @param name: Name of the header to add @type name: C{str} @param value: The parser chain @type value: C{str}
Add an individual parser chain for the given header.
[ "Add", "an", "individual", "parser", "chain", "for", "the", "given", "header", "." ]
def addParser(self, name, value): """Add an individual parser chain for the given header. @param name: Name of the header to add @type name: C{str} @param value: The parser chain @type value: C{str} """ self.updateParsers({name: value})
[ "def", "addParser", "(", "self", ",", "name", ",", "value", ")", ":", "self", ".", "updateParsers", "(", "{", "name", ":", "value", "}", ")" ]
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txweb2/http_headers.py#L145-L154
biocore/qiime
76d633c0389671e93febbe1338b5ded658eba31f
qiime/biplots.py
python
scale_taxa_data_matrix
(coords, pct_var)
return coords[:, :len(pct_var)] * (pct_var / pct_var.max())
Scales pc data matrix by percent variation
Scales pc data matrix by percent variation
[ "Scales", "pc", "data", "matrix", "by", "percent", "variation" ]
def scale_taxa_data_matrix(coords, pct_var): """Scales pc data matrix by percent variation""" return coords[:, :len(pct_var)] * (pct_var / pct_var.max())
[ "def", "scale_taxa_data_matrix", "(", "coords", ",", "pct_var", ")", ":", "return", "coords", "[", ":", ",", ":", "len", "(", "pct_var", ")", "]", "*", "(", "pct_var", "/", "pct_var", ".", "max", "(", ")", ")" ]
https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/biplots.py#L144-L146
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/cluster/vq.py
python
_kmeans
(obs, guess, thresh=1e-5)
return code_book, avg_dist[-1]
"raw" version of k-means. Returns ------- code_book the lowest distortion codebook found. avg_dist the average distance a observation is from a code in the book. Lower means the code_book matches the data better. See Also -------- kmeans : wrapper around k-means ...
"raw" version of k-means.
[ "raw", "version", "of", "k", "-", "means", "." ]
def _kmeans(obs, guess, thresh=1e-5): """ "raw" version of k-means. Returns ------- code_book the lowest distortion codebook found. avg_dist the average distance a observation is from a code in the book. Lower means the code_book matches the data better. See Also --...
[ "def", "_kmeans", "(", "obs", ",", "guess", ",", "thresh", "=", "1e-5", ")", ":", "code_book", "=", "array", "(", "guess", ",", "copy", "=", "True", ")", "avg_dist", "=", "[", "]", "diff", "=", "thresh", "+", "1.", "while", "diff", ">", "thresh", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/cluster/vq.py#L387-L435
pycassa/pycassa
b314d5fa4e6ba1219850f50d767aa0be5ed5ca5f
pycassa/cassandra/Cassandra.py
python
Iface.add
(self, key, column_parent, column, consistency_level)
Increment or decrement a counter. Parameters: - key - column_parent - column - consistency_level
Increment or decrement a counter.
[ "Increment", "or", "decrement", "a", "counter", "." ]
def add(self, key, column_parent, column, consistency_level): """ Increment or decrement a counter. Parameters: - key - column_parent - column - consistency_level """ pass
[ "def", "add", "(", "self", ",", "key", ",", "column_parent", ",", "column", ",", "consistency_level", ")", ":", "pass" ]
https://github.com/pycassa/pycassa/blob/b314d5fa4e6ba1219850f50d767aa0be5ed5ca5f/pycassa/cassandra/Cassandra.py#L146-L156
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/asr/parts/submodules/rnnt_beam_decoding.py
python
BeamRNNTInfer.align_length_sync_decoding
( self, h: torch.Tensor, encoded_lengths: torch.Tensor, partial_hypotheses: Optional[Hypothesis] = None )
Alignment-length synchronous beam search implementation. Based on https://ieeexplore.ieee.org/document/9053040 Args: h: Encoded speech features (1, T_max, D_enc) Returns: nbest_hyps: N-best decoding results
Alignment-length synchronous beam search implementation. Based on https://ieeexplore.ieee.org/document/9053040
[ "Alignment", "-", "length", "synchronous", "beam", "search", "implementation", ".", "Based", "on", "https", ":", "//", "ieeexplore", ".", "ieee", ".", "org", "/", "document", "/", "9053040" ]
def align_length_sync_decoding( self, h: torch.Tensor, encoded_lengths: torch.Tensor, partial_hypotheses: Optional[Hypothesis] = None ) -> List[Hypothesis]: """Alignment-length synchronous beam search implementation. Based on https://ieeexplore.ieee.org/document/9053040 Args: ...
[ "def", "align_length_sync_decoding", "(", "self", ",", "h", ":", "torch", ".", "Tensor", ",", "encoded_lengths", ":", "torch", ".", "Tensor", ",", "partial_hypotheses", ":", "Optional", "[", "Hypothesis", "]", "=", "None", ")", "->", "List", "[", "Hypothesis...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/asr/parts/submodules/rnnt_beam_decoding.py#L712-L894
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_openshift_3.2/library/oc_route.py
python
OCRoute.route
(self, data)
setter function for yedit var
setter function for yedit var
[ "setter", "function", "for", "yedit", "var" ]
def route(self, data): ''' setter function for yedit var ''' self._route = data
[ "def", "route", "(", "self", ",", "data", ")", ":", "self", ".", "_route", "=", "data" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oc_route.py#L1063-L1065
ros/ros_comm
52b0556dadf3ec0c0bc72df4fc202153a53b539e
clients/rospy/src/rospy/msg.py
python
AnyMsg.serialize
(self, buff)
AnyMsg provides an implementation so that a node can forward messages w/o (de)serialization
AnyMsg provides an implementation so that a node can forward messages w/o (de)serialization
[ "AnyMsg", "provides", "an", "implementation", "so", "that", "a", "node", "can", "forward", "messages", "w", "/", "o", "(", "de", ")", "serialization" ]
def serialize(self, buff): """AnyMsg provides an implementation so that a node can forward messages w/o (de)serialization""" if self._buff is None: raise rospy.exceptions.ROSException("AnyMsg is not initialized") else: buff.write(self._buff)
[ "def", "serialize", "(", "self", ",", "buff", ")", ":", "if", "self", ".", "_buff", "is", "None", ":", "raise", "rospy", ".", "exceptions", ".", "ROSException", "(", "\"AnyMsg is not initialized\"", ")", "else", ":", "buff", ".", "write", "(", "self", "....
https://github.com/ros/ros_comm/blob/52b0556dadf3ec0c0bc72df4fc202153a53b539e/clients/rospy/src/rospy/msg.py#L69-L74
PaddlePaddle/PaddleSpeech
26524031d242876b7fdb71582b0b3a7ea45c7d9d
paddlespeech/s2t/training/updaters/standard_updater.py
python
StandardUpdater.update_core
(self, batch)
A simple case for a training step. Basic assumptions are: Single model; Single optimizer; Single scheduler, and update learning rate each step; A batch from the dataloader is just the input of the model; The model return a single loss, or a dict containing serval losses. ...
A simple case for a training step. Basic assumptions are: Single model; Single optimizer; Single scheduler, and update learning rate each step; A batch from the dataloader is just the input of the model; The model return a single loss, or a dict containing serval losses. ...
[ "A", "simple", "case", "for", "a", "training", "step", ".", "Basic", "assumptions", "are", ":", "Single", "model", ";", "Single", "optimizer", ";", "Single", "scheduler", "and", "update", "learning", "rate", "each", "step", ";", "A", "batch", "from", "the"...
def update_core(self, batch): """A simple case for a training step. Basic assumptions are: Single model; Single optimizer; Single scheduler, and update learning rate each step; A batch from the dataloader is just the input of the model; The model return a single loss, or ...
[ "def", "update_core", "(", "self", ",", "batch", ")", ":", "loss", "=", "self", ".", "model", "(", "*", "batch", ")", "if", "isinstance", "(", "loss", ",", "paddle", ".", "Tensor", ")", ":", "loss_dict", "=", "{", "\"main\"", ":", "loss", "}", "els...
https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/s2t/training/updaters/standard_updater.py#L118-L146
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/Django-1.11.29/django/db/backends/base/base.py
python
BaseDatabaseWrapper._start_transaction_under_autocommit
(self)
Only required when autocommits_when_autocommit_is_off = True.
Only required when autocommits_when_autocommit_is_off = True.
[ "Only", "required", "when", "autocommits_when_autocommit_is_off", "=", "True", "." ]
def _start_transaction_under_autocommit(self): """ Only required when autocommits_when_autocommit_is_off = True. """ raise NotImplementedError( 'subclasses of BaseDatabaseWrapper may require a ' '_start_transaction_under_autocommit() method' )
[ "def", "_start_transaction_under_autocommit", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'subclasses of BaseDatabaseWrapper may require a '", "'_start_transaction_under_autocommit() method'", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/db/backends/base/base.py#L616-L623
d2l-ai/d2l-zh
1c2e25a557db446b5691c18e595e5664cc254730
d2l/torch.py
python
Timer.stop
(self)
return self.times[-1]
停止计时器并将时间记录在列表中
停止计时器并将时间记录在列表中
[ "停止计时器并将时间记录在列表中" ]
def stop(self): """停止计时器并将时间记录在列表中""" self.times.append(time.time() - self.tik) return self.times[-1]
[ "def", "stop", "(", "self", ")", ":", "self", ".", "times", ".", "append", "(", "time", ".", "time", "(", ")", "-", "self", ".", "tik", ")", "return", "self", ".", "times", "[", "-", "1", "]" ]
https://github.com/d2l-ai/d2l-zh/blob/1c2e25a557db446b5691c18e595e5664cc254730/d2l/torch.py#L105-L108
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/source/source/pygments/lexers/ezhil.py
python
EzhilLexer.analyse_text
(text)
This language uses Tamil-script. We'll assume that if there's a decent amount of Tamil-characters, it's this language. This assumption is obviously horribly off if someone uses string literals in tamil in another language.
This language uses Tamil-script. We'll assume that if there's a decent amount of Tamil-characters, it's this language. This assumption is obviously horribly off if someone uses string literals in tamil in another language.
[ "This", "language", "uses", "Tamil", "-", "script", ".", "We", "ll", "assume", "that", "if", "there", "s", "a", "decent", "amount", "of", "Tamil", "-", "characters", "it", "s", "this", "language", ".", "This", "assumption", "is", "obviously", "horribly", ...
def analyse_text(text): """This language uses Tamil-script. We'll assume that if there's a decent amount of Tamil-characters, it's this language. This assumption is obviously horribly off if someone uses string literals in tamil in another language.""" if len(re.findall(r'[\u0b80...
[ "def", "analyse_text", "(", "text", ")", ":", "if", "len", "(", "re", ".", "findall", "(", "r'[\\u0b80-\\u0bff]'", ",", "text", ")", ")", ">", "10", ":", "return", "0.25" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/source/source/pygments/lexers/ezhil.py#L66-L72
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/util/introspect.py
python
this_list
()
From the Python Cookbook
From the Python Cookbook
[ "From", "the", "Python", "Cookbook" ]
def this_list(): ''' From the Python Cookbook ''' d = inspect.currentframe(1).f_locals nestlevel =1 while '_[%d]' % nestlevel in d: nestlevel +=1 result = d['_[%d]' %(nestlevel-1)] if version_23: return result.__self__ else: return result
[ "def", "this_list", "(", ")", ":", "d", "=", "inspect", ".", "currentframe", "(", "1", ")", ".", "f_locals", "nestlevel", "=", "1", "while", "'_[%d]'", "%", "nestlevel", "in", "d", ":", "nestlevel", "+=", "1", "result", "=", "d", "[", "'_[%d]'", "%",...
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/util/introspect.py#L92-L102
ddbourgin/numpy-ml
b0359af5285fbf9699d64fd5ec059493228af03e
numpy_ml/lda/lda_smoothed.py
python
SmoothedLDA.__init__
(self, T, **kwargs)
A smoothed LDA model trained using collapsed Gibbs sampling. Generates posterior mean estimates for model parameters `phi` and `theta`. Parameters ---------- T : int Number of topics Attributes ---------- D : int Number of documents ...
A smoothed LDA model trained using collapsed Gibbs sampling. Generates posterior mean estimates for model parameters `phi` and `theta`.
[ "A", "smoothed", "LDA", "model", "trained", "using", "collapsed", "Gibbs", "sampling", ".", "Generates", "posterior", "mean", "estimates", "for", "model", "parameters", "phi", "and", "theta", "." ]
def __init__(self, T, **kwargs): """ A smoothed LDA model trained using collapsed Gibbs sampling. Generates posterior mean estimates for model parameters `phi` and `theta`. Parameters ---------- T : int Number of topics Attributes ---------- ...
[ "def", "__init__", "(", "self", ",", "T", ",", "*", "*", "kwargs", ")", ":", "self", ".", "T", "=", "T", "self", ".", "alpha", "=", "(", "50.0", "/", "self", ".", "T", ")", "*", "np", ".", "ones", "(", "self", ".", "T", ")", "if", "\"alpha\...
https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/lda/lda_smoothed.py#L5-L40
lohriialo/photoshop-scripting-python
6b97da967a5d0a45e54f7c99631b29773b923f09
api_reference/photoshop_CC_2019.py
python
Layers.Item
(self, ItemKey=defaultNamedNotOptArg)
return ret
get an element from the collection
get an element from the collection
[ "get", "an", "element", "from", "the", "collection" ]
def Item(self, ItemKey=defaultNamedNotOptArg): 'get an element from the collection' ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey ) if ret is not None: ret = Dispatch(ret, u'Item', None) return ret
[ "def", "Item", "(", "self", ",", "ItemKey", "=", "defaultNamedNotOptArg", ")", ":", "ret", "=", "self", ".", "_oleobj_", ".", "InvokeTypes", "(", "0", ",", "LCID", ",", "2", ",", "(", "9", ",", "0", ")", ",", "(", "(", "12", ",", "1", ")", ",",...
https://github.com/lohriialo/photoshop-scripting-python/blob/6b97da967a5d0a45e54f7c99631b29773b923f09/api_reference/photoshop_CC_2019.py#L2306-L2312
mcneel/rhinoscriptsyntax
c49bd0bf24c2513bdcb84d1bf307144489600fd9
Scripts/rhinoscript/block.py
python
BlockInstanceInsertPoint
(object_id)
return pt
Returns the insertion point of a block instance. Parameters: object_id (guid): The identifier of an existing block insertion object Returns: point: The insertion 3D point if successful Example: import rhinoscriptsyntax as rs strObject = rs.GetObject("Select block") if rs.IsBloc...
Returns the insertion point of a block instance. Parameters: object_id (guid): The identifier of an existing block insertion object Returns: point: The insertion 3D point if successful Example: import rhinoscriptsyntax as rs strObject = rs.GetObject("Select block") if rs.IsBloc...
[ "Returns", "the", "insertion", "point", "of", "a", "block", "instance", ".", "Parameters", ":", "object_id", "(", "guid", ")", ":", "The", "identifier", "of", "an", "existing", "block", "insertion", "object", "Returns", ":", "point", ":", "The", "insertion",...
def BlockInstanceInsertPoint(object_id): """Returns the insertion point of a block instance. Parameters: object_id (guid): The identifier of an existing block insertion object Returns: point: The insertion 3D point if successful Example: import rhinoscriptsyntax as rs strObject =...
[ "def", "BlockInstanceInsertPoint", "(", "object_id", ")", ":", "instance", "=", "__InstanceObjectFromId", "(", "object_id", ",", "True", ")", "xf", "=", "instance", ".", "InstanceXform", "pt", "=", "Rhino", ".", "Geometry", ".", "Point3d", ".", "Origin", "pt",...
https://github.com/mcneel/rhinoscriptsyntax/blob/c49bd0bf24c2513bdcb84d1bf307144489600fd9/Scripts/rhinoscript/block.py#L180-L201
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/optparse.py
python
Values._update_careful
(self, dict)
Update the option values from an arbitrary dictionary, but only use keys from dict that already have a corresponding attribute in self. Any keys in dict without a corresponding attribute are silently ignored.
Update the option values from an arbitrary dictionary, but only use keys from dict that already have a corresponding attribute in self. Any keys in dict without a corresponding attribute are silently ignored.
[ "Update", "the", "option", "values", "from", "an", "arbitrary", "dictionary", "but", "only", "use", "keys", "from", "dict", "that", "already", "have", "a", "corresponding", "attribute", "in", "self", ".", "Any", "keys", "in", "dict", "without", "a", "corresp...
def _update_careful(self, dict): """ Update the option values from an arbitrary dictionary, but only use keys from dict that already have a corresponding attribute in self. Any keys in dict without a corresponding attribute are silently ignored. """ for attr in d...
[ "def", "_update_careful", "(", "self", ",", "dict", ")", ":", "for", "attr", "in", "dir", "(", "self", ")", ":", "if", "attr", "in", "dict", ":", "dval", "=", "dict", "[", "attr", "]", "if", "dval", "is", "not", "None", ":", "setattr", "(", "self...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/optparse.py#L843-L854
mfarragher/appelpy
6ba8b123abb8b4e9d5968841b8ce9eb5088d763b
appelpy/utils.py
python
DummyEncoder.__init__
(self, df, categorical_col_base_levels, *, nan_policy='row_of_zero', separator='_')
Initializes the DummyEncoder object.
Initializes the DummyEncoder object.
[ "Initializes", "the", "DummyEncoder", "object", "." ]
def __init__(self, df, categorical_col_base_levels, *, nan_policy='row_of_zero', separator='_'): "Initializes the DummyEncoder object." if separator == '#': raise ValueError( """'#' is reserved for interaction terms. Use a different character....
[ "def", "__init__", "(", "self", ",", "df", ",", "categorical_col_base_levels", ",", "*", ",", "nan_policy", "=", "'row_of_zero'", ",", "separator", "=", "'_'", ")", ":", "if", "separator", "==", "'#'", ":", "raise", "ValueError", "(", "\"\"\"'#' is reserved fo...
https://github.com/mfarragher/appelpy/blob/6ba8b123abb8b4e9d5968841b8ce9eb5088d763b/appelpy/utils.py#L114-L128
davidemms/OrthoFinder
d92c016ccb17be39787614018694844a2c673173
scripts_of/tree.py
python
TreeNode.traverse
(self, strategy="levelorder", is_leaf_fn=None)
Returns an iterator to traverse the tree structure under this node. :argument "levelorder" strategy: set the way in which tree will be traversed. Possible values are: "preorder" (first parent and then children) 'postorder' (first children and the parent) and "l...
Returns an iterator to traverse the tree structure under this node. :argument "levelorder" strategy: set the way in which tree will be traversed. Possible values are: "preorder" (first parent and then children) 'postorder' (first children and the parent) and "l...
[ "Returns", "an", "iterator", "to", "traverse", "the", "tree", "structure", "under", "this", "node", ".", ":", "argument", "levelorder", "strategy", ":", "set", "the", "way", "in", "which", "tree", "will", "be", "traversed", ".", "Possible", "values", "are", ...
def traverse(self, strategy="levelorder", is_leaf_fn=None): """ Returns an iterator to traverse the tree structure under this node. :argument "levelorder" strategy: set the way in which tree will be traversed. Possible values are: "preorder" (first parent ...
[ "def", "traverse", "(", "self", ",", "strategy", "=", "\"levelorder\"", ",", "is_leaf_fn", "=", "None", ")", ":", "if", "strategy", "==", "\"preorder\"", ":", "return", "self", ".", "_iter_descendants_preorder", "(", "is_leaf_fn", "=", "is_leaf_fn", ")", "elif...
https://github.com/davidemms/OrthoFinder/blob/d92c016ccb17be39787614018694844a2c673173/scripts_of/tree.py#L641-L665
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/basher/links_init.py
python
InitINILinks
()
Initialize INI Edits tab menus.
Initialize INI Edits tab menus.
[ "Initialize", "INI", "Edits", "tab", "menus", "." ]
def InitINILinks(): """Initialize INI Edits tab menus.""" #--Column Links # Sorting and Columns INIList.column_links.append(SortByMenu(sort_options=[INI_SortValid()])) INIList.column_links.append(ColumnsMenu()) INIList.column_links.append(SeparatorLink()) # Files Menu if True: fi...
[ "def", "InitINILinks", "(", ")", ":", "#--Column Links", "# Sorting and Columns", "INIList", ".", "column_links", ".", "append", "(", "SortByMenu", "(", "sort_options", "=", "[", "INI_SortValid", "(", ")", "]", ")", ")", "INIList", ".", "column_links", ".", "a...
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/basher/links_init.py#L374-L409
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py
python
NbSetWeight.weight
(self, nb_set, structure_environments, cn_map=None, additional_info=None)
Get the weight of a given neighbors set. :param nb_set: Neighbors set. :param structure_environments: Structure environments used to estimate weight. :param cn_map: Mapping index for this neighbors set. :param additional_info: Additional information. :return: Weight of the neigh...
Get the weight of a given neighbors set.
[ "Get", "the", "weight", "of", "a", "given", "neighbors", "set", "." ]
def weight(self, nb_set, structure_environments, cn_map=None, additional_info=None): """Get the weight of a given neighbors set. :param nb_set: Neighbors set. :param structure_environments: Structure environments used to estimate weight. :param cn_map: Mapping index for this neighbors s...
[ "def", "weight", "(", "self", ",", "nb_set", ",", "structure_environments", ",", "cn_map", "=", "None", ",", "additional_info", "=", "None", ")", ":", "pass" ]
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py#L1241-L1250
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/ipywidgets-4.1.1-py3.3.egg/ipywidgets/__init__.py
python
register_comm_target
(kernel=None)
Register the ipython.widget comm target
Register the ipython.widget comm target
[ "Register", "the", "ipython", ".", "widget", "comm", "target" ]
def register_comm_target(kernel=None): """Register the ipython.widget comm target""" if kernel is None: ip = get_ipython().kernel kernel.comm_manager.register_target('ipython.widget', Widget.handle_comm_opened)
[ "def", "register_comm_target", "(", "kernel", "=", "None", ")", ":", "if", "kernel", "is", "None", ":", "ip", "=", "get_ipython", "(", ")", ".", "kernel", "kernel", ".", "comm_manager", ".", "register_target", "(", "'ipython.widget'", ",", "Widget", ".", "...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/ipywidgets-4.1.1-py3.3.egg/ipywidgets/__init__.py#L21-L25
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/socketserver.py
python
BaseServer.finish_request
(self, request, client_address)
Finish one request by instantiating RequestHandlerClass.
Finish one request by instantiating RequestHandlerClass.
[ "Finish", "one", "request", "by", "instantiating", "RequestHandlerClass", "." ]
def finish_request(self, request, client_address): """Finish one request by instantiating RequestHandlerClass.""" self.RequestHandlerClass(request, client_address, self)
[ "def", "finish_request", "(", "self", ",", "request", ",", "client_address", ")", ":", "self", ".", "RequestHandlerClass", "(", "request", ",", "client_address", ",", "self", ")" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/socketserver.py#L343-L345