Your IP : 3.145.88.104


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

�
j fs�@s�dZddlZddlZejZddd�ZGdd�dej�ZGdd	�d	ej�ZGd
d�dej	�Z	Gdd
�d
ej
�Z
dd�ZdS)z� Python 'utf-16' Codec


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

�N�strictcCstj||d�S)NT)�codecs�
utf_16_decode)�input�errors�r�5/opt/alt/python34/lib64/python3.4/encodings/utf_16.py�decodesr	c@sReZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)�IncrementalEncoderrcCs tjj||�d|_dS)N)rr
�__init__�encoder)�selfrrrrrszIncrementalEncoder.__init__FcCsm|jdkrVtj||j�d}tjdkrFtj|_ntj|_|S|j||j�dS)Nr�little)rr�
utf_16_encoder�sys�	byteorder�utf_16_le_encode�utf_16_be_encode)r
r�final�resultrrr�encodeszIncrementalEncoder.encodecCstjj|�d|_dS)N)rr
�resetr)r
rrrr!szIncrementalEncoder.resetcCs|jdkrdSdS)N�r)r)r
rrr�getstate%szIncrementalEncoder.getstatecCs@|rd|_n*tjdkr0tj|_ntj|_dS)Nr)rrrrrr)r
�staterrr�setstate,s
zIncrementalEncoder.setstateN)�__name__�
__module__�__qualname__rrrrrrrrrr
s

r
c@sOeZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�IncrementalDecoderrcCs tjj||�d|_dS)N)r�BufferedIncrementalDecoderr�decoder)r
rrrrr6szIncrementalDecoder.__init__cCs�|jdkr�tj||d|�\}}}|dkrKtj|_n6|dkrftj|_n|dkr�td��n||fS|j||j|�S)Nr�rz%UTF-16 stream does not start with BOM���)r!r�utf_16_ex_decode�utf_16_le_decode�utf_16_be_decode�UnicodeErrorr)r
rrr�output�consumedrrrr�_buffer_decode:s!
z!IncrementalDecoder._buffer_decodecCstjj|�d|_dS)N)rr rr!)r
rrrrGszIncrementalDecoder.resetcCs`tjj|�d}|jdkr/|dfSttjdk|jtjkk�}||fS)Nrr�big)rr rr!�intrrr&)r
rZaddstaterrrrKs
zIncrementalDecoder.getstatecCs�tjj||�|d}|dkrPtjdkrAtjntj|_n<|dkr�tjdkrttjntj|_n	d|_dS)Nr"rr+)rr rrrr&r%r!)r
rrrrrYs
zIncrementalDecoder.setstateN)rrrrr*rrrrrrrr5s

rc@s:eZdZddd�Zdd�Zddd�ZdS)	�StreamWriterrcCs#tjj|||�d|_dS)N)rr-rr)r
�streamrrrrriszStreamWriter.__init__cCstjj|�d|_dS)N)rr-rr)r
rrrrmszStreamWriter.resetcCsc|jdkrOtj||�}tjdkr?tj|_ntj|_|S|j||�SdS)Nr)rrrrrrr)r
rrrrrrrqszStreamWriter.encodeN)rrrrrrrrrrr-hsr-c@s+eZdZdd�Zddd�ZdS)�StreamReadercCs3tjj|�y
|`Wntk
r.YnXdS)N)rr/rr	�AttributeError)r
rrrr~s


zStreamReader.resetrcCs|tj||dd�\}}}|dkr<tj|_n6|dkrWtj|_n|dkrrtd��n||fS)NrFr"rz%UTF-16 stream does not start with BOMr#)rr$r%r	r&r')r
rr�objectr)rrrrr	�s!zStreamReader.decodeN)rrrrr	rrrrr/|sr/cCs4tjdddtdtdtdtdtdt�S)	N�namezutf-16rr	�incrementalencoder�incrementaldecoder�streamreader�streamwriter)r�	CodecInforr	r
rr/r-rrrr�getregentry�s	r8)�__doc__rrrrr	r
r rr-r/r8rrrr�<module>s	#3

?>