Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.6/site-packages/future/utils/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.6/site-packages/future/utils/__pycache__/__init__.cpython-36.pyc

3

�uGh�U�:@sdZddlZddlZddlZddlZddlZddlZejddkZejdd�d�kZ	ejdd�d�kZ
ejdd�d�kZejdd�d�kZejdd�d�kZ
ejdd�d�kZejddkZejdd�d�kZejdd�d�kZeed�Zdd
�Zdd�Ze�r4dd�Zdd�Zdd�ZefZefZefZeZe Z!n8dd�Zdd�Zdd�Ze"fZee#fZeej$fZe%ZeZ!e�r|dd�Z&ndd�Z&de&_e�r�d�dd�Z'd�d d!�Z(d�d"d#�Z)nd�d$d�Z'd�d%d!�Z(d�d'd#�Z)d(e'_e�r�d)d*�Z*d+d,�Z+d-d.�Z,d/d0�Z-n ddl.Z.e.j/Z*e.j0Z+e.j1Z,e.j2Z-d�d2d3�Z3d4d5�Z4d6d7�Z5d8d9�Z6d:d;�Z7d<d=�Z8d>d?�Z9d@dA�Z:dBdC�Z;dDdE�Z<dFdG�Z=e�r�dHdI�Z>d�dJdK�Z?e@fdLdM�ZAndNdI�Z>eBdOjC��dPeA_e?ZDdQdR�ZEe�r�dSdT�ZFndUdT�ZFdVdW�ZGdXdY�ZHeZIe ZJdZd[�ZKd\d]�ZLd^d_�ZMd`da�ZNdbdc�ZOe�r4ddlPZPeQePdd�ZRn
d�dedf�ZRdgdh�ZSd�didj�ZTy
eUj7Wn&eVk
�r�dkdl�ZWdmdn�ZXYnXdodl�ZWdpdn�ZXe�r�dqdr�ZYndsdr�ZYdtdudvdwdjdxdAddd!dydWdrdfdzdCdRd{dYd]d3dad_d[d;d=d?d0dndld.d*d,dcd|d}ddhd
dKdMd~dd#d�dd5d7d9dg2ZZdS)�a�
A selection of cross-compatible functions for Python 2 and 3.

This module exports useful functions for 2/3 compatible code:

    * bind_method: binds functions to classes
    * ``native_str_to_bytes`` and ``bytes_to_native_str``
    * ``native_str``: always equal to the native platform string object (because
      this may be shadowed by imports from future.builtins)
    * lists: lrange(), lmap(), lzip(), lfilter()
    * iterable method compatibility:
        - iteritems, iterkeys, itervalues
        - viewitems, viewkeys, viewvalues

        These use the original method if available, otherwise they use items,
        keys, values.

    * types:

        * text_type: unicode in Python 2, str in Python 3
        * string_types: basestring in Python 2, str in Python 3
        * binary_type: str in Python 2, bytes in Python 3
        * integer_types: (int, long) in Python 2, int in Python 3
        * class_types: (type, types.ClassType) in Python 2, type in Python 3

    * bchr(c):
        Take an integer and make a 1-character byte string
    * bord(c)
        Take the result of indexing on a byte string and make an integer
    * tobytes(s)
        Take a text string, a byte string, or a sequence of characters taken
        from a byte string, and make a byte string.

    * raise_from()
    * raise_with_traceback()

This module also defines these decorators:

    * ``python_2_unicode_compatible``
    * ``with_metaclass``
    * ``implements_iterator``

