
    sh                        S SK JrJr  S SKJrJr  S SKJr  S SKJ	r	J
r
  S SKJr  \" 5       rSr " S S\5      r\" 5       r\" 5       r " S	 S
\5      rS rS rS rS rS r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r \\S'   \\S'   \\S'   \\S'   \\S'   \\S'   \\S '   \ \S!'   \" \S"9r!\S   r"\\!\"'   \\\"'   g#)$    )ABCabstractmethod)DelayedRegistryCPUDispatcher)jit)InternalTargetMismatchErrorNonexistentTargetError)localcpuc                   (   ^  \ rS rSrU 4S jrSrU =r$ )_TargetRegistry   c           
      
  >  [         TU ]  U5      $ ! [         af    SnSR                  [        R                  5        VVs/ s H  u  p4USS 3 SU 3PM     Os  snnf snn5      n[        UR                  X5      5      S ef = f)Nz7No target is registered against '{}', known targets:
{}
z <
   z -> )super__getitem__KeyErrorjointarget_registryitemsr	   format)selfitemmsgkvknown	__class__s         o/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/core/target_extension.pyr   _TargetRegistry.__getitem__   s    	L7&t,, 	LLCII+:+@+@+BD+B41 #$Brd74s3+BD EE(D)@AtK		Ls    .B A+B )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__)r   s   @r    r   r      s    L L    r   c                   *    \ rS rSrSrS rS rS rSrg)target_override    zPContext manager to temporarily override the current target with that
prescribed.c                 D    [        [        S[        5      U l        Xl        g )Ntarget)getattr_active_context_active_context_default_orig_targetr.   )r   names     r    __init__target_override.__init__#   s    #OX$;=r)   c                 .    U R                   [        l         g N)r.   r0   r   s    r    	__enter__target_override.__enter__(   s    !%r)   c                 .    U R                   [        l        g r7   )r2   r0   r.   )r   tyvaltbs       r    __exit__target_override.__exit__+   s    !%!2!2r)   )r2   r.   N)	r#   r$   r%   r&   __doc__r4   r9   r?   r'   r"   r)   r    r+   r+       s    
-3r)   r+   c                  ,    [        [        S[        5      $ )zReturns the current target
    r.   )r/   r0   r1   r"   r)   r    current_targetrC   /   s     ?H.EFFr)   c                     [        U R                  R                  5      S:  a  U R                  S   R                  nO[        R                  [        5       S5      nUc  Sn[        UR                  U5      5      eU$ )zU
Gets the local target from the call stack if available and the TLS
override if not.
r   Nz7The target found is not registered.Given target was {}.)	len	callstack_stackr.   r   getrC   
ValueErrorr   )contextr.   r   s      r    get_local_targetrK   5   sm     7##$q(""1%,, $$^%5t<~&F+,,r)   c                     [         U    $ )z<Resolves a target specified as a string to its Target class.)r   )
target_strs    r    resolve_target_strrN   G   s    :&&r)   c                 *    [        U 5      n[        U   $ )z6Returns the dispatcher associated with a target string)rN   dispatcher_registry)rM   	target_hws     r    resolve_dispatcher_from_strrR   L   s    ":.Iy))r)   c                 v    [        U5      n[        U 5      nUR                  U5      (       d  [        X$U5      eU$ )ad  Returns the local target if it is compatible with the given target
name during a type resolution; otherwise, raises an exception.

Parameters
----------
tyctx: typing context
hwstr: str
    target name to check against
reason: str
    Reason for the resolution. Expects a noun.
Returns
-------
target_hw : Target

Raises
------
InternalTargetMismatchError
)rN   rK   inherits_fromr   )tyctxhwstrreasonhw_clazzrQ   s        r    _get_local_target_checkedrY   R   s<    ( "%(H 'I""8,,)&XFFr)   c                   $    \ rS rSr\S 5       rSrg)JitDecoratoro   c                     [         $ r7   )NotImplementedr8   s    r    __call__JitDecorator.__call__q   s    r)   r"   N)r#   r$   r%   r&   r   r_   r'   r"   r)   r    r[   r[   o   s     r)   r[   c                   (    \ rS rSrSr\S 5       rSrg)Targetv   zImplements a target c                     [        X5      $ )zAReturns True if this target inherits from 'other' False otherwise)
issubclass)clsothers     r    rT   Target.inherits_fromy   s     #%%r)   r"   N)r#   r$   r%   r&   rA   classmethodrT   r'   r"   r)   r    rb   rb   v   s    & &r)   rb   c                       \ rS rSrSrSrg)Generic   zeMark the target as generic, i.e. suitable for compilation on
any target. All must inherit from this.
r"   Nr#   r$   r%   r&   rA   r'   r"   r)   r    rk   rk          r)   rk   c                       \ rS rSrSrSrg)CPU   zMark the target as CPU.
    r"   Nrm   r"   r)   r    rp   rp          r)   rp   c                       \ rS rSrSrSrg)GPU   zGMark the target as GPU, i.e. suitable for compilation on a GPU
target.
r"   Nrm   r"   r)   r    rt   rt      rn   r)   rt   c                       \ rS rSrSrSrg)CUDA   zMark the target as CUDA.
    r"   Nrm   r"   r)   r    rw   rw      rr   r)   rw   c                       \ rS rSrSrSrg)NPyUfunc   zMark the target as a ufunc
    r"   Nrm   r"   r)   r    rz   rz      rr   r)   rz   genericgpucudanpyufunc)key_typeN)#abcr   r   numba.core.registryr   r   numba.core.decoratorsr   numba.core.errorsr   r	   	threadingr
   tlsr0   r1   r   r   jit_registryobjectr+   rC   rK   rN   rR   rY   r[   rb   rk   rp   rt   rw   rz   rP   
cpu_targetr"   r)   r    <module>r      s?   # > %7 " % 	Lo 	L "#  3f 3G$'
*:3 &S &f ' 
' 3 
v 
 %	       &
 %v6  U#
"/ J Z r)   