
    (i                     B   d dl mZmZmZ d dlmZ d dlmZ d dlm	Z
 d dlmZmZmZmZmZ d dlmZmZmZmZmZmZ d dlmZ eedge
j4                  f   Zee
j4                  ef   Z G d	 de      Zd
edede
j4                  fdZd
edede
j4                  fdZ e
j@                  dd      jC                  e      Z" e
jF                         Z$d
edede
j4                  fdZ%d
edede
j4                  fdZ&d
edede
j4                  fdZ' e
j@                  d d      Z( e
jR                         Z*d
edede
j4                  fdZ+d
edede
j4                  fdZ, e       Z-e-j]                   ed      ed       e-j]                   ed      ed       e-j]                   edd      e"d       e-j]                   edd      e$d       e-j]                   ed      e%d       e-j]                   ed      e&d       e-j]                   ed d!      e'd"       e-j]                   ed d      e(d        e-j]                   ed#d      e'd#       e-j]                   ed$d      e*d$       e-j]                  ee+d%       e-j]                  ee,d&       e-j^                  Z0y')(    )CallableOptionalUnion)TypeStr)to_checksum_address)
strategies)ABIType	BasicType	TupleType	normalizeparse)
BaseEqualsBaseRegistryLookupPredicateMappinghas_arrlistis_base_tuple)scale_placesStrategyRegistryc            	       j    e Zd ZddZ	 ddededee   ddfdZdeddfd	Z	d
e
dej                  fdZy)r   returnNc                 $    t        d      | _        y )Nzstrategy registry)r   _strategies)selfs    J/var/www/br/venv/lib/python3.12/site-packages/eth_abi/tools/_strategies.py__init__zStrategyRegistry.__init__)   s    +,?@    lookupregistrationlabelc                 B    | j                  | j                  |||       y )Nr    )	_registerr   )r   r   r   r    s       r   register_strategyz"StrategyRegistry.register_strategy,   s     	t''UKr   lookup_or_labelc                 <    | j                  | j                  |       y N)_unregisterr   )r   r%   s     r   unregister_strategyz$StrategyRegistry.unregister_strategy4   s    ))?;r   type_strc                     | j                  | j                  |      }t        |t        j                        r|S t        |      }t        |      } |||       }|S )a[  
        Returns a hypothesis strategy for the given ABI type.

        :param type_str: The canonical string representation of the ABI type
            for which a hypothesis strategy should be returned.

        :returns: A hypothesis strategy for generating Python values that are
            encodable as values of the given ABI type.
        )_get_registrationr   
isinstancestSearchStrategyr   r   )r   r*   r   normalized_type_strabi_typestrategys         r   get_strategyzStrategyRegistry.get_strategy7   s[     --d.>.>IlB$5$56 #,H"501H#Hd3HOr   )r   Nr'   )__name__
__module____qualname__r   r   StrategyRegistrationr   strr$   r)   r   r.   r/   r3    r   r   r   r   (   sm    A  $	LL +L }	L
 
L<6 <d <W 1B1B r   r1   registryr   c                 T    | j                   }t        j                  dd|z  dz
        S )Nr         	min_value	max_valuesubr.   integersr1   r:   bitss      r   get_uint_strategyrF   P   s,     <<D;;T'A+ r   c                 h    | j                   }t        j                  d|dz
  z   d|dz
  z  dz
        S )Nr<   r=   r>   rA   rD   s      r   get_int_strategyrH   [   s<     <<D;;$(O$q/A% r      min_sizemax_sizec                     | j                   \  }}t        j                  dd|z  dz
  d      j                  t	        |            S )Nr   r<   r=   r?   r@   placesrB   r.   decimalsmapr   r1   r:   rE   rO   s       r   get_ufixed_strategyrT   j   sD     <<LD&;;T'A+ 
c,v
	 r   c                     | j                   \  }}t        j                  d|dz
  z   d|dz
  z  dz
  d      j                  t	        |            S )Nr<   r=   r   rN   rP   rS   s       r   get_fixed_strategyrV   v   sT     <<LD&;;$(O$q/A% 
c,v
	 r   c                 H    | j                   }t        j                  ||      S )NrJ   )rB   r.   binary)r1   r:   	num_bytess      r   get_bytes_strategyrZ      s$     I99 r   i   c                     | j                   }|j                         }|j                  |      }| j                  d   }t	        |      dk(  rt        j                  |      S |d   }t        j                  |||      S )Nr   rJ   )	item_typeto_type_strr3   arrlistlenr.   lists)r1   r:   r]   item_type_stritem_strategylast_dimdim_sizes          r   get_array_strategyrf      sv     ""I))+M))-8M#H
8}xx&& A;xx8LLr   c                     | j                   D cg c]!  }|j                  |j                               # }}t        j                  | S c c}w r'   )
componentsr3   r^   r.   tuples)r1   r:   comp_abi_typecomponent_strategiess       r   get_tuple_strategyrl      sS    
 &00 	m779: 
 99*++s   &A	uintr"   intaddressF)with_subboolufixedfixedbytesTzbytes<M>functionstringr   r   N)1typingr   r   r   eth_typing.abir   	eth_utilsr   
hypothesisr   r.   eth_abi.grammarr	   r
   r   r   r   eth_abi.registryr   r   r   r   r   r   eth_abi.utils.numericr   r/   StrategyFactoryr7   r   rF   rH   rX   rR   address_strategybooleansbool_strategyrT   rV   rZ   bytes_strategytextstring_strategyrf   rl   strategy_registryr$   r3   get_abi_strategyr9   r   r   <module>r      s|      G%78":K:KKLR..?@ %| %P#3#3 299b26::;NO 	 	 #3	 	 	 	 #3	 	 #3 A5"'')MM!1MM",,#3,, %&   # #v
 $ 
  # #u
 $ 
  # #y5)
 $ 
  # #v&
 $ 
  # #x
 $ 
  # #w
 $ 
  # #w&
 $ 
  # #w'
 $ 
  # #zE*
 $ 
  # #x%(
 $ 
  # #
 $ 
  # #
 $  %11 r   