+
    iM                        R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt Rt	R R lt
R R ltRR
 R lltRR R lltR R ltR R ltR R ltR	# )z)Different utilities for the numpy brains.)annotations)nodes)extract_node)InferenceContextc                   V ^8  d   QhRR/# )   returnbool )formats   "A/usr/lib/python3/dist-packages/astroid/brain/brain_numpy_utils.py__annotate__r      s     @ @4 @    c                 <    \        4       p T ;'       d
    V \        8  # )z*Returns True if numpy supports type hints.)_get_numpy_version NUMPY_VERSION_TYPE_HINTS_SUPPORT)np_vers    r   numpy_supports_type_hintsr      s    !F??f???r   c                   V ^8  d   QhRR/# )r   r   ztuple[str, str, str]r
   )r   s   "r   r   r      s      0 r   c                      ^ RI p \        V P                  P                  P                  R4      4      #   \        \
        3 d    Ru # i ; i)z^
Return the numpy version number if numpy can be imported.

Otherwise returns ('0', '0', '0')
N.)0r   r   )numpytupleversionsplitImportErrorAttributeError)r   s    r   r   r      sD    U]]**00566( s   14 A
	A
Nc               $    V ^8  d   QhRRRRRR/# )r   sourcesdict[str, str]node
nodes.NamecontextInferenceContext | Noner
   )r   s   "r   r   r   %   s$     1 11#-18O1r   c                \    \        WP                  ,          4      pVP                  VR 7      # )r#   )r   nameinferr   r!   r#   extracted_nodes   &&& r   infer_numpy_namer+   %   s)     "'))"45N00r   c               $    V ^8  d   QhRRRRRR/# )r   r   r    r!   nodes.Attributer#   r$   r
   )r   s   "r   r   r   ,   s&     1 11
1 %1r   c                \    \        WP                  ,          4      pVP                  VR 7      # r&   )r   attrnamer(   r)   s   &&& r   infer_numpy_attributer0   ,   s)    
 "'--"89N00r   c                    V ^8  d   QhRRRR/# )r   r!   r"   r   r	   r
   )r   s   "r   r   r   5   s      Z D r   c                ,  a V P                   oV P                  S4      ^,           Uu. uF'  p\        V\        P                  4      '       g   K%  VNK)  	  pp\
        ;QJ d    V3R lV 4       F  '       g   K   R# 	  R# ! V3R lV 4       4      # u upi )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              3  t   <"   T F-  pR S3VP                   9   ;'       g    RVP                   9   x  K/  	  R# 5i)r   N)r   N)names).0targetmodule_nicknames   & r   	<genexpr>%_is_a_numpy_module.<locals>.<genexpr>E   s:      -F 
/"fll2UUo6UU-s   88TF)r'   lookup
isinstancer   Importany)r!   xpotential_import_targetr7   s   &  @r   _is_a_numpy_moduler@   5   s     iiO;;/22ajELL6Q2   3 -33 3 3 -  s   "BBc               $    V ^8  d   QhRRRRRR/# )r   member_namesfrozenset[str]r!   r"   r   r	   r
   )r   s   "r   r   r   K   s)     N N N(2N	Nr   c                    VP                   V 9   ;'       d*    VP                  4       P                   P                  R4      # )zG
Returns True if the Name node's name matches a member name from numpy
r   )r'   root
startswithrB   r!   s   &&r   #member_name_looks_like_numpy_memberrH   K   s2     99$MM)9)9)D)DW)MMr   c               $    V ^8  d   QhRRRRRR/# )r   rB   rC   r!   r-   r   r	   r
   )r   s   "r   r   r   T   s$     
 
 
(7
	
r   c                    VP                   V 9   ;'       dB    \        VP                  \        P                  4      ;'       d    \        VP                  4      # )zL
Returns True if the Attribute node's name matches a member name from numpy
)r/   r;   exprr   Namer@   rG   s   &&r   &attribute_name_looks_like_numpy_memberrM   T   sG     	% 	* 	*tyy%**-	* 	*tyy)r   )120r   )N)__doc__
__future__r   astroidr   astroid.builderr   astroid.contextr   r   r   r   r+   r0   r@   rH   rM   r
   r   r   <module>rU      sC   
 0 "  ( , $4  @11,N
r   