
    ^h=                     .   S SK JrJrJrJrJrJrJrJrJ	r	J
r
Jr  S SKJrJr  S SKJrJr  S SKrS SKrS SKrS SKJr  S SKrS SKr\R4                  r " S S5      rS rS	 rS
 r\R@                  " 5       r!S r"S r#S r$S r%\
" 5       r&S r'S r(S r)SS jr*g)    )	get_frame
IS_CPYTHONIS_64BIT_PROCESS
IS_WINDOWSIS_LINUXIS_MACDebugInfoHolderLOAD_NATIVE_LIB_FLAGENV_FALSE_LOWER_VALUESForkSafeLockPYDEVD_USE_SYS_MONITORING)thread	threading)	pydev_logpydev_monkeyN)StringIOc                   (    \ rS rSrSrSrSrSr0 rSr	g)TracingFunctionHolder   zcThis class exists just to keep some variables (so that we don't keep them in the global namespace).NT    )
__name__
__module____qualname____firstlineno____doc___original_tracing_warn_traceback_limit_warnings_shown__static_attributes__r       a/home/james-whalen/.local/lib/python3.13/site-packages/debugpy/_vendored/pydevd/pydevd_tracing.pyr   r      s    mEOr"   r   c                      [         R                  " 5       n [        5       n[        R                  " U S   U S   U S   US9  UR                  5       $ )Nr   r      )file)sysexc_infor   	tracebackprint_exceptiongetvalue)r(   ss     r#   get_exception_traceback_strr-   #   s@    ||~H
Ahqk8A;!L::<r"   c                     Sn[         R                  (       aQ  [        5       nUR                  S5        [        R
                  " U [         R                  US9  XR                  5       -   nU$ )Nz
If this is needed, please check: 
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
zCall Location:
)flimitr&   )r   r   r   writer)   print_stackr+   )framemsgr,   s      r#   _get_stack_strr5   *   sY    	H  --J	"#-B-S-SZ[\JJL Jr"   c                 &   [         (       a  [        S5      e[        R                  (       Ga:  [	        5       nUGb,  UR
                  Gb  [        R                  R                  UR
                  R                  R                  R                  5       5      S   nUR                  S5      (       a!  SU;   a  U c  [        R                  " S5        g OUR                  S5      (       d  SS[        UR
                  5      -  -   nU[        R                   ;  aT  S	[        R                   U'   ["        R$                  R'                  U< S
35        ["        R$                  R)                  5         [        R*                  (       a  [        R+                  U 5        g g )Nz@pydevd: Using sys.monitoring, sys.settrace should not be called.r   
threadpoolgeventz6Disabled internal sys.settrace from gevent threadpool.)r   pydevd_tracingz
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.z%sr   
)r   RuntimeErrorr   r   r   f_backospathsplitextf_codeco_filenamelowerendswithr   debugr5   r    r'   stderrr1   flushr   )tracing_funcr3   filenamemessages       r#   _internal_set_tracerJ   :   s<     ]^^"""!9ww''(;(;(G(G(M(M(OPQRSH  ..8x3G'OO$\] ( && Q ^ELL99:  "7"G"GGEF)99'BJJ$$w%89JJ$$&..//= /r"   c                     [         (       a  [        S5      eU [        l        U b$  [	        U [
        R                  " 5       /SS9S:X  a  g [        R                  =(       d    [        R                  nU" U 5        g )Nz6SetTrace should not be used when using sys.monitoring.F)thread_identscreate_dummy_threadr   )r   r;   _last_tracing_func_thread_localrG   set_trace_to_threadsr   	get_identr   r   r'   settrace)rG   	set_traces     r#   SetTracerS   `   se      STT3?#0V=M=M=O<Pfklpqq  &77G3<<Ilr"   c                  \     [         R                  n [        U 5        g ! [         a     g f = fN)rN   rG   rS   AttributeError)rG   s    r#   reapply_settracerW   t   s0    6CC 	  s    
++c                      [         (       a  g [        R                  c)  [        R                  [        l        [
        [        l        g g rU   )r   r   r   r'   rQ   rJ   r   r"   r#   replace_sys_set_trace_funcrY   }   s0      ..625,,/* 7r"   c                      [         (       a  g [        R                  b%  [        R                  [        l        S [        l        g g rU   )r   r   r   r'   rQ   r   r"   r#   restore_sys_set_trace_funcr[      s2      ..:,>>26/ ;r"   c                      [         R                  $ ! [         a     Of = f[            [         R                  sS S S 5        $ ! [         a     Of = f[	        5       n U [         l        U sS S S 5        $ ! , (       d  f       g = frU   )_load_python_helper_lib__lib__rV   _lock _load_python_helper_lib_uncached)libs    r#   r]   r]      sq    &... 		*22 
  		 /0*-' 
s4    
A3A
AA3AA33
Bc                  .   [         R                  R                  [         R                  R                  [         R                  R	                  [
        5      5      S5      n [         R                  R                  U 5      (       d  [        R                  " SU 5        Sn[        (       a>  [         R                  R                  S[         R                  R                  SS5      5      nU(       d3  [        R                  " 5       nU(       d  [        R                  " S5        g [        (       a  SnSnS	nOJ[        (       a  S
nSnS	nO8[         (       a  SnSnS	nO&[        R                  " S["        R                  5        g UR%                  5       S;  Ga   [         R&                  " U 5       Vs/ s H4  oUR)                  S5      (       d  M  UR+                  U5      (       d  M2  UPM6     nnSU-   U-   nSU-   U-   nS n	Xv;   a   [         R                  R                  X5      n	O[        (       a%  X;   a   [         R                  R                  X5      n	O[3        U5      S:X  a#  [         R                  R                  XS   5      n	O`U Vs/ s H"  oUR+                  X2-   XB-   45      (       a  M   UPM$     n
n[3        U
5      S:X  a"  [         R                  R                  XS   5      n	U	c  [        R                  " SXU 5        g [        R                  " SX5        O[4        (       a  UnOUn[        (       a  SnOD[         (       a  SnSnO4[        (       a  SnO&[        R                  " S["        R                  5        g [         R                  R                  X< U< U< 35      n	[         R                  R                  U	5      (       d  [        R                  " SU	5        g U	$ s  snf !   [,        R.                  S:  a  [        R0                  " SU 5         g = fs  snf )Npydevd_attach_to_processz$Expected the directory: %s to exist! PROCESSOR_ARCHITEW6432PROCESSOR_ARCHITECTUREz.platform.machine() did not return valid value.z.dllamd64x86z.soz.dylibx86_64z2Unable to set trace to all threads in platform: %s)arm64rg   rh   ri   i386rh   attach_r   zError listing dir: %sattach_linux_r   zMUnable to set trace to all threads in arch: %s (did not find a %s lib in %s).zUsing %s lib in arch: %s.attachzExpected: %s to exist.)r=   r>   joindirnameabspath__file__existsr   criticalr   environgetplatformmachineinfor   r   r'   rB   listdir
startswithrC   r	   DEBUG_TRACE_LEVEL	exceptionlenr   )libdirarch	extension	suffix_64	suffix_32namefoundexpected_nameexpected_name_linuxrH   filteredsuffixprefixs                r#   get_python_helper_lib_filenamer      s    WW\\"''//"''//(*CDF`aF77>>&!!A6JDz zz~~6

G_ac8de!NNKLz											 	KS\\Zzz|MM	&(jj&8t&8dOOI<VT[_[h[hir[sT&8Et "D(94-4y@!ww||F:HX-6ww||F@HZ1_ww||F!H5H */tmmYEZ\e\qDr6sHt8}!77<<a9NNjlp  BH  I2HC FF:FVFFX$FNNOQTQ]Q]^77<<FFI(NO77>>(##3X>Oo u	00A5##$;VD  us6   O  )OOO$O  P&PO   -Pc                     [         (       a:  [        R                  S S S:  d#  [        [        S5      (       d  [        [
        ;   a  [        R                  " S5        g  [        5       n U c  g [        R                  R                  U 5      n[        R                  " S5        U$ !   [        R                  S:  a  [        R                  " SW 5         g = f)Nr%   )      gettotalrefcountz4Helper lib to set tracing to all threads not loaded.z=Successfully Loaded helper lib to set tracing to all threads.r   zError loading: %s)r   r'   version_infohasattrr
   r   r   ry   r   ctypespydllLoadLibraryr	   r|   r}   )rH   ra   s     r#   r`   r`     s    JBQ')3*++#99MN13ll&&x0VW
,,1  3X>s   B# ,6B# #-Cc           
      (  ^^^ [         (       a  [        S5      eU c   eSnUc  [        [        R                  " 5       R                  5       5      n[        R                  " 5        HM  n[        USS5      (       a  UR                  UR                  5        M2  UR                  UR                  5        MO     [        R                  " 5       n[        R                  R                  U5      nXQ;   a=  [!        U5      S:w  a.  [#        U5      nUR%                  U5        UR'                  SU5        U GH  mU(       a  T[        R                  ;  a   " U4S jS[        R(                  5      nU" 5       n[        R(                  Ul        TU:X  a  Un[        R,                     U[        R                  T'   U[        R                  U'   UR                  T:w  a  [.        R0                  " S5        S S S 5        Sn[        R2                  " 5       mTR5                  5         U4S	 jmUU4S
 jn	[6        R8                  " [        5      n
U
" U	S5        TR5                  5         S m[:        R<                  =(       d    [        R>                  n[A        5       nUc  [.        RB                  " S5        SnGM|   URE                  [F        RH                  " U5      [F        RJ                  " U5      [F        RJ                  " U 5      [F        RL                  " T5      [F        RJ                  " S 5      5      nUS:w  a  [.        RB                  " SU5        UnGM  GM     U$ ! , (       d  f       GNj= f!   [N        RP                  S:  a  [.        RR                  " S5        Sn GMc  = f)Nz/Should not be called when using sys.monitoring.r   pydev_do_not_traceFr   c                   "   > \ rS rSrU 4S jrSrg)*set_trace_to_threads.<locals>._DummyThreadiS  c                    > TU l         g rU   _ident)selfthread_idents    r#   
_set_ident5set_trace_to_threads.<locals>._DummyThread._set_identT  s
    &2r"   r   N)r   r   r   r   r   r!   )r   s   r#   _DummyThreadr   S  s    3 3r"   r   zIpydevd: creation of _DummyThread with fixed thread ident did not succeed.c                    > T$ rU   r   )r3   eventargdummy_traces      r#   r   )set_trace_to_threads.<locals>.dummy_traces  s	    r"   c                     > [         R                  =(       d    [        R                  n U " T5        TR	                  5         g rU   )r   r   r'   rQ   release)rR   r   proceeds    r#   increase_tracing_count4set_trace_to_threads.<locals>.increase_tracing_countv  s)    -??O3<<Ik"OOr"   r   zPUnable to load helper lib to set tracing to all threads (unsupported python vm).z5Unable to set tracing for existing thread. Result: %sz Error attaching debugger tracing)*r   r;   setr'   _current_frameskeysr   	enumerategetattrdiscardidentaddr   rP   _activerv   r~   listremoveinsertr   	__class___active_limbo_lockr   rt   allocate_lockacquirer   get_original_start_new_threadr   r   rQ   r]   ry   AttachDebuggerTracingr   c_int	py_objectc_uintr	   r|   r}   )rG   rL   rM   rett
curr_identcurr_threadr   show_debug_infor   start_new_threadset_trace_funcra   resultr   r   r   s                 @@@r#   rO   rO   +  s     LMM###
C C//16689$$&A q.66%%agg.!!!''* ' !!#J##''
3K"s='9Q'> ]+Z(Q
+% 9#4#4439#9#9 3
 !N'44:-"#K11 78I%%l34?I%%j1ww,.!**+vw 2  &&(		
 (EEfM/4 /@@PCLL%';NNmnC!22LL1$$^4$$\2MM,/$$T* Q;NN#Z\bc C S &Z Jw 21b"449''(JKs   AM+A9M
M	.N)NT)+_pydevd_bundle.pydevd_constantsr   r   r   r   r   r   r	   r
   r   r   r   "_pydev_bundle._pydev_saved_modulesr   r   _pydev_bundler   r   os.pathr=   rw   r   ior   r'   r)   rQ   _original_settracer   r-   r5   rJ   localrN   rS   rW   rY   r[   r_   r]   r   r`   rO   r   r"   r#   <module>r      s       A 1     
 \\    >F #,//"3 (+7 	"m`4or"   