
    E#i                     T    S SK r SSKJr  SSKJrJrJrJr  S
S jrS r	 " S S	5      r
g)    N   )TypeStr   )	BasicType	TupleType	normalizeparsec                    ^ ^ U U4S jnU$ )z
Used by BaseCoder subclasses as a convenience for implementing the
``from_type_str`` method required by ``ABIRegistry``.  Useful if normalizing
then parsing a type string with an (optional) expected base is required in
that method.
c                 ^   >^  [         R                  " T 5      UU U4S j5       n[        U5      $ )Nc                   > [        U5      n[        U5      n[        U5      nX:w  a  SR                  U[        U5      5      nTbp  [	        U[
        5      (       d%  [        SR                  U R                  U5      5      eUR                  T:w  a&  [        SR                  U R                  UT5      5      eT(       d2  UR                  b%  [        SR                  U R                  U5      5      eT(       a2  UR                  c%  [        SR                  U R                  U5      5      eUR                  5         T" XU5      $ )N{} (normalized to {})z&Cannot create {} for non-basic type {}z:Cannot create {} for type {}: expected type with base '{}'zHCannot create {} for type {}: expected type with no array dimension listzECannot create {} for type {}: expected type with array dimension list)r   r	   reprformat
isinstancer   
ValueError__name__basearrlistvalidate)	clstype_strregistrynormalized_type_strabi_typetype_str_reprexpected_baseold_from_type_strwith_arrlists	         d/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/ethereum/abi/base.pynew_from_type_str<parse_type_str.<locals>.decorator.<locals>.new_from_type_str   s<   "+H"501H NM. 7 > >!,-!
 (!(I66$@GGLL)  ==M1$$$*FLL))%   H$4$4$@ ..4f%/   0 0 8 ++16%,  $SH==    	functoolswrapsclassmethod)r   r    r   r   s   ` r   	decorator!parse_type_str.<locals>.decorator   s.    	*	+1	> 
,1	>f ,--r"    )r   r   r'   s   `` r   parse_type_strr*      s    5.n r"   c                 X   ^  [         R                  " T 5      U 4S j5       n[        U5      $ )z
Used by BaseCoder subclasses as a convenience for implementing the
``from_type_str`` method required by ``ABIRegistry``.  Useful if normalizing
then parsing a tuple type string is required in that method.
c                 ,  > [        U5      n[        U5      n[        U5      nX:w  a  SR                  U[        U5      5      n[	        U[
        5      (       d%  [        SR                  U R                  U5      5      eUR                  5         T" XU5      $ )Nr   z&Cannot create {} for non-tuple type {})	r   r	   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   s         r   r    /parse_tuple_type_str.<locals>.new_from_type_strX   s    '1,-X*3::()M
 (I..8??LL!  	 99r"   r#   )r   r    s   ` r   parse_tuple_type_strr.   Q   s/     __&': (:. ())r"   c                   D    \ rS rSrSrSrS rS r\S\	SS 4S j5       r
S	rg
)	BaseCoders   z1
Base class for all encoder and decoder classes.
Fc                     [        U 5      nUR                  5        HD  u  p4[        X#5      (       d#  [        SR	                  UUR
                  S95      e[        XU5        MF     U R                  5         g )NzProperty {key} not found on {cls_name} class. `{cls_name}.__init__` only accepts keyword arguments which are present on the {cls_name} class.)keycls_name)typeitemshasattrAttributeErrorr   r   setattrr   )selfkwargsr   r3   values        r   __init__BaseCoder.__init__z   sl    4j !,,.JC3$$$77=v!$ 8> 8  Du% ) 	r"   c                     g )Nr)   )r:   s    r   r   BaseCoder.validate   s    r"   r   returnc                     [        S5      e)z{
Used by :any:`ABIRegistry` to get an appropriate encoder or decoder
instance for the given type string and type registry.
zMust implement `from_type_str`)NotImplementedError)r   r   r   s      r   from_type_strBaseCoder.from_type_str   s     ""BCCr"   r)   N)r   
__module____qualname____firstlineno____doc__
is_dynamicr=   r   r&   r   rD   __static_attributes__r)   r"   r   r0   r0   s   s@     J& DD	D Dr"   r0   )NF)r$   
typing.abir   grammarr   r   r   r	   r*   r.   r0   r)   r"   r   <module>rN      s/     ?D*D%D %Dr"   