HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //usr/local/lib/python3.9/site-packages/future/utils/__pycache__/surrogateescape.cpython-39.pyc
a

q�dg��@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)N�unicode_escape)r�PY3�decode)�text�r�F/usr/local/lib/python3.9/site-packages/future/utils/surrogateescape.py�usr
cCstjr|�d�S|SdS)N�latin1)rr�encode)�datarrr	�bs
rcCs
t|f�S�N)�bytes)�coderrr	�<lambda>#�rcCsd|j|j|j�}z0t|t�r(t|�}nt|t�r<t|�}n|�WntyX|�Yn0||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




r c@seZdZdS)rN)�__name__�
__module__�__qualname__rrrr	rCsrcCs�g}|D]r}t|�}d|kr(dks.nt�d|krBdkrZnn|�t|d��q|dkrv|�t|d��qt�qt��|�S)z�
    Returns a (unicode) string, not the more logical bytes, because the codecs
    register_error functionality expects this.
    ������i�)�ordr�append�_unichr�str�join)rr�chrrrr	rGsrcCszg}|D]d}t|t�r|}nt|�}d|kr8dkrPnn|�td|��q|dkrh|�t|��qt�qt��|�S)z$
    Returns a (unicode) string
    ��r&�)r�intr'r(r)rr*r+)Zmybytesrr,rrrr	rds
rcCs@tdkr�g}t|�D]f\}}t|�}|dkr6t|�}n:d|krJdkr\nnt|d�}ntt|||dd��|�|�qt��|�Stdk�r0g}t|�D]�\}}t|�}d	|kr�d
k�rnnFd|kr�dkr�nnt|d�}|�|�ntt|||dd��q�|�d�}|�|�q�t��|�S|�tt	�SdS)N�asciir-i��r%r&�zordinal not in range(128)zutf-8r$i��zsurrogates not allowed)
�FS_ENCODING�	enumerater'�	bytes_chrrr(rr+r�	FS_ERRORS)�fn�encoded�indexr,rZch_utf8rrr	�encodefilename}s<

�
�
r:cCs|�tt�Sr)rr3r6)r7rrr	�decodefilename�sr;r1u[abcÿ]u[abc�]cCs<tjr
dSzt�t�Wnty6t�tt�Yn0dS)zH
    Registers the surrogateescape error handler on Python 2 (only)
    N)rr�codecs�lookup_errorr6�LookupError�register_errorr rrrr	�register_surrogateescape�sr@�__main__)�__doc__r<�sys�futurerr6r
rr�chrr)r5�unichrr �	Exceptionrrrr:r;r3r7r8�lookup�namer@r!rrrr	�<module>s,	
'