관리-도구
편집 파일: utf_16.cpython-310.opt-1.pyc
o 6��ft � @ sx d Z ddlZddlZejZddd�ZG dd� dej�ZG dd � d ej�ZG d d� dej �Z G dd � 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�strictc C s t �| |d�S )NT)�codecs� utf_16_decode)�input�errors� r �7/opt/alt/python310/lib64/python3.10/encodings/utf_16.py�decode s r c @ s8 e Zd Zddd�Zddd�Zdd� Zd d � Zdd� Zd S )�IncrementalEncoderr c C � t j�| |� d | _d S �N)r r �__init__�encoder��selfr r r r r � zIncrementalEncoder.__init__Fc C sP | j d u rt�|| j�d }tjdkrtj| _ |S tj| _ |S | � || 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 � t j�| � d | _d S r )r r �resetr �r r r r r ! � zIncrementalEncoder.resetc C s | j d u rdS dS )N� r )r r r r r �getstate% s zIncrementalEncoder.getstatec C s0 |rd | _ d S tjdkrtj| _ d S tj| _ d S �Nr )r r r r r r �r �stater r r �setstate, s zIncrementalEncoder.setstateN�r )F)�__name__� __module__�__qualname__r r r r r$ r r r r r s r c @ s6 e Zd Zd dd�Zdd� Zdd� Zdd � Zd d� ZdS )�IncrementalDecoderr c C r r )r �BufferedIncrementalDecoderr �decoderr r r r r 6 r zIncrementalDecoder.__init__c C sx | j d u r4t�||d|�\}}}|dkrtj| _ ||fS |dkr(tj| _ ||fS |dkr0td��||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 )r r r r �output�consumedr r r r �_buffer_decode: s ���z!IncrementalDecoder._buffer_decodec C r r )r r* r r+ r r r r r G r zIncrementalDecoder.resetc C sD t j�| �d }| jd u r|dfS ttjdk| jt ju k�}||fS )Nr r �big)r r* r r+ �intr r r1 )r r# Zaddstater r r r K s �zIncrementalDecoder.getstatec C st t j�| |� |d }|dkr tjdkrt j| _d S t j| _d S |dkr5tjdkr/t j| _d S t j| _d S d | _d S )Nr- r r6 )r r* r$ r r r1 r0 r+ r"