bgM tdZddlmZddlmZddlmZddlmZm Z m Z m Z dZ dd Z dd ZdddZddZddZd S)z)Different utilities for the numpy brains.) annotations) extract_node)InferenceContext) AttributeImportNameNodeNG)1200returnboolc8t}|o |tkS)z*Returns True if numpy supports type hints.)_get_numpy_version NUMPY_VERSION_TYPE_HINTS_SUPPORT)np_vers p/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/brain/brain_numpy_utils.pynumpy_supports_type_hintsrs  ! !F  ?f???tuple[str, str, str]c ddl}t|jjdS#tt f$rYdSwxYw)zj Return the numpy version number if numpy can be imported. Otherwise returns ('0', '0', '0') rN.)r r r )numpytupleversionsplit ImportErrorAttributeError)rs rrrsX  U]*0055666  (s/2AANcontextInferenceContext | NonecLt|}||S)N)r)rinfer)srcnoders rinfer_numpy_memberr%%s#   D ::g: & &&rr$rc|jd|dD}tfd|DS)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 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).0xs r z&_is_a_numpy_module..7s7jF6K6K rc3@K|]}df|jvpd|jvVdS)r)rNN)names)r*targetmodule_nicknames r z%_is_a_numpy_module..:sO  /"fl2Uo6Ur)namelookupany)r$potential_import_targetr1s @r_is_a_numpy_moduler7*sviO;;//2 -  r member_namestrr cBt|tr;|j|kr0t|jtrt |jrdSt|tr9|j|kr.|jdrdSdS)z Returns True if the node is a member of numpy whose name is member_name. :param member_name: name of the member :param node: node to test :return: True if the node is a member of numpy TrF) r)rattrnameexprrr7r3root startswith)r8r$s rlooks_like_numpy_memberr?@s 4## M[ ( ( ty$ ' ' ) ty ) ) )t4 I $ $ IIKK  ' ' 0 0 %t 5r)r r)r r)N)rr )r$rr r)r8r9r$r r r)__doc__ __future__rastroid.builderrastroid.contextrastroid.nodes.node_classesrrrr rrrr%r7r?r(rrrEs 0/""""""((((((,,,,,,FFFFFFFFFFFF$4 @@@@    ''''' ,r