Sindbad~EG File Manager
3
�uGh�U � : @ s d Z ddlZddlZddlZddlZddlZddlZejd dkZejdd� d�kZ ejdd� d�kZ
ejdd� d�kZejdd� d�kZejdd� d�kZ
ejdd� d�kZejd dkZejdd� d�kZejdd� d�kZeed�Zdd
� 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
eUj7 W n& eVk
�r� dkdl� ZWdmdn� ZXY nX dodl� 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_infoc C s t s| 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.
c S s | j � jd�S )Nzutf-8)�__unicode__�encode)�self� r
�</root/tmp/pip-build-gzoz1_uw/future/future/utils/__init__.py�<lambda>n s z-python_2_unicode_compatible.<locals>.<lambda>)�PY3�__str__r
)�clsr
r
r �python_2_unicode_compatibleI s #
r c s"