
    E#i                     z    S SK r S SKJrJrJrJrJr  SSKJr  \(       a  S SKJ	r	  \\
\\\\\4   r " S S\5      rg)    N)TYPE_CHECKINGTypeUnioncastoverload   )to_bytes)SupportsIndexc                      ^  \ rS rSrSrS\\   S\SS 4U 4S jjr SS\	\
\4   SS	S\
4U 4S
 jjjr\SS	S\4S j5       r\S\SS 4S j5       rS\	S	\4   S\	\\S 4   4U 4S jjrS\
4S jrSrU =r$ )HexBytes   aD  
HexBytes is a *very* thin wrapper around the python built-in :class:`bytes` class.

It has these three changes:
    1. Accepts more initializing values, like hex strings, non-negative integers,
       and booleans
    2. Returns hex with prefix '0x' from :meth:`HexBytes.hex`
    3. The representation at console is in hex
clsvalreturnc                 T   > [        U5      n[        [        [        TU ]  X5      5      $ N)r	   r   r   super__new__)r   r   bytesval	__class__s      i/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/ethereum/hexbytes/main.pyr   HexBytes.__new__!   s"    C=Hegoc<==    sepbytes_per_sepr
   c                 &   > S[         TU ]  5       -   $ )zy
Output hex-encoded bytes, with an "0x" prefix.

Everything following the "0x" is output exactly like :meth:`bytes.hex`.
0x)r   hex)selfr   r   r   s      r   r   HexBytes.hex%   s     egkm##r   keyc                     g r    r   r!   s     r   __getitem__HexBytes.__getitem__/       r   c                     g r   r#   r$   s     r   r%   r&   3   r'   r   c                 j   > [         TU ]  U5      n[        US5      (       a  [        U 5      " U5      $ U$ )Nr   )r   r%   hasattrtype)r   r!   resultr   s      r   r%   r&   7   s5     $S)65!!:f%%Mr   c                 ,    SU R                  5       < S3$ )Nz	HexBytes())r   )r   s    r   __repr__HexBytes.__repr__@   s    488:.**r   r#   )Nr   )__name__
__module____qualname____firstlineno____doc__r   bytes	BytesLiker   r   strr   r   intr%   slicer/   __static_attributes____classcell__)r   s   @r   r   r      s    >T%[ >y >Z >
 OP$e$$<K$	$ $  3   u   %/0	sE:%	&+# + +r   r   )systypingr   r   r   r   r   _utilsr	   r
   bool	bytearrayr6   r9   r8   
memoryviewr7   r   r#   r   r   <module>rC      sF    
   $	5#sJ>?	++u ++r   