Some of the functions in this module come from the following sources:

    * Jinja2 (BSD licensed: see
      https://github.com/mitsuhiko/jinja2/blob/master/LICENSE)
    * Pandas compatibility module pandas.compat
    * six.py by Benjamin Peterson
    * Django
�N��������	Zpypy_translation_infocCsts|j|_dd�|_|S)u�
    A decorator that defines __unicode__ and __str__ methods under Python
    2. Under Python 3, this decorator is a no-op.

    To support Python 2 and 3 with a single code base, define a __str__
    method returning unicode text and apply this decorator to the class, like
    this::

    >>> from future.utils import python_2_unicode_compatible

    >>> @python_2_unicode_compatible
    ... class MyClass(object):
    ...     def __str__(self):
    ...         return u'Unicode string: 孔子'

    >>> a = MyClass()

    Then, after this import:

    >>> from future.builtins import str

    the following is ``True`` on both Python 3 and 2::

    >>> str(a) == a.encode('utf-8').decode('utf-8')
    True

    and, on a Unicode-enabled terminal with the right fonts, these both print the
    Chinese characters for Confucius::

    >>> print(a)
    >>> print(str(a))

    The implementation comes from django.utils.encoding.
    cSs|j�jd�S)Nzutf-8)�__unicode__�encode)�self�r
�</root/tmp/pip-build-gzoz1_uw/future/future/utils/__init__.py�<lambda>nsz-python_2_unicode_compatible.<locals>.<lambda>)�PY3�__str__r
)�clsr
r
r�python_2_unicode_compatibleIs#
rcs"G��fdd�d��}|ddi�S)a�
    Function from jinja2/_compat.py. License: BSD.

    Use it like this::

        class BaseForm(object):
            pass

        class FormType(type):
            pass

        class Form(with_metaclass(FormType, BaseForm)):
            pass

    This requires a bit of explanation: the basic idea is to make a
    dummy metaclass for one level of class instantiation that replaces
    itself with the actual metaclass.  Because of internal type checks
    we also need to make sure that we downgrade the custom metaclass
    for one level to something closer to type (that's why __call__ and
    __init__ comes back from type etc.).

    This has the advantage over six.with_metaclass of not introducing
    dummy classes into the final MRO.
    cs&eZdZejZejZ��fdd�ZdS)z!with_metaclass.<locals>.metaclasscs$|dkrtj||f|�S�|�|�S)N)�type�__new__)r�name�
this_bases�d)�bases�metar
rr�sz)with_metaclass.<locals>.metaclass.__new__N)�__name__�
__module__�__qualname__r�__call__�__init__rr
)rrr
r�	metaclass�sr �temporary_classNr
)rrr r
)rrr�with_metaclassrsr"cCs
t|g�S)N)�bytes)�sr
r
r�bchr�sr%cCs t|t�rt|d�St|�SdS)Nzlatin-1)�
isinstance�strr#)r$r
r
r�bstr�s

r(cCs|S)Nr
)r$r
r
r�bord�sr)cCst|�S)N)�chr)r$r
r
rr%�scCst|�S)N)r')r$r
r
rr(�scCst|�S)N)�ord)r$r
r
rr)�scCs.t|t�r|St|t�r"|jd�St|�SdS)Nzlatin-1)r&r#r'r)r$r
r
r�tobytes�s



r,cCs"t|t�r|jd�Sdj|�SdS)Nzlatin-1�)r&�unicoder�join)r$r
r
rr,�s

zS
    Encodes to latin-1 (where the first 256 chars are the same as
    ASCII.)
    �utf-8cCs
|j|�S)N)r)r$�encodingr
r
r�native_str_to_bytes�sr2cCs
|j|�S)N)�decode)�br1r
r
r�bytes_to_native_str�sr5cCs|S)Nr
)�tr1r
r
r�text_to_native_str�sr7cCsddlm}||�S)Nr)�newbytes)Zfuture.typesr8)r$r1r8r
r
rr2�scCst|�S)N)�native)r4r1r
r
rr5�s�asciicCst|�j|�S)z}
        Use this to create a Py2 native string when "from __future__ import
        unicode_literals" is in effect.
        )r.r)r6r1r
r
rr7�szu
    On Py3, returns an encoded string.
    On Py2, returns a newbytes type, ignoring the ``encoding`` argument.
    cOstt||��S)N)�list�range)�args�kwargsr
