
    j                     f   S SK r S SKJrJrJr  SSKJrJrJrJ	r	J
r
Jr   " S S\ R                  5      r " S S\ R                  5      r " S	 S
\ R                  5      r " S S\\ R"                  5      r " S S\\ R$                  5      rS\S\\ R(                     4S jr\ R,                  " \5        g)    N)AnyOptionalTuple   )	IDNAError_unicode_dots_realabeldecodeencodeulabelc            	       `    \ rS rSrSrS
S\S\S\\\4   4S jjr	S
S\S\S\\\4   4S jjr
Srg	)Codec   aN  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`.
dataerrorsreturnc                 h    US:w  a  [        SU S35      eU(       d  g[        U5      [        U5      4$ )NstrictUnsupported error handling ""    r   )r   r   lenselfr   r   s      G/var/www/reloj-farallon/venv/lib/python3.13/site-packages/idna/codec.pyr   Codec.encode   s8    X:6(!DEEd|SY&&r   c                 h    US:w  a  [        SU S35      eU(       d  g[        U5      [        U5      4$ )Nr   r   r    r   )r   r
   r   r   s      r   r
   Codec.decode   s8    X:6(!DEEd|SY&&r    N)r   )__name__
__module____qualname____firstlineno____doc__strr   bytesintr   r
   __static_attributes__r"   r   r   r   r      sQ    '3 ' '5;L ''5 '# 'U38_ ' 'r   r   c            
       <    \ rS rSrSrS\S\S\S\\\	4   4S jr
Srg	)
IncrementalEncoder%   a  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                    US:w  a  [        SU S35      eU(       d  g[        R                  " U5      nSnU(       a#  US   (       d  SnUS	 OU(       d  US	 U(       a  Sn/ nSnU H7  nUR                  [	        U5      5        U(       a  US	-  nU[        U5      -  nM9     SR                  U5      U-   n	U[        U5      -  nX4$ )
Nr   r   r   r   r      .r   r   )r   r   splitappendr	   r   join)
r   r   r   r/   labelstrailing_dotresultsizelabelresult_bytess
             r   _buffer_encode!IncrementalEncoder._buffer_encode1   s    X:6(!DEE!''-":#2J2J#'LEMM&-(	CJD	  yy(<7L!!!!r   r"   N)r#   r$   r%   r&   r'   r(   boolr   r)   r*   r<   r+   r"   r   r   r-   r-   %   s2    	"3 " "D "U5RU:EV "r   r-   c            
       <    \ rS rSrSrS\S\S\S\\\	4   4S jr
Srg	)
IncrementalDecoderR   zIncremental 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   r   r/   r   c                    US:w  a  [        SU S35      eU(       d  g[        U[        5      (       d  [        US5      n[        R                  " U5      nSnU(       a#  US   (       d  SnUS	 OU(       d  US	 U(       a  Sn/ nS	nU H7  nUR                  [        U5      5        U(       a  US
-  nU[        U5      -  nM9     SR                  U5      U-   n	U[        U5      -  nX4$ )Nr   r   r   r   asciir    r1   .r   r   )	r   
isinstancer(   r   r3   r4   r   r   r5   )
r   r   r   r/   r6   r7   r8   r9   r:   
result_strs
             r   _buffer_decode!IncrementalDecoder._buffer_decode\   s    X:6(!DEE$$$tW%D!''-":"2J2J#&LEMM&-(	CJD	  XXf%4
L!!!!r   r"   N)r#   r$   r%   r&   r'   r   r(   r>   r   r*   rG   r+   r"   r   r   r@   r@   R   s1     "3  "  "D  "U3PS8_  "r   r@   c                       \ rS rSrSrg)StreamWriter   r"   Nr#   r$   r%   r&   r+   r"   r   r   rJ   rJ          r   rJ   c                       \ rS rSrSrg)StreamReader   r"   NrL   r"   r   r   rO   rO      rM   r   rO   namer   c           
          U S:w  a  g[         R                  " U [        5       R                  [        5       R                  [
        [        [        [        S9$ )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``.
idna2008N)rQ   r   r
   incrementalencoderincrementaldecoderstreamwriterstreamreader)	codecs	CodecInfor   r   r
   r-   r@   rJ   rO   )rQ   s    r   search_functionrZ      sC     zw~~w~~--!! r   )rX   typingr   r   r   corer   r   r	   r
   r   r   r   BufferedIncrementalEncoderr-   BufferedIncrementalDecoderr@   rJ   rO   r(   rY   rZ   registerr"   r   r   <module>r`      s     ' ' M M'FLL '<*":: *"Z*":: *"Z	5&-- 		5&-- 	# (6+;+;"< 0   r   