Your IP : 18.227.134.165


Current Path : /lib64/python3.8/encodings/__pycache__/
Upload File :
Current File : //lib64/python3.8/encodings/__pycache__/utf_16.cpython-38.pyc

U

e5dt�@sxdZddlZddlZejZddd�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�strictcCst�||d�S)NT)�codecs�
utf_16_decode)�input�errors�r�(/usr/lib64/python3.8/encodings/utf_16.py�decodesr	c@s8eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)�IncrementalEncoderrcCstj�||�d|_dS�N)rr
�__init__�encoder��selfrrrrrszIncrementalEncoder.__init__FcCsN|jdkr<t�||j�d}tjdkr0tj|_ntj|_|S|�||j�dS)Nr�little)r
r�
utf_16_encoder�sys�	byteorder�utf_16_le_encode�utf_16_be_encode)rr�final�resultrrr�encodes


zIncrementalEncoder.encodecCstj�|�d|_dSr)rr
�resetr
�rrrrr!szIncrementalEncoder.resetcCs|jdkrdSdS)N�r)r
rrrr�getstate%szIncrementalEncoder.getstatecCs,|rd|_ntjdkr tj|_ntj|_dS�Nr)r
rrrrr�r�staterrr�setstate,s


zIncrementalEncoder.setstateN)r)F)�__name__�
__module__�__qualname__rrrrr rrrrr
s



r
c@s6eZdZd
dd�Zdd�Zdd�Zdd	�Zd
d�ZdS)�IncrementalDecoderrcCstj�||�d|_dSr)r�BufferedIncrementalDecoderr�decoderrrrrr6szIncrementalDecoder.__init__cCsl|jdkr\t�||d|�\}}}|dkr2tj|_n"|dkrDtj|_n|dkrTtd��||fS|�||j|�S)Nr����r�%UTF-16 stream does not start with BOM)r&r�utf_16_ex_decode�utf_16_le_decode�utf_16_be_decode�UnicodeErrorr)rrrr�output�consumedrrrr�_buffer_decode:s
�

z!IncrementalDecoder._buffer_decodecCstj�|�d|_dSr)rr%rr&rrrrrGszIncrementalDecoder.resetcCsDtj�|�d}|jdkr"|dfSttjdk|jtjkk�}||fS)Nrr�big)rr%rr&�intrrr,)rrZaddstaterrrrKs


�zIncrementalDecoder.getstatecCsdtj�||�|d}|dkr8tjdkr.tjntj|_n(|dkrZtjdkrPtjntj|_nd|_dS)Nr(rr1)rr%r rrr,r+r&rrrrr Ys����zIncrementalDecoder.setstateN)r)r!r"r#rr0rrr rrrrr$5s


r$c@s(eZdZd	dd�Zdd�Zd
dd�ZdS)�StreamWriterrcCstj�|||�d|_dSr)rr3rr
)r�streamrrrrriszStreamWriter.__init__cCstj�|�d|_dSr)rr3rr
rrrrrmszStreamWriter.resetcCsF|jdkr6t�||�}tjdkr*tj|_ntj|_|S|�||�SdSr)r
rrrrrr)rrrrrrrrqs


zStreamWriter.encodeN)r)r)r!r"r#rrrrrrrr3hs
r3c@seZdZdd�Zddd�ZdS)�StreamReadercCs.tj�|�z|`Wntk
r(YnXdSr)rr5rr	�AttributeErrorrrrrr~s
zStreamReader.resetrcCsRt�||dd�\}}}|dkr(tj|_n"|dkr:tj|_n|dkrJtd��||fS)NrFr'r(rr))rr*r+r	r,r-)rrr�objectr/rrrrr	�s�

zStreamReader.decodeN)r)r!r"r#rr	rrrrr5|sr5c	Cstjdttttttd�S)Nzutf-16)�namerr	�incrementalencoder�incrementaldecoder�streamreader�streamwriter)r�	CodecInforr	r
r$r5r3rrrr�getregentry�s�r>)r)�__doc__rrrrr	r
r%r$r3r5r>rrrr�<module>s
#3

?>