File: //usr/local/lib/python3.7/site-packages/pip/_vendor/idna/__pycache__/codec.cpython-37.pyc
B
L��g.
� @ s� d dl mZmZmZmZmZ ddlZddlZddlm Z m
Z
e�d�ZG dd� dej
�Z
G dd � d ej�ZG d
d� dej�ZG dd
� d
e
ej�ZG dd� de
ej�Zejd�dd�ZdS )� )�encode�decode�alabel�ulabel� IDNAError� N)�Tuple�Optionalu [.。.。]c @ sD e Zd Zdeeeeef d�dd�Zd eeeeef d�dd�ZdS )
�Codec�strict)�data�errors�returnc C s. |dkrt d�|���|sdS t|�t|�fS )Nr zUnsupported error handling "{}")� r )r �formatr �len)�selfr r
� r �:/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/idna/codec.pyr
s
zCodec.encodec C s. |dkrt d�|���|sdS t|�t|�fS )Nr zUnsupported error handling "{}")� r )r r r r )r r r
r r r r s
zCodec.decodeN)r )r ) �__name__�
__module__�__qualname__�strr �bytes�intr r r r r r r
s r
c @ s( e Zd Zeeeeeef d�dd�ZdS )�IncrementalEncoder)r r
�finalr c
C s� |dkrt d�|���|sdS t�|�}d}|rV|d sDd}|d= n|sV|d= |rVd}g }d}x2|D ]*}|�t|�� |r�|d7 }|t|�7 }qdW d�|�| } |t|�7 }| |fS ) Nr zUnsupported error handling "{}")r r r ����.r r )r r �_unicode_dots_re�split�appendr r �join)
r r r
r �labels�trailing_dot�result�size�label�
result_strr r r �_buffer_encode s0
z!IncrementalEncoder._buffer_encodeN)r r r r �boolr r r* r r r r r s r c @ s( e Zd Zeeeeeef d�dd�ZdS )�IncrementalDecoder)r r
r r c
C s� |dkrt d�|���|sdS t�|�}d}|rV|d sDd}|d= n|sV|d= |rVd}g }d}x2|D ]*}|�t|�� |r�|d7 }|t|�7 }qdW d�|�| } |t|�7 }| |fS ) Nr zUnsupported error handling "{}")r r r r r r r )r r r r! r"