a
    ,]                     @   s   d Z G dd deZdgZdS )u  
An object subclass for Python 2 that gives new-style classes written in the
style of Python 3 (with ``__next__`` and unicode-returning ``__str__`` methods)
the appropriate Python 2-style ``next`` and ``__unicode__`` methods for compatible.

Example use::

    from builtins import object

    my_unicode_str = u'Unicode string: 孔子'

    class A(object):
        def __str__(self):
            return my_unicode_str

    a = A()
    print(str(a))

    # On Python 2, these relations hold:
    assert unicode(a) == my_unicode_string
    assert str(a) == my_unicode_string.encode('utf-8')


Another example::

    from builtins import object

    class Upper(object):
        def __init__(self, iterable):
            self._iter = iter(iterable)
        def __next__(self):                 # note the Py3 interface
            return next(self._iter).upper()
        def __iter__(self):
            return self

    assert list(Upper('hello')) == list('HELLO')

c                   @   s<   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zg Z	dS )	newobjectz
    A magical object class that provides Python 2 compatibility methods::
        next
        __unicode__
        __nonzero__

    Subclasses of this class can merely define the Python 3 methods (__next__,
    __str__, and __bool__).
    c                 C   s$   t | drt| | S tdd S )N__next__znewobject is not an iterator)hasattrtyper   	TypeErrorself r   g/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python3.9/site-packages/future/types/newobject.pynext3   s    
znewobject.nextc                 C   s>   t | drt| | }nt| }t|tr0|S |dS d S )N__str__zutf-8)r   r   r   str
isinstanceunicodedecode)r   sr   r   r	   __unicode__8   s    

znewobject.__unicode__c                 C   s4   t | drt| | S t | dr0t| | S dS )N__bool____len__T)r   r   r   r   r   r   r   r	   __nonzero__D   s
    

znewobject.__nonzero__c                 C   s   t | dstS |  S )N__int__)r   NotImplementedr   r   r   r   r	   __long__S   s    
znewobject.__long__c                 C   s   t | S )z=
        Hook for the future.utils.native() function
        )objectr   r   r   r	   
__native__m   s    znewobject.__native__N)
__name__
__module____qualname____doc__r
   r   r   r   r   	__slots__r   r   r   r	   r   )   s   	r   N)r   r   r   __all__r   r   r   r	   <module>   s   (L