Your IP : 3.143.254.10
3
\%�@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�strictcCstjtj||�dt|�fS)Nr)�codecs�BOM_UTF8�utf_8_encode�len)�input�errors�r �+/usr/lib64/python3.6/encodings/utf_8_sig.py�encodesrcCsDd}|dd�tjkr&|dd�}d}tj||d�\}}|||fS)Nr�T)rr�utf_8_decode)rr�prefix�output�consumedr r r
�decodesrc@s8eZdZddd�Zddd�Zdd�Zd d
�Zdd�Zd
S)�IncrementalEncoderrcCstjj||�d|_dS)N�)rr�__init__�first)�selfrr r r
rszIncrementalEncoder.__init__FcCs:|jr$d|_tjtj||j�dStj||j�dSdS)Nr)rrrrr)rr�finalr r r
rs
zIncrementalEncoder.encodecCstjj|�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)�IncrementalDecoderrcCstjj||�d|_dS)Nr)r�BufferedIncrementalDecoderrr)rrr r r
r2szIncrementalDecoder.__init__cCsv|jrht|�dkr*tjj|�r"dSd|_n>d|_|dd�tjkrhtj|dd�||�\}}||dfStj|||�S)Nr�r)r!r)rrrr�
startswithr
)rrrrrrr r r
�_buffer_decode6sz!IncrementalDecoder._buffer_decodecCstjj|�d|_dS)Nr)rr rr)rr r r
rGszIncrementalDecoder.resetcCstjj|�}|d|jfS)Nr)rr rr)rrr r r
rKszIncrementalDecoder.getstatecCstjj||�|d|_dS)Nr)rr rr)rrr r r
rPszIncrementalDecoder.setstateN)r)rrrrr#rrrr r r r
r1s
rc@seZdZdd�Zddd�ZdS)�StreamWritercCs.tjj|�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.tjj|�y|`Wntk
r(YnXdS)N)rr&rrr%)rr r r
rbs
zStreamReader.resetrcCspt|�dkrtjj|�r\dSn>|dd�tjkr\tj|_tj|dd�|�\}}||dfStj|_tj||�S)Nrr!r)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
$
?>