r
r�lrange�sr?cOstt||��S)N)r;�zip)r=r>r
r
r�lzip�srAcOstt||��S)N)r;�map)r=r>r
r
r�lmap�srCcOstt||��S)N)r;�filter)r=r>r
r
r�lfilter�srEFcCsL|rtdd�|jd�D��Str(|j�Sddl}|jd�}t|j|��SdS)zE
    A function equivalent to the str.isidentifier method on Py3
    css|]}t|�VqdS)N)�isidentifier)�.0�ar
r
r�	<genexpr>szisidentifier.<locals>.<genexpr>�.rNz[a-zA-Z_][a-zA-Z0-9_]*$)�all�splitrrF�re�compile�bool�match)r$ZdottedrMZ_name_rer
r
rrFs
rFcKs t|dd�}|s|j}|f|�S)z�
    Function for iterating over dictionary items with the same set-like
    behaviour on Py2.7 as on Py3.

    Passes kwargs to method.�	viewitemsN)�getattr�items)�objr>�funcr
r
rrQsrQcKs t|dd�}|s|j}|f|�S)z�
    Function for iterating over dictionary keys with the same set-like
    behaviour on Py2.7 as on Py3.

    Passes kwargs to method.�viewkeysN)rR�keys)rTr>rUr
r
rrVsrVcKs t|dd�}|s|j}|f|�S)z�
    Function for iterating over dictionary values with the same set-like
    behaviour on Py2.7 as on Py3.

    Passes kwargs to method.�
viewvaluesN)rR�values)rTr>rUr
r
rrX(srXcKs t|dd�}|s|j}|f|�S)zsUse this only if compatibility with Python versions before 2.7 is
    required. Otherwise, prefer viewitems().
    �	iteritemsN)rRrS)rTr>rUr
r
rrZ4srZcKs t|dd�}|s|j}|f|�S)zrUse this only if compatibility with Python versions before 2.7 is
    required. Otherwise, prefer viewkeys().
    �iterkeysN)rRrW)rTr>rUr
r
rr[>sr[cKs t|dd�}|s|j}|f|�S)ztUse this only if compatibility with Python versions before 2.7 is
    required. Otherwise, prefer viewvalues().
    �
itervaluesN)rRrY)rTr>rUr
r
rr\Hsr\cCs,tst||tj|d|��nt|||�dS)a/Bind a method to class, python 2 and python 3 compatible.

    Parameters
    ----------

    cls : type
        class to receive bound method
    name : basestring
        name of method on class instance
    func : function
        function to be bound as method

    Returns
    -------
    None
    N)r�setattr�types�
