
    5 f	                    x    d 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
 dZdd	ZddZdddZddZddZddZdS )z)Different utilities for the numpy brains.    )annotations)extract_node)InferenceContext)	AttributeImportName)1200returnboolc                 8    t                      } | o
| t          k    S )z*Returns True if numpy supports type hints.)_get_numpy_version NUMPY_VERSION_TYPE_HINTS_SUPPORT)np_vers    U/var/www/equiseq/venv/lib/python3.11/site-packages/astroid/brain/brain_numpy_utils.pynumpy_supports_type_hintsr      s    !!F?f???    tuple[str, str, str]c                     	 ddl } t          | j        j                            d                    S # t          t
          f$ r Y dS w xY w)zj
    Return the numpy version number if numpy can be imported.

    Otherwise returns ('0', '0', '0')
    r   N.)r   r   r   )numpytupleversionsplitImportErrorAttributeError)r   s    r   r   r      sX    U]*0055666(   s   /2 AANcontextInferenceContext | Nonec                L    t          |           }|                    |          S )N)r   )r   infer)srcnoder   s      r   infer_numpy_memberr$   %   s#    D::g:&&&r   r#   r   c                    | j         d |                               d         D             }t          fd|D                       S )a>  
    Returns True if the node is a representation of a numpy module.

    For example in :
        import numpy as np
        x = np.linspace(1, 2)
    The node <Name.np> is a representation of the numpy module.

    :param node: node to test
    :return: True if the node is a representation of the numpy module.
    c                <    g | ]}t          |t                    |S  )
isinstancer   ).0xs     r   
<listcomp>z&_is_a_numpy_module.<locals>.<listcomp>7   s7       jF6K6K	  r      c              3  @   K   | ]}d f|j         v pd|j         v V  dS )r   )r   NN)names)r)   targetmodule_nicknames     r   	<genexpr>z%_is_a_numpy_module.<locals>.<genexpr>:   sO         
/"fl2Uo6U     r   )namelookupany)r#   potential_import_targetr0   s     @r   _is_a_numpy_moduler6   *   sv     iO ;;//2       -     r   member_namestrc                p    |j         | k    o+|                                j                             d          S )zV
    Returns True if the Name is a member of numpy whose
    name is member_name.
    r   )r2   root
startswithr7   r#   s     r   name_looks_like_numpy_memberr=   @   s/    
 9#L		(8(C(CG(L(LLr   r   c                t    |j         | k    o-t          |j        t                    ot	          |j                  S )z[
    Returns True if the Attribute is a member of numpy whose
    name is member_name.
    )attrnamer(   exprr   r6   r<   s     r   !attribute_looks_like_numpy_memberrA   H   s9     	$ 	*ty$''	*ty))r   )r   r   )r   r   )N)r   r   )r#   r   r   r   )r7   r8   r#   r   r   r   )r7   r8   r#   r   r   r   )__doc__
__future__r   astroid.builderr   astroid.contextr   astroid.nodes.node_classesr   r   r   r   r   r   r$   r6   r=   rA   r'   r   r   <module>rG      s   
 0 / " " " " " " ( ( ( ( ( ( , , , , , , > > > > > > > > > > $4  @ @ @ @   ' ' ' ' '
   ,M M M M	 	 	 	 	 	r   