
    ei                     Z    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
dS )    N   )TypeStr   )	BasicType	TupleType	normalizeparseFc                       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                 f     t          j                    fd            }t          |          S )Nc                    t          |          }t          |          }t          |          }||k    r#d                    |t          |                    }qt	          |t
                    s(t          d                    | j        |                    |j        k    r)t          d                    | j        |                    s/|j	        (t          d                    | j        |                    r/|j	        (t          d                    | 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	         h/var/www/html/volatility/venv/lib/python3.11/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"5011H NNM... 7 > >!,--! !
 (!(I66 $@GGL)    =M11$$$*FL))% %     H$4$@ ..4f%/ /     0 8 ++16%, ,   $$S(H===    	functoolswrapsclassmethod)r   r    r   r   s   ` r   	decoratorz!parse_type_str.<locals>.decorator   sO    	*	+	+1	> 1	> 1	> 1	> 1	> 1	> 
,	+1	>f ,---r!    )r   r   r&   s   `` r   parse_type_strr(      s+    5. 5. 5. 5. 5. 5.n r!   c                 `     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                 l   t          |          }t          |          }t          |          }||k    r#d                    |t          |                    }t	          |t
                    s(t          d                    | 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1,--X***3::()) M
 (I.. 	8??L!    	  h999r!   r"   )r   r    s   ` r   parse_tuple_type_strr+   Q   sE     _&'': : : : (':. ()))r!   c                   B    e Zd ZdZdZd Zd Zededd fd            Z	dS )		BaseCoderz9
    Base class for all encoder and decoder classes.
    Fc                    t          |           }|                                D ]O\  }}t          ||          s)t          d                    ||j                            t          | ||           P|                                  d S )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   s    4jj !,,.. 
	& 
	&JC3$$ $77=v!$ 8> 8 8   D#u%%%% 	r!   c                     d S )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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 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 %D %D %D %D %D %D %D %Dr!   