
    ih	                     *   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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j6                  d        Zy# e$ r d	ZY Zw xY w)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                  R    d} t         rt        j                  j                         } | S )z>Get active coverage instance or return None if not found.
    N)coverage_availablecoverageCoveragecurrent)covs    Y/var/www/html/dev/engine/venv/lib/python3.12/site-packages/numba/misc/coverage_support.pyget_active_coverager      s%     C'')J    NotifyLocBase_the_registryreturnc                  h    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   | ]  } |         y wr   r   ).0factorys     r   	<genexpr>z,get_registered_loc_notify.<locals>.<genexpr>-   s     ?g	?s   )r   JIT_COVERAGElistfilterr   r   r   r   get_registered_loc_notifyr&   %   s4     	.??A 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_diskzno active Coverage instancec                  D     j                         j                         y 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   sJ     ##D1G

C?999?__' ' Nr   c                   P    e Zd ZdZedej                  ddfd       Zedd       Zy)r   zAInterface for notifying visiting of a ``numba.core.ir.Loc``.
    locr   Nc                      y r   r   selfr3   s     r   notifyzNotifyLocBase.notifyE       r   c                      y 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   s?    "&& T    r   c                   <    e Zd ZdZd Zdej                  fdZd Zy)NotifyCompilerCoveragez
    Use to notify ``coverage`` about compiled lines.

    The compiled lines are under the "numba_compiled" context in the coverage
    data.
    c                 ,    t        t              | _        y r   )r   set
_arcs_datar:   s    r   __init__zNotifyCompilerCoverage.__init__U   s    %c*r   r3   c                     |j                   j                  d      r?| j                  |j                      j                  |j                  |j                  f       y y )Nz.py)filenameendswithrE   addliner5   s     r   r7   zNotifyCompilerCoverage.notifyX   sA    <<  'OOCLL)--sxx.BC (r   c                     t               }|j                  5  |j                  d       |j                  | j                         d d d        y # 1 sw Y   y xY w)Nnumba_compiled)r1   _lockset_contextadd_arcsrE   )r6   r,   s     r   r;   zNotifyCompilerCoverage.close]   sG    $&]] 	. 01T__-	. 	. 	.s   -AAN)	r<   r=   r>   r?   rF   r   r@   r7   r;   r   r   r   rB   rB   N   s#    +D"&& D
.r   rB   c                  ,    t               
t               S y 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    ? > # #   !    :<xH_556 ;B8O#< B  "	C 	.] ., ( (g  s   B BB