Your IP : 3.144.242.149


Current Path : /opt/alt/python34/lib64/python3.4/encodings/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/encodings/__pycache__/utf_8_sig.cpython-34.pyo

�
j f%�@s�dZddlZddd�Zddd�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�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�strictcCs'tjtj||�dt|�fS)Nr)�codecs�BOM_UTF8�utf_8_encode�len)�input�errors�r	�8/opt/alt/python34/lib64/python3.4/encodings/utf_8_sig.py�encodesrcCsad}|dd�tjkr8|dd�}d}ntj||d�\}}|||fS)Nr�T)rr�utf_8_decode)rr�prefix�output�consumedr	r	r
�decodes	rc@sReZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)�IncrementalEncoderrcCs tjj||�d|_dS)N�)rr�__init__�first)�selfrr	r	r
rszIncrementalEncoder.__init__FcCsK|jr0d|_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)�__name__�
__module__�__qualname__rrrrrr	r	r	r
rs
rc@sOeZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�IncrementalDecoderrcCs tjj||�d|_dS)Nr)r�BufferedIncrementalDecoderrr)rrr	r	r
r2szIncrementalDecoder.__init__cCs�|jr�t|�dkr=tjj|�r1dSd|_q�d|_|dd�tjkr�tj|dd�||�\}}||dfSntj|||�S)Nr�r)r!r)rrrr�
startswithr
)rrrrrrr	r	r
�_buffer_decode6s		%z!IncrementalDecoder._buffer_decodecCstjj|�d|_dS)Nr)rr rr)rr	r	r
rGszIncrementalDecoder.resetcCs#tjj|�}|d|jfS)Nr)rr rr)rrr	r	r
rKszIncrementalDecoder.getstatecCs$tjj||�|d|_dS)Nr)rr rr)rrr	r	r
rPszIncrementalDecoder.setstateN)rrrrr#rrrr	r	r	r
r1s
rc@s+eZdZdd�Zddd�ZdS)�StreamWritercCs3tjj|�y
|`Wntk
r.YnXdS)N)rr$rr�AttributeError)rr	r	r
rVs


zStreamWriter.resetrcCstj|_t||�S)N)rrr)rrrr	r	r
r]szStreamWriter.encodeN)rrrrrr	r	r	r
r$Usr$c@s+eZdZdd�Zddd�ZdS)�StreamReadercCs3tjj|�y
|`Wntk
r.YnXdS)N)rr&rrr%)rr	r	r
rbs


zStreamReader.resetrcCs�t|�dkr+tjj|�r�dSnU|dd�tjkr�tj|_tj|dd�|�\}}||dfStj|_tj||�S)Nrr!r)r!r)rrrr"r
r)rrrrrr	r	r
ris"zStreamReader.decodeN)rrrrrr	r	r	r
r&asr&cCs4tjdddtdtdtdtdtdt�S)	N�namez	utf-8-sigrr�incrementalencoder�incrementaldecoder�streamreader�streamwriter)r�	CodecInforrrrr&r$r	r	r	r
�getregentryys	r-)
�__doc__rrrrr rr$r&r-r	r	r	r
�<module>	s$

?>