î
\á[\ä  ã               @   sÏ   d  Z  d d l Z d d l Z d d d „ Z d d 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)z Python 'hex_codec' Codec - 2-digit hex content transfer encoding.

This codec de/encodes from bytes to bytes.

Written by Marc-Andre Lemburg (mal@lemburg.com).
é    NÚstrictc             C   s+   | d k s t  ‚ t j |  ƒ t |  ƒ f S)Nr   )ÚAssertionErrorÚbinasciiÚb2a_hexÚlen)ÚinputÚerrors© r	   ú)/usr/lib/python3.4/encodings/hex_codec.pyÚ
hex_encode   s    r   c             C   s+   | d k s t  ‚ t j |  ƒ t |  ƒ f S)Nr   )r   r   Úa2b_hexr   )r   r   r	   r	   r
   Ú
hex_decode   s    r   c               @   s.   e  Z d  Z d d d „ Z d d d „ Z d S)ÚCodecr   c             C   s   t  | | ƒ S)N)r   )Úselfr   r   r	   r	   r
   Úencode   s    zCodec.encodec             C   s   t  | | ƒ S)N)r   )r   r   r   r	   r	   r
   Údecode   s    zCodec.decodeN)Ú__name__Ú
__module__Ú__qualname__r   r   r	   r	   r	   r
   r      s   r   c               @   s   e  Z d  Z d d d „ Z d S)ÚIncrementalEncoderFc             C   s"   |  j  d k s t ‚ t j | ƒ S)Nr   )r   r   r   r   )r   r   Úfinalr	   r	   r
   r      s    zIncrementalEncoder.encodeN)r   r   r   r   r	   r	   r	   r
   r      s   r   c               @   s   e  Z d  Z d d d „ Z d S)ÚIncrementalDecoderFc             C   s"   |  j  d k s t ‚ t j | ƒ S)Nr   )r   r   r   r   )r   r   r   r	   r	   r
   r   !   s    zIncrementalDecoder.decodeN)r   r   r   r   r	   r	   r	   r
   r       s   r   c               @   s   e  Z d  Z e Z d S)ÚStreamWriterN)r   r   r   ÚbytesÚcharbuffertyper	   r	   r	   r
   r   %   s   r   c               @   s   e  Z d  Z e Z d S)ÚStreamReaderN)r   r   r   r   r   r	   r	   r	   r
   r   (   s   r   c               C   s:   t  j d d d t d t d t d t d t d t d	 d
 ƒ S)NÚnameÚhexr   r   ÚincrementalencoderÚincrementaldecoderÚstreamwriterÚstreamreaderÚ_is_text_encodingF)ÚcodecsÚ	CodecInfor   r   r   r   r   r   r	   r	   r	   r
   Úgetregentry-   s    	r%   )Ú__doc__r#   r   r   r   r   r   r   r   r   r%   r	   r	   r	   r
   Ú<module>   s   