
    Mh^                     n   d dl Z d dlZd dlmZmZmZ ddlmZmZm	Z	m
Z
mZ  ej        d          Z G d de j                  Z G d d	e j                  Z G d
 de j                  Z G d dee j                  Z G d dee j                  Zdedee j                 fdZ e j        e           dS )    N)AnyOptionalTuple   )	IDNAErroralabeldecodeencodeulabelu   [.。．｡]c            	       Z    e Zd Zddededeeef         fdZddededeeef         fdZdS )	Codecstrictdataerrorsreturnc                     |dk    r"t          d                    |                    |sdS t          |          t          |          fS )Nr   Unsupported error handling "{}"    r   )r   formatr
   lenselfr   r   s      J/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/idna/codec.pyr
   zCodec.encode   sN    X=DDVLLMMM 	6d||SYY&&r   c                     |dk    r"t          d                    |                    |sdS t          |          t          |          fS )Nr   r    r   )r   r   r	   r   r   s      r   r	   zCodec.decode   sN    X=DDVLLMMM 	5d||SYY&&r   N)r   )	__name__
__module____qualname__strr   bytesintr
   r	    r   r   r   r   
   s        ' '3 ' '5;L ' ' ' '' '5 '# 'U38_ ' ' ' ' ' 'r   r   c            
       6    e Zd Zdedededeeef         fdZdS )IncrementalEncoderr   r   finalr   c                    |dk    r"t          d                    |                    |sdS t                              |          }d}|r|d         sd}|d= n	|s|d= |rd}g }d}|D ]=}|                    t          |                     |r|dz  }|t          |          z  }>d                    |          |z   }	|t          |          z  }|	|fS )	Nr   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_bytess
             r   _buffer_encodez!IncrementalEncoder._buffer_encode   s   X=DDVLLMMM 	6!''-- 	(": (#2JJ (2J (#'L 	 	EMM&--((( 	CJJDD yy((<7L!!!T!!r   N)	r   r   r    r!   boolr   r"   r#   r5   r$   r   r   r&   r&      sN        "3 " "D "U5RU:EV " " " " " "r   r&   c            
       6    e Zd Zdedededeeef         fdZdS )IncrementalDecoderr   r   r'   r   c                    |dk    r"t          d                    |                    |sdS t          |t                    st          |d          }t                              |          }d}|r|d         sd}|d= n	|s|d= |rd}g }d}|D ]=}|                    t          |                     |r|d	z  }|t          |          z  }>d	                    |          |z   }	|t          |          z  }|	|fS )
Nr   r   r   asciir   r)   .r   r   )
r   r   
isinstancer!   r+   r,   r-   r   r   r.   )
r   r   r   r'   r/   r0   r1   r2   r3   
result_strs
             r   _buffer_decodez!IncrementalDecoder._buffer_decodeA   s5   X=DDVLLMMM 	7$$$ 	&tW%%D!''-- 	'": '"2JJ '2J '#&L 	 	EMM&--((( 	CJJDDXXf%%4
L!!!D!!r   N)	r   r   r    r   r!   r6   r   r#   r>   r$   r   r   r8   r8   @   sM         "3  "  "D  "U3PS8_  "  "  "  "  "  "r   r8   c                       e Zd ZdS )StreamWriterNr   r   r    r$   r   r   r@   r@   d           Dr   r@   c                       e Zd ZdS )StreamReaderNrA   r$   r   r   rD   rD   h   rB   r   rD   namer   c           	          | dk    rd S t          j        | t                      j        t                      j        t
          t          t          t                    S )Nidna2008)rE   r
   r	   incrementalencoderincrementaldecoderstreamwriterstreamreader)	codecs	CodecInfor   r
   r	   r&   r8   r@   rD   )rE   s    r   search_functionrN   l   sM    ztww~ww~--!!   r   )rL   retypingr   r   r   corer   r   r	   r
   r   compiler+   r   BufferedIncrementalEncoderr&   BufferedIncrementalDecoderr8   r@   rD   r!   rM   rN   registerr$   r   r   <module>rV      s    				 ' ' ' ' ' ' ' ' ' ' ; ; ; ; ; ; ; ; ; ; ; ; ; ;2::;; ' ' ' ' 'FL ' ' '(" " " " ": " " "D!" !" !" !" !": !" !" !"H	 	 	 	 	5&- 	 	 		 	 	 	 	5&- 	 	 	# (6+;"<               r   