U
    ,‰dM  ã                   @   s,   d dl mZmZ dd„ Zdd„ Zdd„ ZdS )	é    )ÚtypesÚtypingc                 C   s   t | tttjfƒS )zi
    Return whether *sig* is a potentially valid signature
    specification (for user-facing APIs).
    )Ú
isinstanceÚstrÚtupler   Ú	Signature)Úsig© r	   ú7/tmp/pip-unpacked-wheel-eu7e0c37/numba/core/sigutils.pyÚis_signature   s    r   c                 C   s   t | i tjƒS )z;
    Parameters
    ----------
    signature_str : str
    )Úevalr   Ú__dict__)Zsignature_strr	   r	   r
   Ú_parse_signature_string   s    r   c                 C   s–   t | tƒrt| ƒ}n| }t |tƒr.|d }}n6t |tjƒrJ|j|j }}ntd| | j	j
|j	j
f ƒ‚dd„ }|dk	r|||ƒ |D ]}||ƒ q€||fS )z¾
    From *sig* (a signature specification), return a ``(args, return_type)``
    tuple, where ``args`` itself is a tuple of types, and ``return_type``
    can be None if not specified.
    NzNinvalid signature: %r (type: %r) evaluates to %r instead of tuple or Signaturec                 S   s   t | tjƒstd| f ƒ‚d S )Nz;invalid type in signature: expected a type instance, got %r)r   r   ÚTypeÚ	TypeError)Útyr	   r	   r
   Ú
check_type+   s    ÿz'normalize_signature.<locals>.check_type)r   r   r   r   r   r   ÚargsÚreturn_typer   Ú	__class__Ú__name__)r   Úparsedr   r   r   r   r	   r	   r
   Únormalize_signature   s&    


 þÿ
r   N)Z
numba.corer   r   r   r   r   r	   r	   r	   r
   Ú<module>   s   
