§
    ñyIfù	  ã                  ó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    úS/var/www/piapp/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ÀÅFÑ6KÔ6KðØ	ðð ð 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   øè è € ð ð àð 
�/Ð" f¤lÐ2ÐU°oÈÌÐ6Uðð ð ð ð ð r   )ÚnameÚlookupÚany)r#   Úpotential_import_targetr0   s     @r   Ú_is_a_numpy_moduler6   *   sv   ø€ ð ”i€Oðð Ø—;’;˜Ñ/Ô/°Ô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Ò(CÀGÑ(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   € ð 	Œ˜Ò$ð 	*Ý�t”y¥$Ñ'Ô'ð	*å˜tœyÑ)Ô)ð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   