
    9iI
                         S r SSKrSSKr\R                  S   S:  r\R                  S   S:H  r\" \S5      rS rS r	S r
/ S	Qrg)
aj  
Various non-built-in utility functions and definitions for Py2
compatibility in Py3.

For example:

    >>> # The old_div() function behaves like Python 2's / operator
    >>> # without "from __future__ import division"
    >>> from past.utils import old_div
    >>> old_div(3, 2)    # like 3/2 in Py2
    0
    >>> old_div(3, 2.0)  # like 3/2.0 in Py2
    1.5
    N      pypy_translation_infoc                 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>.metaclass1   c                 L   > Uc  [         R                  XSU5      $ T" UTU5      $ )N )type__new__)clsname
this_basesdbasesmetas       S/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/past/utils/__init__.pyr   )with_metaclass.<locals>.metaclass.__new__4   s+    !||Cr155eQ''    r
   N)	__name__
__module____qualname____firstlineno__r   __call____init__r   __static_attributes__)r   r   s   r   	metaclass!with_metaclass.<locals>.metaclass1   s    ====	( 	(r   r   temporary_classNr
   )r   r   r   s   `` r   with_metaclassr       s&    2( (D ( &b11r   c                 H    [        U S5      (       a  U R                  5       $ U $ )a  
On Py2, this is a no-op: native(obj) -> obj

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

>>> from past.builtins import str, dict

>>> native(str(b'ABC'))   # Output on Py3 follows. On Py2, output is 'ABC'
b'ABC'
>>> type(native(str(b'ABC')))
bytes

Existing native types on Py3 will be returned unchanged:

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

__native__)hasattrr"   )objs    r   nativer%   ;   s#    & sL!!~~
r   c                     [        U [        R                  5      (       a#  [        U[        R                  5      (       a  X-  $ X-  $ )z
Equivalent to ``a / b`` on Python 2 without ``from __future__ import
division``.

TODO: generalize this to other objects (like arrays etc.)
)
isinstancenumbersIntegral)abs     r   old_divr,   U   s7     !W%%&&:a9I9I+J+Jvur   )PY3PY2PYPYr    r%   r,   )__doc__sysr(   version_infor-   r.   r#   r/   r    r%   r,   __all__r
   r   r   <module>r4      sa     	qQ	qQs+, 2F4
 Hr   