+
    ^]                     B   R t ^ RIHt ^ RIt^ RIt ] Rt	RR lt
RR lt ! R R]P                  4      t ! R R	]P                  4      t ! R
 R]P                  4      t ! R R]]P                  4      t ! R R]]P                   4      tR tR#   ]]3 d    ]t Li ; i)aL  Python 'hex' Codec - 2-digit hex with spaces content transfer encoding.

Encode and decode may be a bit missleading at first sight...

The textual representation is a hex dump: e.g. "40 41"
The "encoded" data of this is the binary form, e.g. b"@A"

Therefore decoding is binary to text and thus converting binary data to hex dump.

)absolute_importN0123456789ABCDEFc           	         \         P                  ! V P                  4        Uu. uF  p\        V^4      NK  	  up4      \	        V 4      3# u upi z'40 41 42' -> b'@ab')serialto_bytessplitintlen)dataerrorshs   && </usr/lib/python3/dist-packages/serial/tools/hexlify_codec.py
hex_encoder   &   s8    OO>ASBZ>?TKK>s   A
c                    \        RP                  R \        P                  ! V 4       4       4      4      \	        V 4      3# )b'@ab' -> '40 41 42' c              3   V   "   T F  pR P                  \        V4      4      x  K!  	  R# 5iz{:02X} Nformatord.0bs   & r   	<genexpr>hex_decode.<locals>.<genexpr>-   s$     U>TI,,SV44>T   '))unicodejoinr   	iterbytesr
   )r   r   s   &&r   
hex_decoder!   +   s3    BGGUf>N>Nt>TUUVX[\`Xabb    c                   4   a  ] tR t^0t o RR ltRR ltRtV tR# )Codecc           	         \         P                  ! VP                  4        Uu. uF  p\        V^4      NK  	  up4      # u upi r   )r   r   r   r	   )selfr   r   r   s   &&& r   encodeCodec.encode1   s/    DJJLALqAr
LABBAs   ?c                l    \        RP                  R \        P                  ! V4       4       4      4      # )r   r   c              3   V   "   T F  pR P                  \        V4      4      x  K!  	  R# 5ir   r   r   s   & r   r   Codec.decode.<locals>.<genexpr>7   $     XAWAy//A77AWr   r   r   r   r    )r&   r   r   s   &&&r   decodeCodec.decode5   s(    rwwXAQAQRVAWXXYYr"    Nstrict)__name__
__module____qualname____firstlineno__r'   r.   __static_attributes____classdictcell____classdict__s   @r   r$   r$   0   s     CZ Zr"   r$   c                   J   a  ] tR t^:t o RtR	R ltR tR tR tR
R lt	Rt
V tR# )IncrementalEncoderzIncremental hex encoderc                     Wn         ^ V n        R#     Nr   state)r&   r   s   &&r   __init__IncrementalEncoder.__init__=   s    
r"   c                    ^ V n         R# r>   rA   r&   s   &r   resetIncrementalEncoder.resetA   s	    
r"   c                    V P                   # NrE   rF   s   &r   getstateIncrementalEncoder.getstateD   s    zzr"   c                    Wn         R # rJ   rE   )r&   rA   s   &&r   setstateIncrementalEncoder.setstateG   s    
r"   c                   V P                   p. pVP                  4        F  pV\        9   dR   \        P                  V4      pV'       d#   VP	                  Wc^,          ,           4       ^ pKM  RV^,          ,           pK_  VR8X  d)   V'       d   V P
                  R8X  d   \        R4      h^ pK  V P
                  R8X  g   K  \        RP                  V4      4      h	  W0n         \        P                  ! V4      # )zIncremental encode, keep track of digits and emit a byte when a pair
of hex digits is found. The space is optional unless the error
handling is defined to be 'strict'.
    r2   zodd number of hex digitsznon-hex digit found: {!r})
rA   upper	HEXDIGITSindexappendr   UnicodeErrorr   r   r   )r&   r   finalrA   encodedczs   &&&    r   r'   IncrementalEncoder.encodeJ   s     

AI~OOA&NN1#56E!Q!V,EcT[[H4&'ABB;;(*&'B'I'I!'LMM  
w''r"   r@   Nr1   F)r3   r4   r5   r6   __doc__rB   rG   rK   rN   r'   r7   r8   r9   s   @r   r<   r<   :   s&     !( (r"   r<   c                   .   a  ] tR t^et o RtRR ltRtV tR# )IncrementalDecoderzIncremental decoderc                l    \        R P                  R \        P                  ! V4       4       4      4      # )r   c              3   V   "   T F  pR P                  \        V4      4      x  K!  	  R# 5ir   r   r   s   & r   r   ,IncrementalDecoder.decode.<locals>.<genexpr>h   r,   r   r-   )r&   r   rX   s   &&&r   r.   IncrementalDecoder.decodeg   s(    rwwXAQAQRVAWXXYYr"   r0   Nr]   )r3   r4   r5   r6   r^   r.   r7   r8   r9   s   @r   r`   r`   e   s     Z Zr"   r`   c                       ] tR t^ktRtRtR# )StreamWriterz-Combination of hexlify codec and StreamWriterr0   Nr3   r4   r5   r6   r^   r7   r0   r"   r   rf   rf   k       7r"   rf   c                       ] tR t^otRtRtR# )StreamReaderz-Combination of hexlify codec and StreamReaderr0   Nrg   r0   r"   r   rj   rj   o   rh   r"   rj   c            
     l    \         P                  ! R\        \        \        \
        \        \        R7      # )zencodings module APIhexlify)namer'   r.   incrementalencoderincrementaldecoderstreamwriterstreamreader)codecs	CodecInfor   r!   r<   r`   rf   rj   r0   r"   r   getregentryrt   s   s*    --!!	 	r"   r1   )r^   
__future__r   rr   r   r   	NameErrorAttributeErrorstrrT   r   r!   r$   r<   r`   rf   rj   rt   r0   r"   r   <module>ry      s   
 '  
 	
L
c
ZFLL Z((22 ((VZ22 Z85&-- 885&-- 8m 	>" Gs   B BB