Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/future/utils/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/future/utils/__pycache__/surrogateescape.cpython-37.pyc

B

�A�[��@s�dZddlZddlZddlmZdZdd�Zdd�ZejrHe	Z
d	d
�ZneZ
e	Zdd�Z
Gd
d�de�Zdd�Zdd�Zdd�Zdd�ZdZed�Zed�Ze�e�jZdd�Zedkr�dS)z�
This is Victor Stinner's pure-Python implementation of PEP 383: the "surrogateescape" error
handler of Python 3.

Source: misc/python/surrogateescape.py in https://bitbucket.org/haypo/misc
�N)�utils�surrogateescapecCstjr
|S|�d�SdS)NZunicode_escape)r�PY3�decode)�text�r�M/opt/alt/python37/lib/python3.7/site-packages/future/utils/surrogateescape.py�usr	cCstjr|�d�S|SdS)N�latin1)rr�encode)�datarrr�bs
r
cCs
t|f�S)N)�bytes)�coderrr�<lambda>#�rcCsf|j|j|j�}y0t|t�r(t|�}nt|t�r<t|�}n|�Wntk
rZ|�YnX||jfS)z�
    Pure Python implementation of the PEP 383: the "surrogateescape" error
    handler of Python 3. Undecodable bytes will be replaced by a Unicode
    character U+DCxx on decoding, and these are translated into the
    original bytes on encoding.
    )	�object�start�end�
isinstance�UnicodeDecodeError�replace_surrogate_decode�UnicodeEncodeError�replace_surrogate_encode�NotASurrogateError)�exc�mystring�decodedrrr�surrogateescape_handler(s




rc@seZdZdS)rN)�__name__�
__module__�__qualname__rrrrrCsrcCs�g}xz|D]r}t|�}d|kr*dks0nt�d|krDdkr\nn|�t|d��q
|dkrx|�t|d��q
t�q
Wt��|�S)z�
    Returns a (unicode) string, not the more logical bytes, because the codecs
    register_error functionality expects this.
    i�i��i�i�)�ordr�append�_unichr�str�join)rr�chrrrrrGs
rcCs~g}xl|D]d}t|t�r|}nt|�}d|kr:dkrRnn|�td|��q
|dkrj|�t|��q
t�q
Wt��|�S)z$
    Returns a (unicode) string
    ��i��)r�intr"r#r$rr%r&)Zmybytesrr'rrrrrds

rcCsJtdkr�g}xrt|�D]f\}}t|�}|dkr8t|�}n:d|krLdkr^nnt|d�}ntt|||dd��|�|�qWt��|�Stdk�r:g}x�t|�D]�\}}t|�}d	|kr�d
k�rnnHd|kr�dk�rnnt|d�}|�|�ntt|||dd��q�|�d�}|�|�q�Wt��|�S|�tt	�SdS)N�asciir(i��i��i��zordinal not in range(128)zutf-8i�i��zsurrogates not allowed)
�FS_ENCODING�	enumerater"�	bytes_chrrr#rr&r�	FS_ERRORS)�fn�encoded�indexr'rZch_utf8rrr�encodefilename}s8



r5cCs|�tt�S)N)rr.r1)r2rrr�decodefilename�sr6r,u[abcÿ]u[abc�]cCs>tjr
dSyt�t�Wn tk
r8t�tt�YnXdS)zH
    Registers the surrogateescape error handler on Python 2 (only)
    N)rr�codecs�lookup_errorr1�LookupError�register_errorrrrrr�register_surrogateescape�sr;�__main__)�__doc__r7�sys�futurerr1r	r
r�chrr$r0�unichrr�	Exceptionrrrr5r6r.r2r3�lookup�namer;rrrrr�<module>s0
'

Hacked By AnonymousFox1.0, Coded By AnonymousFox