
    J/Ph	                     T   U d Z ddlmZmZmZmZ ddlmZ ddlm	Z	m
Z
 ddlZddlmZ ddlmZmZ 	 ddlZdZn# e$ r d	ZY nw xY wed
             Zg Zeg ed         f         ed<   ded         fdZed             Z G d de	          Z G d de          Zej        d             ZdS )zw
Implement code coverage support.

Currently contains logic to extend ``coverage`` with lines covered by the
compiler.
    )OptionalSequenceCallableno_type_check)defaultdict)ABCabstractmethodN)cache)irconfigTFc                  T    d} t           rt          j                                        } | S )z>Get active coverage instance or return None if not found.
    N)coverage_availablecoverageCoveragecurrent)covs    [/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/misc/coverage_support.pyget_active_coverager      s*     C *''))J    NotifyLocBase_the_registryreturnc                  x    t           j        sg S t          t          d d t          D                                 S )zC
    Returns a list of the registered NotifyLocBase instances.
    c                 
    | d uS N )xs    r   <lambda>z+get_registered_loc_notify.<locals>.<lambda>,   s
    $ r   c              3   *   K   | ]} |            V  d S r   r   ).0factorys     r   	<genexpr>z,get_registered_loc_notify.<locals>.<genexpr>-   s(      ??g		??????r   )r   JIT_COVERAGElistfilterr   r   r   r   get_registered_loc_notifyr&   %   sN      	..?????A A B B Br   c                      t          j        d          t                      
J d            t          j        fd            } S )zm
    Make a singleton ``CoverageData``.
    Avoid writing to disk. Other processes can corrupt the file.
    T)no_diskNzno active Coverage instancec                  V                                                                     d S r   )get_dataupdate)r   covdatas   r   	_finalizez%_get_coverage_data.<locals>._finalize:   s'     	g&&&&&r   )r   CoverageDatar   atexitregister)r-   r   r,   s    @@r   _get_coverage_datar1   0   se     #D111G


C??9???_' ' ' ' ' _' Nr   c                   T    e Zd ZdZedej        ddfd            Zedd            ZdS )r   zAInterface for notifying visiting of a ``numba.core.ir.Loc``.
    locr   Nc                     d S r   r   selfr3   s     r   notifyzNotifyLocBase.notifyE       r   c                     d S r   r   r6   s    r   closezNotifyLocBase.closeI   r8   r   )r   N)	__name__
__module____qualname____doc__r	   r   Locr7   r;   r   r   r   r   r   B   sl         "& T    ^    ^  r   c                   4    e Zd ZdZd Zdej        fdZd ZdS )NotifyCompilerCoveragez
    Use to notify ``coverage`` about compiled lines.

    The compiled lines are under the "numba_compiled" context in the coverage
    data.
    c                 8    t          t                    | _        d S r   )r   set
_arcs_datar:   s    r   __init__zNotifyCompilerCoverage.__init__U   s    %c**r   r3   c                     |j                             d          r3| j        |j                                      |j        |j        f           d S d S )Nz.py)filenameendswithrE   addliner5   s     r   r7   zNotifyCompilerCoverage.notifyX   sS    <  '' 	DOCL)--sx.BCCCCC	D 	Dr   c                     t                      }|j        5  |                    d           |                    | j                   d d d            d S # 1 swxY w Y   d S )Nnumba_compiled)r1   _lockset_contextadd_arcsrE   )r6   r,   s     r   r;   zNotifyCompilerCoverage.close]   s    $&&] 	. 	. 0111T_---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   0AAAN)	r<   r=   r>   r?   rF   r   r@   r7   r;   r   r   r   rB   rB   N   s^         + + +D"& D D D D
. . . . .r   rB   c                  >    t                      t                      S d S r   )r   rB   r   r   r   _register_coverage_notifierrR   d   s"    (%''' )(r   )r?   typingr   r   r   r   collectionsr   abcr   r	   r/   	functoolsr
   
numba.corer   r   r   r   ImportErrorr   r   __annotations__r&   r1   r   rB   appendrR   r   r   r   <module>r[      s     ? > > > > > > > > > > > # # # # # # # # # # # # # #        ! ! ! ! ! ! ! !OOO         :<xH_556 ; ; ;B8O#< B B B B   "	 	 	 	 	C 	 	 	. . . . .] . . ., ( ( ( ( (s   8 AA