Your IP : 3.139.236.144
��Yft � @ s� d Z d d l Z d d l Z e j Z d d d � Z Gd d � d e j � Z Gd d � d e j � Z Gd
d � d e j � Z Gd d
� d
e j
� Z
d d � Z d S)z� Python 'utf-16' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
� N�strictc C s t j | | d � S)NT)�codecs�
utf_16_decode)�input�errors� r �5/opt/alt/python35/lib64/python3.5/encodings/utf_16.py�decode s r c @ sR e Z d Z d d d � Z d d d � Z d d � Z d d
� Z d d � Z d
S)�IncrementalEncoderr c C s t j j | | � d | _ d S)N)r r
�__init__�encoder)�selfr r r r r s zIncrementalEncoder.__init__Fc C sm | j d k rV t j | | j � d } t j d k rF t j | _ n t j | _ | S| j | | j � d S)Nr �little)r r �
utf_16_encoder �sys� byteorder�utf_16_le_encode�utf_16_be_encode)r
r �final�resultr r r �encode s zIncrementalEncoder.encodec C s t j j | � d | _ d S)N)r r
�resetr )r
r r r r ! s zIncrementalEncoder.resetc C s | j d k r d Sd S)N� r )r )r
r r r �getstate% s zIncrementalEncoder.getstatec C s@ | r d | _ n* t j d k r0 t j | _ n t j | _ d S)Nr )r r r r r r )r
�stater r r �setstate, s
zIncrementalEncoder.setstateN)�__name__�
__module__�__qualname__r r r r r r r r r r
s
r
c @ sO e Z d Z d d d � Z d d � Z d d � Z d d � Z d
d � Z d S)
�IncrementalDecoderr c C s t j j | | � d | _ d S)N)r �BufferedIncrementalDecoderr �decoder)r
r r r r r 6 s zIncrementalDecoder.__init__c C s� | j d k r� t j | | d | � \ } } } | d k rK t j | _ n3 | d k rf t j | _ n | d k r~ t d � � | | f S| j | | j | � S)Nr � r z%UTF-16 stream does not start with BOM���)r! r �utf_16_ex_decode�utf_16_le_decode�utf_16_be_decode�UnicodeErrorr )r
r r r �output�consumedr r r r �_buffer_decode: s !
z!IncrementalDecoder._buffer_decodec C s t j j | � d | _ d S)N)r r r r! )r
r r r r G s zIncrementalDecoder.resetc C s` t j j | � d } | j d k r/ | d f St t j d k | j t j k k � } | | f S)Nr r �big)r r r r! �intr r r&