File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/idna/__pycache__/codec.cpython-310.pyc
Back
o ;j� � @ s� d dl Z d dlmZmZ ddlmZmZmZmZm Z m Z G dd� de j�ZG dd� de j�Z G d d � d e j�ZG dd� dee j�ZG d d� dee j�Zdedee j fdd�Ze �e� dS )� N)�Any�Optional� )� IDNAError�_unicode_dots_re�alabel�decode�encode�ulabelc @ sP e Zd ZdZddededeeef fdd�Zddededeeef fdd �Z d S )�Codecaf Stateless IDNA 2008 codec. Implements the :class:`codecs.Codec` protocol so that the whole-domain encoder (:func:`idna.encode`) and decoder (:func:`idna.decode`) are accessible through the standard codec machinery as ``"idna2008"``. Only the ``"strict"`` error handler is supported; any other handler raises :exc:`~idna.IDNAError`. �strict�data�errors�returnc C �0 |dkrt d|� d���|sdS t|�t|�fS )Nr �Unsupported error handling "�"�� r )r r �len��selfr r � r �>/opt/saltstack/salt/lib/python3.10/site-packages/idna/codec.pyr � zCodec.encodec C r )Nr r r �� r )r r r r r r r r r zCodec.decodeN)r ) �__name__� __module__�__qualname__�__doc__�str�tuple�bytes�intr r r r r r r s $ r c @ s2 e Zd ZdZdedededeeef fdd�Z dS ) �IncrementalEncodera� Incremental IDNA 2008 encoder. Buffers a partial trailing label across calls until either the next label separator is seen or ``final=True``, so that streamed input is encoded one whole label at a time. Any of the four Unicode label separators (``U+002E``, ``U+3002``, ``U+FF0E``, ``U+FF61``) ends a label; the result always uses ``U+002E`` as the separator. Only the ``"strict"`` error handler is supported. r r �finalr c C s� |dkrt d|� d���|sdS t�|�}d}|r,|d s#d}|d= n |s,|d= |r,d}g }d}|D ]}|�t|�� |rA|d 7 }|t|�7 }q2d�|�| } |t|�7 }| |fS ) Nr r r r r ���� .r r )r r �split�appendr r �join) r r r r&