HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/idna/__pycache__/codec.cpython-310.pyc
o

;j��@s�ddlZddlmZmZddlmZmZmZmZm	Z	m
Z
Gdd�dej�ZGdd�dej�Z
Gd	d
�d
ej�ZGdd�deej�ZGd
d�deej�Zdedeejfdd�Ze�e�dS)�N)�Any�Optional�)�	IDNAError�_unicode_dots_re�alabel�decode�encode�ulabelc	@sPeZdZdZddededeeeffdd�Zddededeeeffdd	�Z	d
S)�CodecafStateless 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�returncC�0|dkrtd|�d���|sdSt|�t|�fS)Nr�Unsupported error handling "�"��r)rr	�len��selfr
r�r�>/opt/saltstack/salt/lib/python3.10/site-packages/idna/codec.pyr	�
zCodec.encodecCr)Nrrr��r)rrrrrrrrrzCodec.decodeN)r)
�__name__�
__module__�__qualname__�__doc__�str�tuple�bytes�intr	rrrrrrs 
$	rc
@s2eZdZdZdedededeeeffdd�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�finalrc
Cs�|dkrtd|�d���|sdSt�|�}d}|r,|ds#d}|d=n	|s,|d=|r,d}g}d}|D]}|�t|��|rA|d	7}|t|�7}q2d�|�|}	|t|�7}|	|fS)
Nrrrrr����.rr)rr�split�appendrr�join)
rr
rr&�labels�trailing_dot�result�size�labelZresult_bytesrrr�_buffer_encode1s0
z!IncrementalEncoder._buffer_encodeN)
rrrr r!�boolr"r#r$r1rrrrr%%s&r%c
@s2eZdZdZdedededeeeffdd�Z	dS)	�IncrementalDecoderaIncremental IDNA 2008 decoder.

    Buffers a partial trailing label across calls until either the next
    label separator is seen or ``final=True``, so that streamed input is
    decoded one whole label at a time.

    Only the ``"strict"`` error handler is supported.
    r
rr&rc
Cs�|dkrtd|�d���|sdSt|t�st|d�}t�|�}d}|r6|ds-d}|d=n	|s6|d=|r6d}g}d	}|D]}|�t|��|rK|d
7}|t|�7}q<d�|�|}	|t|�7}|	|fS)Nrrrr�asciirr'�.rr)	r�
isinstancer!rr)r*r
rr+)
rr
rr&r,r-r.r/r0Z
result_strrrr�_buffer_decode\s4


z!IncrementalDecoder._buffer_decodeN)
rrrr rr!r2r"r$r7rrrrr3Rs&	r3c@�eZdZdS)�StreamWriterN�rrrrrrrr9�r9c@r8)�StreamReaderNr:rrrrr<�r;r<�namerc	Cs,|dkrdStj|t�jt�jttttd�S)a�Codec search function registered with :mod:`codecs`.

    Returns a :class:`codecs.CodecInfo` for the ``"idna2008"`` codec name
    so that ``str.encode("idna2008")`` and ``bytes.decode("idna2008")``
    invoke the IDNA 2008 codec defined in this module.

    :param name: The codec name being looked up.
    :returns: A :class:`codecs.CodecInfo` instance if ``name`` is
        ``"idna2008"``, otherwise ``None``.
    Zidna2008N)r=r	r�incrementalencoder�incrementaldecoder�streamwriter�streamreader)	�codecs�	CodecInforr	rr%r3r9r<)r=rrr�search_function�s�rD)rB�typingrr�corerrrrr	r
r�BufferedIncrementalEncoderr%�BufferedIncrementalDecoderr3r9r<r!rCrD�registerrrrr�<module>s --