MethodType)rrrUr
r
r�bind_methodRsr`cCstj�dS)N�)�sys�exc_infor
r
r
r�getexceptionjsrdcCs(tj�d}|dj}|dj}||fS)zr
    Returns the globals and locals of the calling frame.

    Is there an alternative to frame hacking here?
    rr)�inspect�stack�	f_globals�f_locals)Zcaller_frame�	myglobals�mylocalsr
r
r�_get_caller_globals_and_localsns

rkcCs0t|�}|jd�r(|jd�r(|dd�S|SdS)zA
    Returns the string without any initial or final quotes.
    �'raN���)�repr�
startswith�endswith)Zmystring�rr
r
r�_repr_stripzsrrcCs6t�\}}|j�}||d<||d<d}t|||�dS)zn
        Equivalent to:

            raise EXCEPTION from CAUSE

        on Python 3. (See PEP 3134).
        Z__python_future_raise_from_excZ __python_future_raise_from_causezJraise __python_future_raise_from_exc from __python_future_raise_from_causeN)rk�copy�exec)�exc�causerirjZexecstrr
r
r�
raise_from�s
rwcCs�t|t�r |dk	rtd��|}nbt|t�rFt|t�rFtd|j��n<t||�rV|}n,t|t�rj||�}n|dkrz|�}n||�}|j|k	r�|j|��|�dS)z�
        A function that matches the Python 2.x ``raise`` statement. This
        allows re-raising exceptions with the cls value and traceback on
        Python 2 and 3.
        Nz0instance exception may not have a separate valuez,class must derive from BaseException, not %s)	r&�
BaseException�	TypeErrorr�
issubclassr�tuple�
__traceback__�with_traceback)�tp�value�tbrur
r
r�raise_�s 
	




r�cCs$|tkrtj�\}}}|j|��dS)N)�Ellipsisrbrcr})ru�	traceback�_r
r
r�raise_with_traceback�sr�cCs�t|t�rt|t�r|�}n|}d|_t|t�rZt|t�rZ|�|_tj�d|j_d|_nN|dkrpd|_d|_n8t|t	�r�||_t
j|jdtj�d�d|_ntd��tj�d|_
|�dS)zn
        Equivalent to:

            raise EXCEPTION from CAUSE

        on Python 3. (See PEP 3134).
        FrTNr|z/exception causes must derive from BaseExceptionra)r&rrz�	Exception�__suppress_context__�	__cause__rbrcr|rx�object�__setattr__ry�__context__)rurv�er
r
rrw�s$
z�
def raise_(tp, value=None, tb=None):
    raise tp, value, tb

def raise_with_traceback(exc, traceback=Ellipsis):
    if traceback == Ellipsis:
        _, _, traceback = sys.exc_info()
    raise exc, None, traceback
zjRaise exception with existing traceback.
If traceback is not passed, uses sys.exc_info() to get traceback.cCstr|S|j|_|`|SdS)a
    From jinja2/_compat.py. License: BSD.

    Use as a decorator like this::

        @implements_iterator
        class UppercasingIterator(object):
            def __init__(self, iterable):
                self._iter = iter(iterable)
            def __iter__(self):
                return self
            def __next__(self):
                return next(self._iter).upper()

    N)r�__next__�next)rr
r
r�implements_iterator�s
r�cCs|jS)N)r�)�xr
r
rrsrcCs|jS)N)r�)r�r
r
rrscCs$tr|St|t�r|jd�S|SdS)Nzutf-8)rr&r.r)�filenamer
r
r�encode_filenames


r�cCs t|d�odt|�kpt|d�S)a
    Python 2.7 has both new-style and old-style classes. Old-style classes can
    be pesky in some circumstances, such as when using inheritance.  Use this
    function to test for whether a class is new-style. (Python 3 only has
    new-style classes.)
    �	__class__�__dict__�	__slots__)�hasattr�dir)rr
r
r�is_new_style#sr�cCst|td��S)z
    Deprecated. Use::
        >>> isinstance(obj, str)
    after this import:
        >>> from future.builtins import str
    r-)r&r)rTr
r
r�istext3sr�cCst|td��S)z�
    Deprecated. Use::
        >>> isinstance(obj, bytes)
    after this import:
        >>> from future.builtins import bytes
    �)r&r)rTr
r
r�isbytes=sr�cCst|�jdkS)a
    Equivalent to the result of ``type(obj)  == type(newbytes)``
    in other words, it is REALLY a newbytes instance, not a Py2 native str
    object?

    Note that this does not cover subclasses of newbytes, and it is not
    equivalent to ininstance(obj, newbytes)
    r8)rr)rTr
r
r�
isnewbytesGs	r�cCst|tj�S)a_
    Deprecated. Tests whether an object is a Py3 ``int`` or either a Py2 ``int`` or
    ``long``.

    Instead of using this function, you can use:

        >>> from future.builtins import int
        >>> isinstance(obj, int)

    The following idiom is equivalent:

        >>> from numbers import Integral
        >>> isinstance(obj, Integral)
    )r&�numbers�Integral)rTr
