Your IP : 216.73.216.25
B
� f%�@stdZddlZddd�Zddd�ZGdd �d ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�Zdd�Z dS)a Python 'utf-8-sig' Codec
This work similar to UTF-8 with the following changes:
* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the
first three bytes.
* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these
bytes will be skipped.
�N�strictcCstjt�||�dt|�fS)Nr)�codecs�BOM_UTF8�utf_8_encode�len)�input�errors�r �8/opt/alt/python37/lib64/python3.7/encodings/utf_8_sig.py�encodesrcCsDd}|dd�tjkr&|dd�}d}t�||d�\}}|||fS)Nr�T)rr�utf_8_decode)rr�prefix�output�consumedr r r
�decodesrc@s8eZdZddd�Zddd�Zdd�Zd d
�Zdd�Zd
S)�IncrementalEncoderrcCstj�||�d|_dS)N�)rr�__init__�first)�selfrr r r
rszIncrementalEncoder.__init__FcCs:|jr$d|_tjt�||j�dSt�||j�dSdS)Nr)rrrrr)rr�finalr r r
rs
zIncrementalEncoder.encodecCstj�|�d|_dS)Nr)rr�resetr)rr r r
r'szIncrementalEncoder.resetcCs|jS)N)r)rr r r
�getstate+szIncrementalEncoder.getstatecCs
||_dS)N)r)r�stater r r
�setstate.szIncrementalEncoder.setstateN)r)F)�__name__�
__module__�__qualname__rrrrrr r r r
rs
rc@s6eZdZd
dd�Zdd�Zdd�Zdd �Zd
d�ZdS)�IncrementalDecoderrcCstj�||�d|_dS)Nr)r�BufferedIncrementalDecoderrr)rrr r r
r2szIncrementalDecoder.__init__cCsv|jrht|�dkr*tj�|�r"dSd|_n>d|_|dd�tjkrht�|dd�||�\}}||dfSt�|||�S)Nr)�rr)rrrr�
startswithr
)rrrrrrr r r
�_buffer_decode6sz!IncrementalDecoder._buffer_decodecCstj�|�d|_dS)Nr)rr rr)rr r r
rGszIncrementalDecoder.resetcCstj�|�}|d|jfS)Nr)rr rr)rrr r r
rKszIncrementalDecoder.getstatecCstj�||�|d|_dS)Nr)rr rr)rrr r r
rPszIncrementalDecoder.setstateN)r)rrrrr#rrrr r r r
r1s
rc@seZdZdd�Zddd�ZdS)�StreamWritercCs.tj�|�y|`Wntk
r(YnXdS)N)rr$rr�AttributeError)rr r r
rVs
zStreamWriter.resetrcCstj|_t||�S)N)rrr)rrrr r r
r]szStreamWriter.encodeN)r)rrrrrr r r r
r$Usr$c@seZdZdd�Zddd�ZdS)�StreamReadercCs.tj�|�y|`Wntk
r(YnXdS)N)rr&rrr%)rr r r
rbs
zStreamReader.resetrcCspt|�dkrtj�|�r\dSn>|dd�tjkr\tj|_t�|dd�|�\}}||dfStj|_t�||�S)Nr)r!r)rrrr"r
r)rrrrrr r r
riszStreamReader.decodeN)r)rrrrrr r r r
r&asr&c Cstjdttttttd�S)Nz utf-8-sig)�namerr�incrementalencoder�incrementaldecoder�streamreader�streamwriter)r� CodecInforrrrr&r$r r r r
�getregentryysr-)r)r)
�__doc__rrrrr rr$r&r-r r r r
�<module> s
$
?>