
    E#i                     N    S SK r S SKJr  S\\\\\\\4   S\4S jr	S\S\4S jr
g)    N)Unionvalreturnc                    [        U [        5      (       a  U $ [        U [        5      (       a  [        U 5      $ [        U [        5      (       a  [        U 5      $ [        U [
        5      (       a  U (       a  S$ S$ [        U [        5      (       a)  U S:  a  [        SU  S35      e[        [        U 5      5      $ [        U [        5      (       a  [        U 5      $ [        SU < S[        U 5       S35      e)z
Equivalent to: `eth_utils.hexstr_if_str(eth_utils.to_bytes, val)` .

Convert a hex string, integer, or bool, to a bytes representation.
Alternatively, pass through bytes or bytearray as a bytes value.
       r   z Cannot convert negative integer z	 to byteszCannot convert z	 of type )
isinstancebytesstrhexstr_to_bytes	bytearrayboolint
ValueErrorto_byteshex
memoryview	TypeErrortype)r   s    k/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/ethereum/hexbytes/_utils.pyr   r      s     #u
	C		s##	C	#	#Sz	C		w*7*	C		 7?uINOOCH%%	C	$	$Sz/#	$s)INOO    hexstrc                     U R                  S5      (       a  U SS  nOU n[        U 5      S-  (       a  SU-   nOUn UR                  S5      n[        R                  " U5      $ ! [
         a    [        SU S35      ef = f)N)0x0X   0asciizhex string z( may only contain [0-9a-fA-F] characters)
startswithlenencodebinascii	unhexlifyUnicodeDecodeErrorr   )r   non_prefixed_hex
padded_hex	ascii_hexs       r   r   r   #   s    &&!!":! 6{Q++
%
-%%g.	 !!),,  
*%MN
 	

s   A" "A<)r"   typingr   r   r   r
   r   r   r   r   r    r   r   <module>r*      sH    
P%iS*DE P% P8-C -E -r   