Classes | |
class | ArgReplacer |
class | Configurable |
class | GzipDecompressor |
class | ObjectDict |
Functions | |
def | _websocket_mask_python |
def | doctests |
def | errno_from_exception |
def | import_object |
def | timedelta_to_seconds |
def | u |
Variables | |
_websocket_mask = _websocket_mask_python | |
basestring_type = str | |
bytes_type = bytes | |
unicode_type = str | |
xrange = range |
Miscellaneous utility functions and classes. This module is used internally by Tornado. It is not necessarily expected that the functions and classes defined here will be useful to other applications, but they are documented here in case they are. The one public-facing part of this module is the `Configurable` class and its `~Configurable.configure` method, which becomes a part of the interface of its subclasses, including `.AsyncHTTPClient`, `.IOLoop`, and `.Resolver`.
def tornado.util._websocket_mask_python | ( | mask, | |
data | |||
) | [private] |
Websocket masking function. `mask` is a `bytes` object of length 4; `data` is a `bytes` object of any length. Returns a `bytes` object of the same length as `data` with the mask applied as specified in section 5.3 of RFC 6455. This pure-python implementation may be replaced by an optimized version when available.
def tornado.util.doctests | ( | ) |
def tornado.util.errno_from_exception | ( | e | ) |
Provides the errno from an Exception object. There are cases that the errno attribute was not set so we pull the errno out of the args but if someone instatiates an Exception without any args you will get a tuple error. So this function abstracts all that behavior to give you a safe way to get the errno.
def tornado.util.import_object | ( | name | ) |
Imports an object by name. import_object('x') is equivalent to 'import x'. import_object('x.y.z') is equivalent to 'from x.y import z'. >>> import tornado.escape >>> import_object('tornado.escape') is tornado.escape True >>> import_object('tornado.escape.utf8') is tornado.escape.utf8 True >>> import_object('tornado') is tornado True >>> import_object('tornado.missing_module') Traceback (most recent call last): ... ImportError: No module named missing_module
def tornado.util.timedelta_to_seconds | ( | td | ) |
def tornado::util::u | ( | s | ) |
tornado::util::bytes_type = bytes |
tornado::util::xrange = range |