
    sh)                        S SK rS SKJr  S SKJr  S SKJrJr  \S 5       r	\S 5       r
\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       rS rS r\" \R$                  5      S 5       r\" \R(                  5      S 5       r\" \R,                  5      S 5       r\" \R.                  5      S 5       r\" \R0                  5      S 5       rS r\" \R4                  5      S 5       r\" \R6                  5      S 5       rg)    N)types)TypingError)overloadregister_jitablec                 R    X   nX!:  a  US-
  S-	  nX   nX5:  a  XPU'   UnM   X0U'   g N    heapstartposposnewitem	parentposparents         g/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/cpython/heapq.py	_siftdownr      sA    iG
.1WN	ICI    c                     [        U 5      nUnX   nSU-  S-   nXR:  a-  US-   nXb:  a  X   X   :  d  UnX   X'   UnSU-  S-   nXR:  a  M-  X@U'   [        XU5        g N   r	   )lenr   r   r   endposr   r   childposrightposs          r   _siftupr      s    YFHiG3w{H

a<T^dn%DHN	s7Q; 
 Idc"r   c                 R    X   nX!:  a  US-
  S-	  nX   nXS:  a  XPU'   UnM   X0U'   g r   r
   r   s         r   _siftdown_maxr   0   sA    iG
.1WN	ICIr   c                     [        U 5      nUnX   nSU-  S-   nXR:  a-  US-   nXb:  a  X   X   :  d  UnX   X'   UnSU-  S-   nXR:  a  M-  X@U'   [        XU5        g r   )r   r   r   s          r   _siftup_maxr!   ?   s    YFHiG3w{H

a<T^dn%DHN	s7Q; 
 I$#&r   c                 "    [        U S-
  SS5      $ )Nr	   )range)xs    r   reversed_ranger&   T   s     QBr   c                 Z    [        U 5      n[        US-  5       H  n[        X5        M     g Nr   )r   r&   r!   r%   nis      r   _heapify_maxr,   Z   s&    AAAF#A $r   c                 0    U S   nXS'   [        U S5        U$ Nr   )r!   r   item
returnitems      r   _heapreplace_maxr2   b   s"    aJGar   c                     [        U [        R                  [        R                  45      (       d  [	        S5      eU R
                  n[        U[        R                  5      (       a  Sn[	        U5      eg )Nzheap argument must be a listz>'<' not supported between instances of 'complex' and 'complex')
isinstancer   ListListTyper   dtypeComplex)r   dtmsgs      r   assert_heap_typer;   j   sY    dUZZ899899	B"emm$$,# %r   c                 :    U R                   U:X  d  [        S5      eg )Nz'heap type must be the same as item type)r7   r   r   r0   s     r   *assert_item_type_consistent_with_heap_typer>   u   s    ::CDD r   c                 "    [        U 5        S nU$ )Nc                 Z    [        U 5      n[        US-  5       H  n[        X5        M     g r(   )r   r&   r   r)   s      r   hq_heapify_impl#hq_heapify.<locals>.hq_heapify_impl~   s%    FQ'AAM (r   r;   )r%   rA   s     r   
hq_heapifyrD   z   s    Q
 r   c                 "    [        U 5        S nU$ )Nc                 b    U R                  5       nU (       a  U S   nXS'   [        U S5        U$ U$ r.   )popr   )r   lasteltr1   s      r   hq_heappop_impl#hq_heappop.<locals>.hq_heappop_impl   s5    ((*aJGD!r   rC   )r   rI   s     r   
hq_heappoprK      s    T r   c                 8    [        U 5        [        X5        S nU$ )Nc                 X    U R                  U5        [        U S[        U 5      S-
  5        g Nr   r	   )appendr   r   r=   s     r   hq_heappush_impl"heappush.<locals>.hq_heappush_impl   s"    D$3t9q=)r   r;   r>   )r   r0   rP   s      r   heappushrS      s    T.t:* r   c                 8    [        U 5        [        X5        S nU$ )Nc                 0    U S   nXS'   [        U S5        U$ r.   r   r/   s      r   hq_heapreplace#heapreplace.<locals>.hq_heapreplace   s"    !W
Qar   rR   )r   r0   rW   s      r   heapreplacerY      s    T.t: r   c                 8    [        U 5        [        X5        S nU$ )Nc                 R    U (       a  U S   U:  a  U S   UsoS'   [        U S5        U$ r.   rV   r=   s     r   hq_heappushpop_impl(heappushpop.<locals>.hq_heappushpop_impl   s/    DGdN GTMDq'D!r   rR   )r   r0   r\   s      r   heappushpopr^      s    T.t: r   c                 
   [        U [        R                  [        R                  45      (       d  [	        S5      e[        U[        R
                  [        R                  [        R                  45      (       d  [	        S5      eg )Nz%First argument 'n' must be an integerz+Second argument 'iterable' must be iterable)r4   r   IntegerBooleanr   SequenceArrayr6   )r*   iterables     r   check_input_typesre      s\    a%--788ABB henn MNNGHH Or   c                 "    [        X5        S nU$ )Nc                    U S:X  a  [        S5       Vs/ s H  o!S   PM	     sn$ U S:X  a  [        U5      nU/$ [        U5      nX:  a  [        U5      S U  $ [	        U5      n[        [        U 5      U5       VVs/ s H  u  pgXv4PM
     nnn[        U5        US   S   n	U n
U H#  nXy:  d  M
  [        XU
45        US   u  pU
S-  n
M%     UR                  5         U VV
s/ s H  u  pzUPM	     sn
n$ s  snf s  snnf s  sn
nf rN   )	r$   minr   sortediterzipr,   r2   sortr*   rd   _outsizeitr+   elemresulttoporder_orders               r   hq_nsmallest_impl$nsmallest.<locals>.hq_nsmallest_impl   s   6).q2AQK22!Vh-C5L8}9(#BQ''(^+.uQx+<=+<4)+<=VQilDz 7$Qi
	 
 	*01&$&11- 3 > 2s   C1:C6C<re   )r*   rd   rw   s      r   	nsmallestrz      s    a"26 r   c                 "    [        X5        S nU$ )Nc                 B   U S:X  a  [        S5       Vs/ s H  o!S   PM	     sn$ U S:X  a  [        U5      nU/$ [        U5      nX:  a  [        U5      S S S2   S U  $ [	        U5      n[        [        SU * S5      U5       VVs/ s H  u  pgXv4PM
     nnn[        R                  " U5        US   S   n	U * n
U H.  nX:  d  M
  [        R                  " XU
45        US   u  pU
S-  n
M0     UR                  SS9  U VV
s/ s H  u  pzUPM	     sn
n$ s  snf s  snnf s  sn
nf )Nr   r	   r#   T)reverse)
r$   maxr   ri   rj   rk   hqheapifyrY   rl   rm   s               r   hq_nlargest_impl"nlargest.<locals>.hq_nlargest_impl   s#   6).q2AQK22!Vh-C5L8}9(#DbD)"1--(^+.uQB/?+DE+D4)+DE


6QilDzve}5$Qi
	 
 	D!*01&$&11- 3 F 2s   DD>Dry   )r*   rd   r   s      r   nlargestr      s    a"26 r   )heapqr   
numba.corer   numba.core.errorsr   numba.core.extendingr   r   r   r   r   r!   r&   r,   r2   r;   r>   r   rD   heappoprK   rS   rY   r^   re   rz   r   r
   r   r   <module>r      s|     ) ;   # #(   ' '(    
    E
 
"**  
"**  
"++  
"..
 
 
"..
 
I 
",, B 
"++ r   