
    9iU                        S r SSKrSSKrSSKrSSKrSSKrSSKr\R                  S   S:  r\R                  SS S:  r	\R                  SS S:  r
\R                  SS S:  r\R                  SS S:  r\R                  SS S	:  r\R                  SS S
:  r\R                  S   S:H  r\R                  SS S:H  r\R                  SS S:H  r\" \S5      rS rS r\(       a  S rS rS r\4r\4r\4r\r\ r!O"S rS rS r\"4r\\#4r\\RH                  4r\%r\r!\(       a  S r&OS r&S\&l         \(       a  SJS jr'SJS jr(SKS jr)OSKS jr'SKS jr(SLS jr)S\'l         \(       a  S  r*S! r+S" r,S# r-O4SSK.r.\.R^                  r*\.R`                  r+\.Rb                  r,\.Rd                  r-SMS$ jr3S% r4S& r5S' r6S( r7S) r8S* r9S+ r:S, r;S- r<S. r=\(       a  S/ r>SNS0 jr?\@4S1 jrAOS2 r>\B" S3R                  5       5        S4\Al         \?rDS5 rE\(       a  S6 rFOS7 rFS8 rGS9 rH\rI\ rJS: rKS; rLS< rMS= rNS> rO\(       a  SSKPrP\Q" \PS?5      rROSNS@ jrRSA rSSJSB jrT \URn                    SC rVSD rW\(       a  SG rYOSH rY/ SIQrZg! \X a	    SE rVSF rW N!f = f)Oa  
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      )r      )r      )r      )r      )r      )r   	   )r   r   )r   r   pypy_translation_infoc                 N    [         (       d  U R                  U l        S U l        U $ )uN  
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.
c                 @    U R                  5       R                  S5      $ Nutf-8)__unicode__encode)selfs    U/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/future/utils/__init__.py<lambda>-python_2_unicode_compatible.<locals>.<lambda>n   s    4#3#3#5#<#<W#E    )PY3__str__r   clss    r   python_2_unicode_compatibler   I   s!    F 3++EJr   c                 8   ^ ^  " UU 4S jST 5      nU" SS0 5      $ )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.
c                   T   > \ rS rSr\R
                  r\R                  rU U4S jrSrg)z!with_metaclass.<locals>.metaclass   c                 L   > Uc  [         R                  XSU5      $ T" UTU5      $ )N )type__new__)r   name
this_basesdbasesmetas       r   r"   )with_metaclass.<locals>.metaclass.__new__   s+    !||Cr155eQ''r   r    N)	__name__
__module____qualname____firstlineno__r!   __call____init__r"   __static_attributes__)r&   r'   s   r   	metaclass!with_metaclass.<locals>.metaclass   s    ====	( 	(r   r0   temporary_classNr    )r'   r&   r0   s   `` r   with_metaclassr3   r   s&    2( (D ( &b11r   c                     [        U /5      $ N)bytesss    r   bchrr9      s    aSzr   c                 Z    [        U [        5      (       a  [        U S5      $ [        U 5      $ Nlatin-1)
isinstancestrr6   r7   s    r   bstrr?      s%    aI&&8Or   c                     U $ r5   r    r7   s    r   bordrA          r   c                     [        U 5      $ r5   )chrr7   s    r   r9   r9          1vr   c                     [        U 5      $ r5   )r>   r7   s    r   r?   r?      rE   r   c                     [        U 5      $ r5   )ordr7   s    r   rA   rA      rE   r   c                     [        U [        5      (       a  U $ [        U [        5      (       a  U R                  S5      $ [        U 5      $ r;   )r=   r6   r>   r   r7   s    r   tobytesrJ      s9    aH!S!!xx	**Qxr   c                 p    [        U [        5      (       a  U R                  S5      $ SR                  U 5      $ )Nr<    )r=   unicoder   joinr7   s    r   rJ   rJ      s,    a!!88I&&771:r   zS
    Encodes to latin-1 (where the first 256 chars are the same as
    ASCII.)
    c                 $    U R                  U5      $ r5   r   )r8   encodings     r   native_str_to_bytesrR          xx!!r   c                 $    U R                  U5      $ r5   )decodebrQ   s     r   bytes_to_native_strrX      rS   r   c                     U $ r5   r    trQ   s     r   text_to_native_strr\      rB   r   c                     SSK Jn  U" U 5      $ )Nr   newbytes)future.typesr_   )r8   rQ   r_   s      r   rR   rR      s    ){r   c                     [        U 5      $ r5   )nativerV   s     r   rX   rX      s    ayr   c                 6    [        U 5      R                  U5      $ )ze
Use this to create a Py2 native string when "from __future__ import
unicode_literals" is in effect.
)rM   r   rZ   s     r   r\   r\      s    
 qz  **r   zu
    On Py3, returns an encoded string.
    On Py2, returns a newbytes type, ignoring the ``encoding`` argument.
    c                  *    [        [        U 0 UD65      $ r5   )listrangeargskwargss     r   lrangerj      s    E4*6*++r   c                  *    [        [        U 0 UD65      $ r5   )re   ziprg   s     r   lziprm          C(())r   c                  *    [        [        U 0 UD65      $ r5   )re   maprg   s     r   lmaprq      rn   r   c                  *    [        [        U 0 UD65      $ r5   )re   filterrg   s     r   lfilterrt      s    FD+F+,,r   c                     U(       a!  [        S U R                  S5       5       5      $ [        (       a  U R                  5       $ SSKnUR                  S5      n[        UR                  U 5      5      $ )z=
A function equivalent to the str.isidentifier method on Py3
c              3   8   #    U  H  n[        U5      v   M     g 7fr5   )isidentifier).0as     r   	<genexpr>isidentifier.<locals>.<genexpr>  s     9Lq<??Ls   .r   Nz[a-zA-Z_][a-zA-Z0-9_]*$)allsplitr   rw   recompileboolmatch)r8   dottedr   _name_res       r   rw   rw     sX     9AGGCL999
s~~::89HNN1%&&r   c                 R    [        U SS5      nU(       d  U R                  nU" S0 UD6$ )z|
Function for iterating over dictionary items with the same set-like
behaviour on Py2.7 as on Py3.

Passes kwargs to method.	viewitemsNr    getattritemsobjri   funcs      r   r   r     s*     3T*Dyy>&>r   c                 R    [        U SS5      nU(       d  U R                  nU" S0 UD6$ )z{
Function for iterating over dictionary keys with the same set-like
behaviour on Py2.7 as on Py3.

Passes kwargs to method.viewkeysNr    r   keysr   s      r   r   r     s*     3
D)Dxx>&>r   c                 R    [        U SS5      nU(       d  U R                  nU" S0 UD6$ )z}
Function for iterating over dictionary values with the same set-like
behaviour on Py2.7 as on Py3.

Passes kwargs to method.
viewvaluesNr    r   valuesr   s      r   r   r   (  s*     3d+Dzz>&>r   c                 R    [        U SS5      nU(       d  U R                  nU" S0 UD6$ )zkUse this only if compatibility with Python versions before 2.7 is
required. Otherwise, prefer viewitems().
	iteritemsNr    r   r   s      r   r   r   4  s*     3T*Dyy>&>r   c                 R    [        U SS5      nU(       d  U R                  nU" S0 UD6$ )zjUse this only if compatibility with Python versions before 2.7 is
required. Otherwise, prefer viewkeys().
iterkeysNr    r   r   s      r   r   r   >  s*     3
D)Dxx>&>r   c                 R    [        U SS5      nU(       d  U R                  nU" S0 UD6$ )zlUse this only if compatibility with Python versions before 2.7 is
required. Otherwise, prefer viewvalues().

itervaluesNr    r   r   s      r   r   r   H  s*     3d+Dzz>&>r   c           	      x    [         (       d#  [        X[        R                  " USU 5      5        g[        XU5        g)zBind 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)r   r#   r   s      r   bind_methodr   R  s,    $ 35++D$<=4 r   c                  2    [         R                  " 5       S   $ )N   )sysexc_infor    r   r   getexceptionr   j  s    <<>!r   c                  t    [         R                  " 5       S   n U S   R                  nU S   R                  nX4$ )zf
Returns the globals and locals of the calling frame.

Is there an alternative to frame hacking here?
r   r   )inspectstack	f_globalsf_locals)caller_frame	myglobalsmylocalss      r   _get_caller_globals_and_localsr   n  s;     ==?1%LQ))IA''Hr   c                 ~    [        U 5      nUR                  S5      (       a  UR                  S5      (       a  USS $ U$ )z9
Returns the string without any initial or final quotes.
'r   )repr
startswithendswith)mystringrs     r   _repr_stripr   z  s8     	XA||CQZZ__2wr   c                 h    [        5       u  p#UR                  5       nXS'   XS'   Sn[        XBU5        g)N
Equivalent to:

    raise EXCEPTION from CAUSE

on Python 3. (See PEP 3134).
__python_future_raise_from_exc __python_future_raise_from_causezJraise __python_future_raise_from_exc from __python_future_raise_from_causeN)r   copyexec)exccauser   r   execstrs        r   
raise_fromr     s>     =>	 NN$	69238=45^W*r   c                    [        U [        5      (       a  Ub  [        S5      eU nO[        U [        5      (       a-  [	        U [        5      (       d  [        SU R
                  -  5      e[        X5      (       a  UnO.[        U[        5      (       a  U " U6 nOUc  U " 5       nOU " U5      nUR                  ULa  UR                  U5      eUe)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.
z0instance exception may not have a separate valuez,class must derive from BaseException, not %s)	r=   BaseException	TypeErrorr!   
issubclassr)   tuple__traceback__with_traceback)tpvaluetbr   s       r   raise_r     s     b-((   RSSCD!!*R*G*G JR[[XYY %$$E5))%jdiB&$$R((	r   c                 h    U[         :X  a  [        R                  " 5       u    p!U R                  U5      er5   )Ellipsisr   r   r   )r   	traceback_s      r   raise_with_tracebackr     s*     !llnOAq  ++r   c                 n   [        U [        5      (       a  [        U [        5      (       a  U " 5       nOU nSUl        [        U[        5      (       aP  [        U[        5      (       a;  U" 5       Ul        [        R                  " 5       S   UR
                  l        SUl        OwUc  SUl        SUl        Oe[        U[        5      (       aE  Xl        [        R                  UR
                  S[        R                  " 5       S   5        SUl        O[        S5      e[        R                  " 5       S   Ul        Ue)r   Fr   TNr   z/exception causes must derive from BaseExceptionr   )r=   r!   r   	Exception__suppress_context__	__cause__r   r   r   r   object__setattr__r   __context__)r   r   es      r   r   r     s     c4  ZY%?%?A A!&eT""z%'C'C'AK(+q(9AKK%%)A"]AK%)A"}--Kq{{_cllnQ>OP%)A"MNNq)r   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.c                 F    [         (       a  U $ U R                  U l        U ?U $ )aS  
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()

)r   __next__nextr   s    r   implements_iteratorr     s#      s
<<L
r   c                     U R                   $ r5   )r   xs    r   r   r     s    r   c                     U R                   $ r5   )r   r   s    r   r   r     s    r   c                 l    [         (       a  U $ [        U [        5      (       a  U R                  S5      $ U $ r   )r   r=   rM   r   )filenames    r   encode_filenamer     s-    
sh((??7++r   c                 j    [        U S5      =(       a!    S[        U 5      ;   =(       d    [        U S5      $ )z
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dirr   s    r   is_new_styler   #  s5     3$ H*C*@ +G-4S+-FHr   c                 ,    [        U [        S5      5      $ )zk
Deprecated. Use::
    >>> isinstance(obj, str)
after this import:
    >>> from future.builtins import str
rL   r=   r!   r   s    r   istextr   3       c49%%r   c                 ,    [        U [        S5      5      $ )zo
Deprecated. Use::
    >>> isinstance(obj, bytes)
after this import:
    >>> from future.builtins import bytes
r   r   r   s    r   isbytesr   =  r   r   c                 2    [        U 5      R                  S:H  $ )z
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)
r_   )r!   r)   r   s    r   
isnewbytesr   G  s     9++r   c                 6    [        U [        R                  5      $ )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Integralr   s    r   isintr   S  s      c7++,,r   c                 H    [        U S5      (       a  U R                  5       $ U $ )a  
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__)r   r   r   s    r   rb   rb   f  s#    : sL!!~~
r   r   c                     Uc3  [         R                  " S5      nUR                  nUc  UR                  nAOUc  Un[	        S5        g)zExecute code in a namespace.Nr   zexec code in globs, locs)r   	_getframer   r   r   )codeglobslocsframes       r   exec_r    sB    =MM!$EOOE|~~\D+,r   c                     [        U [        R                  5      (       a#  [        U[        R                  5      (       a  X-  $ X-  $ )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.)
r   )ry   rW   s     r   old_divr    s7     !W%%&&:a9I9I+J+Jvur   c                 0   ^  [         (       a  S $ U 4S jnU$ )aZ  
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()
c                     U $ r5   r    )fs    r   r   as_native_str.<locals>.<lambda>  s    r   c                 J   >^  [         R                  " T 5      UU 4S j5       nU$ )Nc                  .   > T" U 0 UD6R                  TS9$ )N)rQ   rP   )rh   ri   rQ   r  s     r   wrapper/as_native_str.<locals>.encoder.<locals>.wrapper  s!    $)&)00(0CCr   )	functoolswraps)r  r
  rQ   s   ` r   encoderas_native_str.<locals>.encoder  s%    __QD  DNr   )r   )rQ   r  s   ` r   as_native_strr    s     s	
 r   c                 "    U R                  5       $ r5   )r   r%   s    r   
listvaluesr    s    xxzr   c                 "    U R                  5       $ r5   )r   r  s    r   	listitemsr    s    wwyr   c                 4    [        U R                  5       5      $ r5   )re   r   r  s    r   r  r    s    AHHJr   c                 4    [        U R                  5       5      $ r5   )re   r   r  s    r   r  r    s    AGGIr   c                     U $ r5   r    r   s    r   ensure_new_typer    s    
r   c                 n   SSK Jn  SSKJn  SSKJn  SSKJn  [        [        U 5      5      n[        U[        U 5      5      (       a\  U[        :X  a  U" U 5      $ U[        :X  a  U" U 5      $ U[        :X  a  U" U 5      $ U[        :X  a  U" U 5      $ U[        :X  a  U" U 5      $ U $ [        U 5      X4;   d   eU $ )Nr   r^   )newstr)newint)newdict)future.types.newbytesr_   future.types.newstrr  future.types.newintr  future.types.newdictr  r!   rb   r   r>   rM   intlongdict)r   r_   r  r  r  native_types         r   r  r    s    2..06#;' k49--c!}$'c{"#c{"$c{"$s|#
 9 2222Jr   )2PY2PY26r   PYPYr  binary_typer   rA   r?   rX   class_typesr   r  r  get_nextr   r   integer_typesr   r   rw   r   r   r   r   r   r   rt   r  r  rq   rj   rm   rb   native_bytes
native_strrR   r  r   r   r   reraisestring_typesr\   	text_typerJ   r   r   r   r3   )r   r5   )ascii)F)NN)[__doc__r   r   r   r  r   r   version_infor   	PY34_PLUS	PY35_PLUS	PY36_PLUS	PY37_PLUS	PY38_PLUS	PY39_PLUSr&  r'  PY27r   r(  r   r3   r9   r?   rA   r>   r0  r"  r,  r!   r*  r1  r6   r)  
basestringr#  	ClassTyperM   rJ   rR   rX   r\   rj   rm   rq   rt   __builtin__rf   rl   rp   rs   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   stripr/  r   r+  r   r   r.  r-  r   r   r   r   rb   builtinsr   r  r  r  r$  r  r  AttributeErrorr  __all__r    r   r   <module>rC     sJ  1f  
     
qQQq!V+	Qq!V+	Qq!V+	Qq!V+	Qq!V+	Qq!V+		qQ
!&
!&s+,&R 2H 
 4LDM%KIK ;L$KM)KIK  
 ""+  
 ,**- F??D??D  G'			!0	 +$$L -5 ,"H 	 
 
EGE   . #HHH 
&&	,-& H Hf%E
-4NN :]   	s   I5 5JJ