
    J/PhQ                          d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	 ddddZ
d	 Z G d
 de          Z G d de          Z G d de          ZdS )z
Function descriptors.
    )defaultdictN)typesitanium_mangler)_dynamic_modname_dynamic_module abi_tagsuidc                2    t          j        | |||          S )Nr	   )r   mangle)nameargtypesr
   r   s       S/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/core/funcdesc.pydefault_manglerr      s    !$8MMMM    c                 6    | rd                     | |          n|S )zS
    Returns a new string that is used for the first half of the mangled name.
    z{}.{})format)modnamequalnames     r   qualifying_prefixr      s"    
 18E7>>'8,,,XEr   c                       e Zd ZdZdZ	 	 	 ddZd Zd Zd	 Ze	d
             Z
e	d             Ze	d             Zd Zed             Ze	 	 dd            ZdS )FunctionDescriptora"  
    Base class for function descriptors: an object used to carry
    useful metadata about a natively callable function.

    Note that while `FunctionIdentity` denotes a Python function
    which is being concretely compiled by Numba, `FunctionDescriptor`
    may be more "abstract".
    )nativer   r   doctypemap	calltypesargskwsrestyper   mangled_nameunique_nameenv_nameglobal_dictinlinenoaliasr
   r   NFr   c                 H    | _         | _        | _        | _        | _        | _        | _        | _        |	 _        |
 _	        | _
        |'t          |t                    s
J |            | _        n t           fd|	D                        _        |t          n|}t           j         j                  }| _         || j        ||           _        |' |d                    |           j        ||          }| _        | _        | _        | _        d S )Nc              3   8   K   | ]}j         d |z            V  dS )zarg.N)r   ).0aselfs     r   	<genexpr>z.FunctionDescriptor.__init__.<locals>.<genexpr>>   s.      !I!Iq$,vz":!I!I!I!I!I!Ir   r	   z.NumbaEnv.{})r   r   r$   r   r"   r   r   r   r   r   r    
isinstancetupler   r   r   r   r!   r   r#   r%   r&   r
   )r+   r   r   r   r"   r   r   r    r   r   r   manglerr   r%   r&   r#   r$   r
   r   
