%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyo

�
+�{Wc@�s�dZddlmZmZmZmZddlZeded��sad�Z	e
Ze
Znd�Z	e
ZeZd�ZeZejdkr�d	dUnd
dUd�Zdefd
��YZd�ZdS(s�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`.
i(tabsolute_importtdivisiontprint_functiontwith_statementNtcC�s|S(N((ts((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pytuscC�s
|jd�S(Ntunicode_escape(tdecode(R((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyRscC�s�t|t�r-ttk	r-|jd�}n|jd�dkrRt|dd�S|jd�}tdj|d �dd|dgd�}yt	||d�SWn%t
k
r�td|d��nXdS(s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
    sutf-8t.ii����sNo module named %sN(t
isinstancetunicode_typetstrtencodetcountt
__import__tNonetsplittjointgetattrtAttributeErrortImportError(tnametpartstobj((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyt
import_object%s,
is�
def raise_exc_info(exc_info):
    raise exc_info[1].with_traceback(exc_info[2])

def exec_in(code, glob, loc=None):
    if isinstance(code, str):
        code = compile(code, '<string>', 'exec', dont_inherit=True)
    exec(code, glob, loc)
sh
def raise_exc_info(exc_info):
    raise exc_info[0], exc_info[1], exc_info[2]

def exec_in(code, glob, loc=None):
    if isinstance(code, basestring):
        # exec(string) inherits the caller's future imports; compile
        # the string first to prevent that.
        code = compile(code, '<string>', 'exec', dont_inherit=True)
    exec code in glob, loc
cC�s2t|d�r|jS|jr*|jdSdSdS(sLProvides 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 instantiates 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.
    terrnoiN(thasattrRtargsR(te((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyterrno_from_exceptionas

	tConfigurablecB�s�eZdZd	Zd	Zd�Zed��Zed��Z	d�Z
ed��Zed��Zed��Z
ed��ZRS(
s�Base class for configurable interfaces.

    A configurable interface is an (abstract) class whose constructor
    acts as a factory function for one of its implementation subclasses.
    The implementation subclass as well as optional keyword arguments to
    its initializer can be set globally at runtime with `configure`.

    By using the constructor as the factory method, the interface
    looks like a normal class, `isinstance` works as usual, etc.  This
    pattern is most useful when the choice of implementation is likely
    to be a global decision (e.g. when `~select.epoll` is available,
    always use it instead of `~select.select`), or when a
    previously-monolithic class has been split into specialized
    subclasses.

    Configurable subclasses must define the class methods
    `configurable_base` and `configurable_default`, and use the instance
    method `initialize` instead of ``__init__``.
    cO�s�|j�}i}||krI|j�}|jrO|j|j�qOn|}|j|�tt|�j|�}|j||�|S(N(tconfigurable_basetconfigured_classt_Configurable__impl_kwargstupdatetsuperRt__new__t
initialize(tclsRtkwargstbasetinit_kwargstimpltinstance((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyR%�s	
cC�s
t��dS(s�Returns the base class of a configurable hierarchy.

        This will normally return the class in which it is defined.
        (which is *not* necessarily the same as the cls classmethod parameter).
        N(tNotImplementedError(R'((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyR �scC�s
t��dS(sBReturns the implementation class to be used if none is configured.N(R-(R'((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pytconfigurable_default�scC�sdS(s�Initialize a `Configurable` subclass instance.

        Configurable classes should use `initialize` instead of ``__init__``.

        .. versionchanged:: 4.2
           Now accepts positional arguments in addition to keyword arguments.
        N((tself((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyR&�scK�su|j�}t|ttf�r0t|�}n|dk	r_t||�r_td|��n||_||_	dS(s�Sets the class to use when the base class is instantiated.

        Keyword arguments will be saved and added to the arguments passed
        to the constructor.  This can be used to set global defaults for
        some parameters.
        sInvalid subclass of %sN(
R R
RtbytesRRt
issubclasst
ValueErrort_Configurable__impl_classR"(R'R+R(R)((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyt	configure�s	cC�s4|j�}|jdkr-|j�|_n|jS(s'Returns the currently configured class.N(R R3RR.(R'R)((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyR!�scC�s|j�}|j|jfS(N(R R3R"(R'R)((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyt_save_configuration�scC�s*|j�}|d|_|d|_dS(Nii(R R3R"(R'tsavedR)((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyt_restore_configuration�s
N(t__name__t
__module__t__doc__RR3R"R%tclassmethodR R.R&R4R!R5R7(((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyRss				cC�s+|j|j|jdddtd�S(s<Equivalent to td.total_seconds() (introduced in python 2.7).iii
ii@Bi@B(tmicrosecondstsecondstdaystfloat(ttd((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyttimedelta_to_seconds�s(i(R:t
__future__RRRRtsysR
ttypeRRRtbasestring_typetunicodet
basestringRR0t
bytes_typetversion_infoRtobjectRRA(((sD/usr/lib64/python2.7/site-packages/zmq/eventloop/minitornado/util.pyt<module>s""				"		c

Zerion Mini Shell 1.0