
    ":h                     p    d dl Z d dlmZmZmZmZmZ ddlmZ erd dlm	Z	 ee
eeeeef   Z G d de      Zy)    N)TYPE_CHECKINGTypeUnioncastoverload   )to_bytes)SupportsIndexc                        e Zd ZdZdee   dedd f fdZ	 ddee	ef   ddde	f fd	Z
ed
ddefd       Zed
edd fd       Zd
edef   deeed f   f fdZde	fdZ xZS )HexBytesa`  
    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                 V    t        |      }t        t        t        |   | |            S N)r	   r   r   super__new__)r   r   bytesval	__class__s      i/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/static_dependencies/ethereum/hexbytes/main.pyr   zHexBytes.__new__!   s$    C=Hegoc8<==    sepbytes_per_sepr
   c                 &    dt         |          z   S )z
        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   zHexBytes.hex%   s     egkm##r   keyc                      y r    r   r   s     r   __getitem__zHexBytes.__getitem__/       r   c                      y r   r    r!   s     r   r"   zHexBytes.__getitem__3   r#   r   c                 `    t         |   |      }t        |d      r t        |       |      S |S )Nr   )r   r"   hasattrtype)r   r   resultr   s      r   r"   zHexBytes.__getitem__7   s4     $S)65!4:f%%Mr   c                 *    d| j                         dS )Nz	HexBytes())r   )r   s    r   __repr__zHexBytes.__repr__@   s    488:.**r   )Nr   )__name__
__module____qualname____doc__r   bytes	BytesLiker   r   strr   r   intr"   slicer+   __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	bytearrayr0   r3   r2   
memoryviewr1   r   r    r   r   <module>r<      sF    
   $	5#sJ>?	++u ++r   