
0c@_ã  ã               @   sâ   d  d l  m Z m Z m Z m Z m Z d d l Z d d l Z e j d ƒ Z	 Gd d „  d e j
 ƒ Z
 Gd d „  d e j ƒ Z Gd	 d
 „  d
 e j ƒ Z Gd d „  d e
 e j ƒ Z Gd d „  d e
 e j ƒ Z d d „  Z d S)é   )ÚencodeÚdecodeÚalabelÚulabelÚ	IDNAErroré    Nu   [.ã€‚ï¼Žï½¡]c               @   s.   e  Z d  Z d d d „ Z d d d „ Z d S)ÚCodecÚstrictc             C   sA   | d k r! t  d j | ƒ ƒ ‚ | s+ d St | ƒ t | ƒ f S)Nr	   z Unsupported error handling "{0}"Ú r   )r
   r   )r   Úformatr   Úlen)ÚselfÚdataÚerrors© r   ú5/tmp/pip-build-jynh7p1z/pip/pip/_vendor/idna/codec.pyr   	   s
    zCodec.encodec             C   sA   | d k r! t  d j | ƒ ƒ ‚ | s+ d St | ƒ t | ƒ f S)Nr	   z Unsupported error handling "{0}"r
   r   )r
   r   )r   r   r   r   )r   r   r   r   r   r   r      s
    zCodec.decodeN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s   
r   c               @   s   e  Z d  Z d d „  Z d S)ÚIncrementalEncoderc       	      C   sö   | d k r! t  d j | ƒ ƒ ‚ | s+ d St j | ƒ } d } | ry | d s` d } | d	 =n | sy | d
 =| ry d } g  } d } xA | D]9 } | j t | ƒ ƒ | rµ | d 7} | t | ƒ 7} qŒ Wd j | ƒ | } | t | ƒ 7} | | f S)Nr	   z Unsupported error handling "{0}"r
   r   r   Ú.)r
   r   éÿÿÿÿr   r   )r   r   Ú_unicode_dots_reÚsplitÚappendr   r   Újoin)	r   r   r   ÚfinalÚlabelsÚtrailing_dotÚresultÚsizeÚlabelr   r   r   Ú_buffer_encode   s0    


z!IncrementalEncoder._buffer_encodeN)r   r   r   r"   r   r   r   r   r      s   r   c               @   s   e  Z d  Z d d „  Z d S)ÚIncrementalDecoderc       	      C   s0  | d k r! t  d j | ƒ ƒ ‚ | s+ d St | t ƒ rL t j | ƒ } n( t | ƒ } t | d ƒ | j d ƒ } d } | r³ | d	 sš d } | d
 =n | s³ | d =| r³ d } g  } d } xA | D]9 } | j t | ƒ ƒ | rï | d 7} | t	 | ƒ 7} qÆ Wd j
 | ƒ | } | t	 | ƒ 7} | | f S)Nr	   z Unsupported error handling "{0}"r
   r   Úasciir   r   )r
   r   r   r   r   )r   r   Ú
isinstanceÚunicoder   r   Ústrr   r   r   r   )	r   r   r   r   r   r   r   r    r!   r   r   r   Ú_buffer_decode?   s8    


z!IncrementalDecoder._buffer_decodeN)r   r   r   r(   r   r   r   r   r#   >   s   r#   c               @   s   e  Z d  Z d S)ÚStreamWriterN)r   r   r   r   r   r   r   r)   g   s   r)   c               @   s   e  Z d  Z d S)ÚStreamReaderN)r   r   r   r   r   r   r   r*   j   s   r*   c               C   s@   t  j d d d t ƒ  j d t ƒ  j d t d t d t d t ƒ S)	NÚnameÚidnar   r   ÚincrementalencoderÚincrementaldecoderÚstreamwriterÚstreamreader)	ÚcodecsÚ	CodecInfor   r   r   r   r#   r)   r*   r   r   r   r   Úgetregentrym   s    	r3   )Úcorer   r   r   r   r   r1   ÚreÚcompiler   r   ÚBufferedIncrementalEncoderr   ÚBufferedIncrementalDecoderr#   r)   r*   r3   r   r   r   r   Ú<module>   s   (!)