
    ":h                     R    d dl Z ddlmZ ddlmZmZmZmZ d
dZd Z	 G d d	      Z
y)    N   )TypeStr   )	BasicType	TupleType	normalizeparsec                       fd}|S )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                 Z     t        j                          fd       }t        |      S )Nc                 ^   t        |      }t        |      }t        |      }||k7  rdj                  |t        |            }jt	        |t
              s%t        dj                  | j                  |            |j                  k7  r&t        dj                  | j                  |            s1|j                  %t        dj                  | j                  |            r1|j                  %t        dj                  | j                  |            |j                           | ||      S )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/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/static_dependencies/ethereum/abi/base.pynew_from_type_strz<parse_type_str.<locals>.decorator.<locals>.new_from_type_str   s>   "+H"501H NM.. 7 > >!,-!
 (!(I6$@GGLL)  ==M1$$$*FLL))%   H$4$4$@ ..4f%/   0 0 8 ++16%,  $S(H==    	functoolswrapsclassmethod)r   r    r   r   s   ` r   	decoratorz!parse_type_str.<locals>.decorator   s.    	*	+1	> 
,1	>f ,--r!    )r   r   r&   s   `` r   parse_type_strr(      s    5.n r!   c                 T     t        j                          fd       }t        |      S )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                 $   t        |      }t        |      }t        |      }||k7  rdj                  |t        |            }t	        |t
              s%t        dj                  | j                  |            |j                           | ||      S )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    z/parse_tuple_type_str.<locals>.new_from_type_strX   s    '1,-X**3::()M
 (I.8??LL!  	 h99r!   r"   )r   r    s   ` r   parse_tuple_type_strr+   Q   s/     __&': (:. ())r!   c                   :    e Zd ZdZdZd Zd Zededd fd       Z	y)		BaseCoderz9
    Base class for all encoder and decoder classes.
    Fc                     t        |       }|j                         D ]D  \  }}t        ||      s&t        dj	                  ||j
                              t        | ||       F | j                          y )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   r/   values        r   __init__zBaseCoder.__init__z   st    4j !,,. 
	&JC3$$77=v!$ 8> 8  D#u%
	& 	r!   c                      y )Nr'   )r6   s    r   r   zBaseCoder.validate   s    r!   r   returnc                     t        d      )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_strzBaseCoder.from_type_str   s     ""BCCr!   N)
r   
__module____qualname____doc__
is_dynamicr9   r   r%   r   r>   r'   r!   r   r-   r-   s   s@     J& DD	D Dr!   r-   )NF)r#   
typing.abir   grammarr   r   r   r	   r(   r+   r-   r'   r!   r   <module>rE      s/     ?D*D%D %Dr!   