qualprefixs   `                   r   __init__zFunctionDescriptor.__init__&   sP    & & "	h..88888$DMM "!I!I!I!ID!I!I!IIIDM%,_//' 't|T]CC
#Gc
 
 
 w~44Z@@#}xSJ J JH  r   c                 B    | j         p|                                 j        S )z
        Return the global dictionary of the function.
        It may not match the Module's globals if the function is created
        dynamically (i.e. exec)
        )r$   lookup_module__dict__r+   s    r   lookup_globalsz!FunctionDescriptor.lookup_globalsO   s!     @4#5#5#7#7#@@r   c                     | j         t          k    rt          S 	 t          j        | j                   S # t
          $ r
 t          cY S w xY w)z
        Return the module in which this function is supposed to exist.
        This may be a dummy module if the function was dynamically
        generated or the module can't be found.
        )r   r   r   	importlibimport_moduleImportErrorr5   s    r   r3   z FunctionDescriptor.lookup_moduleW   sW     <+++""' .t|<<< ' ' '&&&&'s   2 AAc                 P    t          |                                 | j                  S )zO
        Return the original function object described by this object.
        )getattrr3   r   r5   s    r   lookup_functionz"FunctionDescriptor.lookup_functionf   s"     t))++T];;;r   c                     | j         S )z@
        The LLVM-registered name for the raw function.
        r!   r5   s    r   llvm_func_namez!FunctionDescriptor.llvm_func_namel   s    
   r   c                 8    t          j        | j        d          S )z
        The LLVM-registered name for a CPython-compatible wrapper of the
        raw function (i.e. a PyCFunctionWithKeywords).
        cpython)ns)r   prepend_namespacer!   r5   s    r   llvm_cpython_wrapper_namez,FunctionDescriptor.llvm_cpython_wrapper_nameu   s&     01B4=? ? ? 	?r   c                     d| j         z   S )zb
        The LLVM-registered name for a C-compatible wrapper of the
        raw function.
        zcfunc.r?   r5   s    r   llvm_cfunc_wrapper_namez*FunctionDescriptor.llvm_cfunc_wrapper_name~   s     $+++r   c                     d| j         z  S )Nz<function descriptor %r>)r"   r5   s    r   __repr__zFunctionDescriptor.__repr__   s    )T-=>>r   c                     |j         j        }|j         j        }|j        }|j        pd}t          |j                  }d}d}|t          }|j         j        j        }|j         j	        }	||	|||||fS )z
        Returns
        -------
        qualname, unique_name, modname, doc, args, kws, globals

        ``unique_name`` must be a unique name.
         r   N)
func_idfuncfunc_qualname
__module____doc__r.   	arg_namesr   __globals__r"   )
clsfunc_irrM   r   r   r   r   r   r$   r"   s
             r   _get_function_infoz%FunctionDescriptor._get_function_info   s}     #?0/l bW&''?&G "/.:Ko1gsD#{JJr   c
                     |                      |          \  }
}}}}}} | |||
||||||||||||	|j        j                  }|S )N)r/   r%   r&   r$   r
   r   )rU   rL   	unique_id)rS   rT   r   r    r   r   r/   r%   r&   r
   r   r"   r   r   r   r   r$   r+   s                     r   _from_python_functionz(FunctionDescriptor._from_python_function   sp    
 ##G,,	;dC s67Hk3GYgfg*X0	2 2 2
 r   )NNFFNNr   N)NFFr   )__name__rO   __qualname__rP   	__slots__r1   r6   r3   r=   propertyr@   rE   rG   rI   classmethodrU   rX   r   r   r   r   r      s        9I BFFJ48'! '! '! '!RA A A' ' '< < < ! ! X! ? ? X? , , X,? ? ? K K [K8 9=DF   [  r   r   c                   B    e Zd ZdZdZed             Zed             ZdS )PythonFunctionDescriptorzE
    A FunctionDescriptor subclass for Numba-compiled functions.
    r   c	                 >    |                      ||||d||||	  	        S )zx
        Build a FunctionDescriptor for a given specialization of a Python
        function (in nopython mode).
        T)r   r/   r%   r&   r
   )rX   )	rS   rT   r   r    r   r/   r%   r&   r
   s	            r   from_specialized_functionz2PythonFunctionDescriptor.from_specialized_function   s6     (('7I04g062: ) < < 	<r   c                     t          d           }|                                }t          j        }|                     ||||d          S )ze
        Build a FunctionDescriptor for an object mode variant of a Python
        function.
        c                      t           j        S N)r   pyobjectr   r   r   <lambda>zDPythonFunctionDescriptor.from_object_mode_function.<locals>.<lambda>   s    en r   F)r   )r   copyr   re   rX   )rS   rT   r   r   r    s        r   from_object_mode_functionz2PythonFunctionDescriptor.from_object_mode_function   sQ     4455LLNN	.(('7I05 ) 7 7 	7r   N)rY   rO   rZ   rP   r[   r]   ra   rh   r   r   r   r_   r_      sY          I	< 	< [	< 	7 	7 [	7 	7 	7r   r_   c                   &     e Zd ZdZdZ fdZ xZS )ExternalFunctionDescriptorza
    A FunctionDescriptor subclass for opaque external functions
    (e.g. raw C functions).
    r   c                     d t          t          |                    D             }dd}t          t          |                               dd ||dd |d |d ||           d S )Nc                     g | ]}d |z  S )zarg%dr   )r)   is     r   
<listcomp>z7ExternalFunctionDescriptor.__init__.<locals>.<listcomp>   s    :::!:::r   c                     | S rd   r   )r*   xr
   r   s       r   r/   z4ExternalFunctionDescriptor.__init__.<locals>.mangler   s    Hr   TrK   )r   r   r   r"   r   r   r    r   r   r   r/   r   rd   )rangelensuperrj   r1   )r+   r   r    r   r   r/   	__class__s         r   r1   z#ExternalFunctionDescriptor.__init__   s    ::U3x==%9%9:::	 	 	 	($ 	 	dT%)r4!(Dt!!("*  , , , , ,r   )rY   rO   rZ   rP   r[   r1   __classcell__)rt   s   @r   rj   rj      sI          I, , , , , , , , ,r   rj   )rP   collectionsr   r8   
numba.corer   r   numba.core.utilsr   r   r   r   objectr   r_   rj   r   r   r   <module>rz      s)    $ # # # # #     - - - - - - - - > > > > > > > > 13 N N N N NF F FZ Z Z Z Z Z Z Zz7 7 7 7 71 7 7 7>, , , , ,!3 , , , , ,r   