Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/future/utils/__pycache__/ |
Upload File : |
o ,�]� � @ s� d Z ddlZddlZddlmZ dZdd� Zdd� Zejr$e Z d d � ZneZ e Zdd� Z G d d� de�Zdd� Zdd� Zdd� Zdd� ZdZed�Zed�Ze�e�jZdd� Zedkr_ dS 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�surrogateescapec C s t jr| S | �d�S )N�unicode_escape)r �PY3�decode)�text� r �>/usr/lib/python3/dist-packages/future/utils/surrogateescape.py�u s r c C s t jr| �d�S | S )N�latin1)r r �encode)�datar r r �b s r c C s t | f�S �N)�bytes)�coder r r �<lambda># s r c C s` | j | j| j� }zt| t�rt|�}nt| t�rt|�}n| �W n ty* | �w || 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�decodedr r r �surrogateescape_handler( s �� r c @ s e Zd ZdS )r N)�__name__� __module__�__qualname__r r r r r C s r c C s� g }| D ]9}t |�}d| krdkst� t�d| kr"dkr.n n |�t|d �� q|dkr<|�t|d �� qt�t� �|�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)r r �chr r r r r G s �r c C sx g }| D ]1}t |t�r|}nt|�}d| krdkr(n n |�td| �� q|dkr4|�t|�� qt�t� �|�S )z$ Returns a (unicode) string � � r% � )r �intr&