
    m[h              
       >   U d Z ddlmZmZ ddlmZmZmZmZ ddl	Z
g Zee   ed<   deeef   fdZdee   fdZdefd	Zd
Zeed<    e       Zeed<    e       Zeed<    e       Zeed<   	 erddlmZ ddlZddlmZ ddlmZmZm Z  ddl!m"Z"m#Z# ee"gejH                  jJ                  f   Z&eed<   de"dejH                  jJ                  fdZ'dee    dede(fdZ)dededee*eedz  f      ddfdZ+ G d de#      Z,dede-fd Z.y# e/$ rZ0dede-fd!Z.Y dZ0[0ydZ0[0ww xY w)"a  A mypy_ plugin for managing a number of platform-specific annotations.
Its functionality can be split into three distinct parts:

* Assigning the (platform-dependent) precisions of certain `~numpy.number`
  subclasses, including the likes of `~numpy.int_`, `~numpy.intp` and
  `~numpy.longlong`. See the documentation on
  :ref:`scalar types <arrays.scalars.built-in>` for a comprehensive overview
  of the affected classes. Without the plugin the precision of all relevant
  classes will be inferred as `~typing.Any`.
* Removing all extended-precision `~numpy.number` subclasses that are
  unavailable for the platform in question. Most notably this includes the
  likes of `~numpy.float128` and `~numpy.complex256`. Without the plugin *all*
  extended-precision types will, as far as mypy is concerned, be available
  to all platforms.
* Assigning the (platform-dependent) precision of `~numpy.ctypeslib.c_intp`.
  Without the plugin the type will default to `ctypes.c_int64`.

  .. versionadded:: 1.22

.. deprecated:: 2.3

Examples
--------
To enable the plugin, one must add it to their mypy `configuration file`_:

.. code-block:: ini

    [mypy]
    plugins = numpy.typing.mypy_plugin

.. _mypy: https://mypy-lang.org/
.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html

    )CallableIterable)TYPE_CHECKINGFinal	TypeAliascastN__all__returnc                     dt         j                  fdt         j                  fdt         j                  fdt         j                  fdt         j
                  fdt         j                  fdt         j                  fdt         j                  fd	t         j                  fd
t         j                  fdt         j                  fg} i }| D ]?  \  }}dt        j                  |      j                  z  }t         d| d|t         d| <   A |S )N	_NBitByte
_NBitShort	_NBitIntC	_NBitIntP_NBitInt	_NBitLong_NBitLongLong	_NBitHalf_NBitSingle_NBitDouble_NBitLongDouble   z._nbit_base._Bit._nbit.)npbyteshortintcintpint_longlonglonghalfsingledouble
longdoubledtypeitemsize_MODULE)namesretnametypns        d/var/www/html/p-interativo-gestao-midia/env/lib/python3.12/site-packages/numpy/typing/mypy_plugin.py_get_precision_dictr/   ,   s    	bgg	rxx 	bgg	bgg	RWW	bgg	"++&	bgg			"			"	BMM*E C	c&&&,39M!C)Hwiwtf%&  J    c                  V    g d} | D cg c]  }t        t        |      s| c}S c c}w )N)float96float128
complex192
complex256)hasattrr   )extended_namesis     r.   _get_extended_precision_listr9   B   s+    N &8~!QA~888s   &&c                  h    ddddj                  t        j                  d      j                  d      S )Nc_intc_long
c_longlong)r8   lqr-   )getr   r&   char r0   r.   _get_c_intp_namerC   K   s3      
c"((3-

h'	(r0   znumpy._typingr(   _PRECISION_DICT_EXTENDED_PRECISION_LIST_C_INTP)TypeAnalyser)PRI_MED)
ImportFromMypyFile	Statement)AnalyzeTypeContextPlugin	_HookFuncctxc                     | \  }}}|j                   j                  d      d   }t        t         d|    }t	        d|      j                  |      S )z;Replace a type-alias with a concrete ``NBitBase`` subclass..r   rG   )r+   splitrD   r(   r   
named_type)rO   r,   _apir+   name_news         r.   _hookrX   s   sQ    Qxx~~c"2&"gYgdV#<=NC(33H==r0   iterableidc                 l    t        |       D ]  \  }}t        |dd      |k(  s|c S  t        d|      )z>Identify the first ``ImportFrom`` instance the specified `id`.rZ   NzBFailed to identify a `ImportFrom` instance with the following id: )	enumerategetattr
ValueError)rY   rZ   r8   values       r.   _indexr`   z   sI    !(+HAuudD)R/ ,  335&: ; 	;r0   filemoduleimportsc                     t        |d|      }d|_        | j                  t        d| j                        fD ]  }t        ||      }|||<    y)z<Override the first `module`-based import with new `imports`.r   )r)   Tzlist[Statement]N)rI   is_top_leveldefsr   rc   r`   )ra   rb   rc   
import_objlstr8   s         r.   _override_importsri      sQ      9
"&
 IIt$5t||DECsF#ACF Fr0   c                   H    e Zd ZdZdededz  fdZdedee	e
ee
f      fdZy)_NumpyPluginz>A mypy plugin for handling versus numpy-specific typing tasks.fullnamer
   Nc                      |t         v rt        S y)zSet the precision of platform-specific `numpy.number`
            subclasses.

            For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`.
            N)rD   rX   )selfrl   s     r.   get_type_analyze_hookz"_NumpyPlugin.get_type_analyze_hook   s     ?*r0   ra   c           	          |j                   }|dk(  r*t        |t         dt        D cg c]  }||f c}       n|dk(  rt        |dt        dfg       t
        |dfgS c c}w )a  Handle all import-based overrides.

            * Import platform-specific extended-precision `numpy.number`
              subclasses (*e.g.* `numpy.float96` and `numpy.float128`).
            * Import the appropriate `ctypes` equivalent to `numpy.intp`.

            numpyz._extended_precision)rc   znumpy.ctypeslibctypes_c_intprR   )rl   ri   r(   rE   rF   rH   )rn   ra   rl   vs       r.   get_additional_depsz _NumpyPlugin.get_additional_deps   s     }}H7"!i34-EF-EaV-EF
 ..!%y12
 h+,, Gs   A )__name__
__module____qualname____doc__strrN   ro   rJ   listtupleintru   rB   r0   r.   rk   rk      sB    L	# 	)d:J 		- 	-%S#&'	-r0   rk   versionc                 \    dd l }d}d| d| d}|j                  |t        d       t        S )Nr   znumpy.typing.mypy_plugin`zS` is deprecated, and will be removed in a future release. Please remove `plugins = z/` in your mypy config.(deprecated in NumPy 2.3)   )
stacklevel)warningswarnDeprecationWarningrk   )r~   r   pluginwarn_msgs       r.   r   r      sG    + x 117 9() 	
 	h 2qAr0   c                     t         )N)e)r~   s    r.   r   r   l   s    r0   )1ry   collections.abcr   r   typingr   r   r   r   rq   r   r	   r{   rz   __annotations__dictr/   r9   rC   r(   rD   rE   rF   mypy.typeanalrG   
mypy.typesmypy
mypy.buildrH   
mypy.nodesrI   rJ   rK   mypy.pluginrL   rM   typesTyperN   rX   r}   r`   r|   ri   rk   typer   ModuleNotFoundErrorr   rB   r0   r.   <module>r      s  !F / 8 8 c T#s(^ ,9d3i 9(# ( !   -. . #?"@ % @ "# #b."::6 $%7$8$**//$IJIyJ>% >$**// >;), ;# ;# ;    eCtO,-  
	 $-v $-L  [     s   ,$D D
DD