o
    ¡ØÆhÉ  ã                   @   sh   d dl mZmZ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„ deƒZdS )é    )ÚTYPE_CHECKINGÚCallableÚTupleÚTypeÚUnionÚcastÚoverloadé   )Úto_bytes)ÚSupportsIndexc                       sÌ   e Zd ZdZdee dedd f‡ fdd„Zeddde	fd	d
„ƒZ
ededd fdd
„ƒZ
dedef dee	ed f f‡ fdd
„Z
defdd„Zdefdd„Zdeedef eed  ef f fdd„Z‡  ZS )ÚHexBytesaW  
    Thin wrapper around the python built-in :class:`bytes` class.

    It has these changes:
        1. Accepts more initializing values: bool, bytearray, bytes, (non-negative) int,
           str, and memoryview
        2. The representation at console (__repr__) is 0x-prefixed
        3. ``to_0x_hex`` returns a 0x-prefixed hex string
    ÚclsÚvalÚreturnc                    s   t |ƒ}tttƒ  | |¡ƒS ©N)r
   r   r   ÚsuperÚ__new__)r   r   Úbytesval©Ú	__class__© úZ/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/hexbytes/main.pyr   "   s   zHexBytes.__new__Úkeyr   c                 C   ó   d S r   r   ©Úselfr   r   r   r   Ú__getitem__&   ó   zHexBytes.__getitem__c                 C   r   r   r   r   r   r   r   r   *   r   c                    s&   t ƒ  |¡}t|dƒrt| ƒ|ƒS |S )NÚhex)r   r   ÚhasattrÚtype)r   r   Úresultr   r   r   r   .   s   
c                 C   s   dd|   ¡  ›d�S )Nz	HexBytes(Ú0xú)©r   ©r   r   r   r   Ú__repr__7   s   zHexBytes.__repr__c                 C   s   d|   ¡  S )z?
        Convert the bytes to a 0x-prefixed hex string
        r"   r$   r%   r   r   r   Ú	to_0x_hex:   s   zHexBytes.to_0x_hex.c                 C   s   t jt| ƒt | ƒffS )zÅ
        An optimized ``__reduce__`` that bypasses the input validation in
        ``HexBytes.__new__`` since an existing HexBytes instance has already been
        validated when created.
        )Úbytesr   r    r%   r   r   r   Ú
__reduce__@   s   zHexBytes.__reduce__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r(   Ú	BytesLiker   r   Úintr   Úslicer   Ústrr&   r'   r   r   r)   Ú__classcell__r   r   r   r   r      s"    

ÿþ	þr   N)Útypingr   r   r   r   r   r   r   Ú_utilsr
   r   ÚboolÚ	bytearrayr(   r/   r1   Ú
memoryviewr.   r   r   r   r   r   Ú<module>   s   $ 