r
r�isintSsr�cCst|d�r|j�S|SdS)aO
    On Py3, this is a no-op: native(obj) -> obj

    On Py2, returns the corresponding native Py2 types that are
    superclasses for backported objects from Py3:

    >>> from builtins import str, bytes, int

    >>> native(str(u'ABC'))
    u'ABC'
    >>> type(native(str(u'ABC')))
    unicode

    >>> native(bytes(b'ABC'))
    b'ABC'
    >>> type(native(bytes(b'ABC')))
    bytes

    >>> native(int(10**20))
    100000000000000000000L
    >>> type(native(int(10**20)))
    long

    Existing native types on Py2 will be returned unchanged:

    >>> type(native(u'ABC'))
    unicode
    �
__native__N)r�r�)rTr
r
rr9fs
r9rtcCsB|dkr*tjd�}|j}|dkr&|j}~n|dkr6|}td�dS)zExecute code in a namespace.Nrazexec code in globs, locs)rb�	_getframergrhrt)�codeZglobsZlocs�framer
r
r�exec_�s
r�cCs,t|tj�r t|tj�r ||S||SdS)z�
    DEPRECATED: import ``old_div`` from ``past.utils`` instead.

    Equivalent to ``a / b`` on Python 2 without ``from __future__ import
    division``.

    TODO: generalize this to other objects (like arrays etc.)
    N)r&r�r�)rHr4r
r
r�old_div�s	r�cs trdd�S�fdd�}|SdS)a~
    A decorator to turn a function or method call that returns text, i.e.
    unicode, into one that returns a native platform str.

    Use it as a decorator like this::

        from __future__ import unicode_literals

        class MyClass(object):
            @as_native_str(encoding='ascii')
            def __repr__(self):
                return next(self._iter).upper()
    cSs|S)Nr
)�fr
r
rr�szas_native_str.<locals>.<lambda>cstj����fdd��}|S)Ncs�||�j�d�S)N)r1)r)r=r>)r1r�r
r�wrapper�sz/as_native_str.<locals>.encoder.<locals>.wrapper)�	functools�wraps)r�r�)r1)r�r�encoder�szas_native_str.<locals>.encoderN)r)r1r�r
)r1r�
as_native_str�sr�cCst|j��S)N)r;rY)rr
r
r�
listvalues�sr�cCst|j��S)N)r;rS)rr
r
r�	listitems�sr�cCs|j�S)N)rY)rr
r
rr��scCs|j�S)N)rS)rr
r
rr��scCs|S)Nr
)rTr
r
r�ensure_new_type�sr�cCs�ddlm}ddlm}ddlm}ddlm}tt	|��}t
|t|��r�|tkrZ||�S|tkrj||�S|t
krz||�S|tkr�||�S|tkr�||�S|Snt|�||gks�t�|SdS)Nr)r8)�newstr)�newint)�newdict)Zfuture.types.newbytesr8Zfuture.types.newstrr�Zfuture.types.newintr�Zfuture.types.newdictr�rr9rzr'r.�int�long�dict�AssertionError)rTr8r�r�r�Znative_typer
r
rr��s&�PY2�PY26r�PYPY�binary_type�class_types�get_next�
integer_types�native_bytes�
native_str�reraise�string_types�	text_type)rr)rr)rr)rr)rr)rr	)rr)rr)r0)r0)N)N)N)r:)F)NN)NN)r0)[�__doc__r^rbr�r�rsre�version_inforZ	PY34_PLUSZ	PY35_PLUSZ	PY36_PLUSZ	PY37_PLUSZ	PY38_PLUSZ	PY39_PLUSr�r��PY27r�r�rr"r%r(r)r'r�r�r�rr�r�r#r��
basestringr�Z	ClassTyper.r,r2r5r7r?rArCrE�__builtin__r<r@rBrDrFrQrVrXrZr[r\r`rdrkrrrwr�r�r�rt�stripr�r�r�r�r�r�r�r�r�r�r�r9�builtinsrRr�r�r�r��AttributeErrorr�r�r��__all__r
r
r
r�<module>2s�
)$


	











&$

	

$








Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists