%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/future/utils/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pyc

�
�A�[c@s�dZddlZddlZddlmZdZd�Zd�Zejrae	Z
d�ZneZ
e	Zd�Z
d	efd
��YZd�Zd�Zd
�Zd�ZdZed�Zed�Zeje�jZd�Zedkr�ndS(s�
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
i����N(tutilstsurrogateescapecCstjr
|S|jd�SdS(Ntunicode_escape(RtPY3tdecode(ttext((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pytus	cCstjr|jd�S|SdS(Ntlatin1(RRtencode(tdata((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pytbs	
cCs
t|f�S(N(tbytes(tcode((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pyt<lambda>#tcCs�|j|j|j!}yFt|t�r7t|�}n$t|t�rUt|�}n|�Wntk
ru|�nX||jfS(s�
    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.
    (	tobjecttstarttendt
isinstancetUnicodeDecodeErrortreplace_surrogate_decodetUnicodeEncodeErrortreplace_surrogate_encodetNotASurrogateError(texctmystringtdecoded((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pytsurrogateescape_handler(s


RcBseZRS((t__name__t
__module__(((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pyRCscCs�g}x�|D]�}t|�}d|ko6dknsDt�nd|ko[dknrz|jt|d��q
|dkr�|jt|d��q
t�q
Wt�j|�S(s�
    Returns a (unicode) string, not the more logical bytes, because the codecs
    register_error functionality expects this.
    i�i��i�i�(tordRtappendt_unichrtstrtjoin(RRtchR((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pyRGs
	
cCs�g}x�|D]�}t|t�r+|}nt|�}d|koNdknrm|jtd|��q
|dkr�|jt|��q
t�q
Wt�j|�S(s$
    Returns a (unicode) string
    i�i�i�i(RtintRRR RR!R"(tmybytesRR#R((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pyRds
	
cCs�tdkr�g}x�t|�D]�\}}t|�}|dkrRt|�}nKd|koidknr�t|d�}ntt|||dd��|j|�qWt�j|�Stdkr�g}x�t|�D]�\}}t|�}d	|kod
knrld|ko(dknrMt|d�}|j|�q�tt|||dd��q�|jd�}|j|�q�Wt�j|�S|jtt	�SdS(Ntasciii�i��i��i�isordinal not in range(128)sutf-8i�i��ssurrogates not allowed(
tFS_ENCODINGt	enumerateRt	bytes_chrRRRR"Rt	FS_ERRORS(tfntencodedtindexR#Rtch_utf8((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pytencodefilename}s8
	cCs|jtt�S(N(RR'R*(R+((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pytdecodefilename�sR&s[abc�]s[abc\udcff]cCsFtjr
dSytjt�Wn!tk
rAtjtt�nXdS(sH
    Registers the surrogateescape error handler on Python 2 (only)
    N(RRtcodecstlookup_errorR*tLookupErrortregister_errorR(((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pytregister_surrogateescape�s	
t__main__(t__doc__R1tsystfutureRR*RR
RtchrR R)tunichrRt	ExceptionRRRR/R0R'R+R,tlookuptnameR5R(((sM/opt/alt/python27/lib/python2.7/site-packages/future/utils/surrogateescape.pyt<module>s0							'		

Zerion Mini Shell 1.0