Ë
    V.jÌ3  ã                  ó|  — d Z ddlmZ ddlZddlZddlZddlZddlmZ ddlm	Z	 ddlm
Z
 ddlZddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  d!d„Z!d"d„Z"d#d„Z# G d„ d«      Z$ G d„ d«      Z% G d„ d«      Z&d$d„Z'd$d„Z(	 	 	 	 	 	 	 	 d%d„Z)d&d„Z*d'd „Z+y)(z4Interactive debugging with PDB, the Python Debugger.é    )ÚannotationsN)ÚAny)ÚCallable)Ú	Generator)Úoutcomes)ÚExceptionInfo)ÚCaptureManager)ÚConfig)ÚConftestImportFailure)Úhookimpl)ÚPytestPluginManager)ÚParser)Ú
UsageError)ÚNode)Ú
BaseReport)ÚCallInfoc                óˆ   — 	 | j                  d«      \  }}||fS # t        $ r}t        j                  | ›d�«      |‚d}~ww xY w)z#Validate syntax of --pdbcls option.Ú:z) is not in the format 'modname:classname'N)ÚsplitÚ
ValueErrorÚargparseÚArgumentTypeError)ÚvalueÚmodnameÚ	classnameÚes       úSC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\_pytest/debugging.pyÚ_validate_usepdb_clsr      sZ   € ðØ"Ÿ[™[¨Ó-Ñˆ�ð
 �YÐÐøô	 ò Ü×(Ñ(ØˆiÐ@ÐAó
àð	ûðús   ‚ š	A£<¼Ac                ó®   — | j                  d«      }|j                  dddd¬«       |j                  ddd	t        d
¬«       |j                  dddd¬«       y )NÚgeneralz--pdbÚusepdbÚ
store_truezDStart the interactive Python debugger on errors or KeyboardInterrupt)ÚdestÚactionÚhelpz--pdbclsÚ
usepdb_clszmodulename:classnamez{Specify a custom interactive Python debugger for use with --pdb.For example: --pdbcls=IPython.terminal.debugger:TerminalPdb)r#   ÚmetavarÚtyper%   z--traceÚtracez(Immediately break when running each test)ÚgetgroupÚ
_addoptionr   )ÚparserÚgroups     r   Úpytest_addoptionr.   )   sw   € Ø�O‰O˜IÓ&€EØ	×ÑØØØØSð	 ô ð 
×ÑØØØ&Ü!ðFð ô ð 
×ÑØØØØ7ð	 õ ó    c                ó
  ‡— dd l Š| j                  d«      r$| j                  j                  t	        «       d«       | j                  d«      r$| j                  j                  t        «       d«       t        j                  j                  ‰j                  t        j                  t        j                  f«       t        j                  ‰_	        | j                  t        _
        | t        _        dˆfd„}| j                  |«       y )Nr   r)   Úpdbtracer!   Ú	pdbinvokec                 óx   •— t         j                  j                  «       \  ‰ _        t         _        t         _        y ©N)Ú	pytestPDBÚ_savedÚpopÚ	set_traceÚ_pluginmanagerÚ_config)Úpdbs   €r   Úfinzpytest_configure.<locals>.finR   s-   ø€ ô
 ×Ñ× Ñ Ó"ñ		
ØŒMÜÔ$ÜÕr/   ©ÚreturnÚNone)r;   ÚgetvalueÚpluginmanagerÚregisterÚPdbTraceÚ	PdbInvoker5   r6   Úappendr8   r9   r:   Úadd_cleanup)Úconfigr<   r;   s     @r   Úpytest_configurerH   A   s¶   ø€ Ûà‡��wÔØ×Ñ×%Ñ%¤h£j°*Ô=Ø‡��xÔ Ø×Ñ×%Ñ%¤i£k°;Ô?ä×Ñ×ÑØ	�‰œ	×0Ñ0´)×2CÑ2CÐDôô ×'Ñ'€C„MØ%×3Ñ3„IÔØ„IÔõ#ð ×Ñ�sÕr/   c                  ó¦   — e Zd ZU dZdZded<   dZded<   g Zded<   d	ZdZ	d
ed<   e
dd„«       Ze
dd„«       Ze
dd„«       Ze
d„ «       Ze
dd„«       Zy)r5   z'Pseudo PDB that defers to the real pdb.NzPytestPluginManager | Noner9   zConfig | Noner:   zKlist[tuple[Callable[..., None], PytestPluginManager | None, Config | None]]r6   r   z"tuple[type[Any], type[Any]] | NoneÚ_wrapped_pdb_clsc                ó(   — |r|j                  «       S y)NF)Úis_capturing)ÚclsÚcapmans     r   Ú_is_capturingzpytestPDB._is_capturingg   s   € áØ×&Ñ&Ó(Ð(Ør/   c                óJ  — | j                   sdd l}|j                  S | j                   j                  d«      }| j                  r!| j                  d   |k(  r| j                  d   S |r[|\  }}	 t        |«       t        j                  |   }|j                  d«      }t        ||d   «      }|dd  D ]  }	t        ||	«      }Œ ndd l}|j                  }| j                  ||«      }||f| _        |S # t        $ r*}
dj                  ||f«      }t        d|›d|
› �«      |
‚d }
~
ww xY w)Nr   r&   é   Ú.r   z--pdbcls: could not import z: )r:   r;   ÚPdbr@   rJ   Ú
__import__ÚsysÚmodulesr   ÚgetattrÚ	ExceptionÚjoinr   Ú_get_pdb_wrapper_class)rM   rN   r;   r&   r   r   ÚmodÚpartsÚpdb_clsÚpartÚexcr   Úwrapped_clss                r   Ú_import_pdb_clszpytestPDB._import_pdb_clsm   s3  € à�{Š{Ûð —7‘7ˆNà—[‘[×)Ñ)¨,Ó7ˆ
à×Ò C×$8Ñ$8¸Ñ$;¸zÒ$IØ×'Ñ'¨Ñ*Ð*áØ!+ÑˆG�YðÜ˜7Ô#Ü—k‘k 'Ñ*�ð "Ÿ™¨Ó,�Ü! # u¨Q¡xÓ0�Ø! ! "›I�DÜ% g¨tÓ4‘Gñ &ó à—g‘gˆGà×0Ñ0°¸&ÓAˆØ *¨KÐ8ˆÔØÐøô ò ØŸ™ '¨9Ð!5Ó6�Ü Ø1°%°¸"¸S¸EÐBóàðûðús   Á-AC/ Ã/	D"Ã8%DÄD"c                ó2   ‡ ‡‡— dd l Š G ˆˆˆ fd„d|«      }|S )Nr   c                  ój   •‡ — e Zd ZW °ZdZˆ ˆfd„Zˆ ˆˆfd„ZexZZˆ ˆfd„Z	e	Z
e	Zˆ fd„Zˆ fd„Zˆ xZS )ú:pytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapperFc                óz   •— ‰xj                   dz  c_         t        ‰| �	  |«      }‰xj                   dz  c_         |S )NrQ   )Ú_recursive_debugÚsuperÚdo_debug©ÚselfÚargÚretÚ	__class__rM   s      €€r   rh   zCpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.do_debugœ   s9   ø€ Ø×$Ò$¨Ñ)Õ$Ü‘gÑ& sÓ+�Ø×$Ò$¨Ñ)Õ$Ø�
r/   c                óF  •— t         ‰| �  |«      }‰j                  dk(  r»‰j                  €J ‚‰j                  j                  ‰j                  «      }|j                  «        | j                  }t        j                  |«      }|rC|dk(  r|j                  dd«       n|j                  dd|› d�«       |€J ‚|j                  «        n|j                  dd«       ‰j                  €J ‚‰j                  j                  j                  ‰j                  | ¬«       d	| _        |S )
Nr   ÚglobalÚ>z#PDB continue (IO-capturing resumed)z'PDB continue (IO-capturing resumed for Ú)zPDB continue©rG   r;   T)rg   Údo_continuerf   r:   rG   Úcreate_terminal_writerÚlineÚ_pytest_capmanr5   rO   ÚsepÚresumer9   ÚhookÚpytest_leave_pdbÚ
_continued)	rj   rk   rl   ÚtwrN   Ú	capturingrm   Ú_pytestrM   s	         €€€r   rs   zFpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.do_continue¢   s	  ø€ Ü‘gÑ)¨#Ó.�Ø×'Ñ'¨1Ò,ØŸ;™;Ð2Ð2Ð2Ø Ÿ™×>Ñ>¸s¿{¹{ÓK�BØ—G‘G”Ià!×0Ñ0�FÜ )× 7Ñ 7¸Ó ?�IÙ Ø$¨Ò0ØŸF™F 3Ð(MÕNàŸF™FØ #Ø"IÈ)ÈÐTUÐ Vôð  &Ð1Ð1Ð1ØŸ™�àŸ™˜s NÔ3Ø×)Ñ)Ð5Ð5Ð5Ø×"Ñ"×'Ñ'×8Ñ8ÀÇÁÐQUÐ8ÔVØ"&�”Ø�
r/   c                ón   •— t         ‰| �  |«      }‰j                  dk(  rt        j                  d«       |S )a  Raise Exit outcome when quit command is used in pdb.

                This is a bit of a hack - it would be better if BdbQuit
                could be handled, but this would require to wrap the
                whole pytest run, and adjust the report etc.
                r   úQuitting debugger)rg   Údo_quitrf   r   Úexitri   s      €€r   r�   zBpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.do_quit¾   s3   ø€ ô ‘g‘o cÓ*�à×'Ñ'¨1Ò,Ü—M‘MÐ"5Ô6à�
r/   c                ó”   •— t         ‰| �  ||«      }|s4| j                  r(| j                  r| j                  j	                  d¬«       |S )zŽSuspend on setup().

                Needed after do_continue resumed, and entering another
                breakpoint again.
                T©Úin_)rg   Úsetupr{   rv   Úsuspend_global_capture)rj   ÚfÚtbrl   rm   s       €r   r†   z@pytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.setupÏ   sE   ø€ ô ‘g‘m A rÓ*�Ù˜tŸšð ×*Ò*Ø×+Ñ+×BÑBÀtÐBÔLØ�
r/   c                ó  •— t         ‰| �  ||«      \  }}|€ft        dt        |«      dz
  «      }|rL||   d   j                  j                  dd«      r*|dz  }|r#||   d   j                  j                  dd«      rŒ*||fS )Nr   rQ   Ú__tracebackhide__F)rg   Ú	get_stackÚmaxÚlenÚf_localsÚget)rj   rˆ   ÚtÚstackÚirm   s        €r   rŒ   zDpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.get_stackÝ   s‡   ø€ Ü ™7Ñ,¨Q°Ó2‘��qØ�9ä˜Aœs 5›z¨A™~Ó.�AÙ  a¡¨¡× 4Ñ 4× 8Ñ 8Ð9LÈeÔ TØ˜Q™˜ñ   a¡¨¡× 4Ñ 4× 8Ñ 8Ð9LÈeÕ Tà˜a�x�r/   )Ú__name__Ú
__module__Ú__qualname__rv   r{   rh   rs   Údo_cÚdo_contr�   Údo_qÚdo_exitr†   rŒ   Ú__classcell__)rm   r~   rN   rM   s   @€€€r   ÚPytestPdbWrapperrd   ˜   sC   ù„ Ù#ˆNØˆJõöð4 )Ð(ˆD�7õð ˆDØˆGô÷ ð  r/   rœ   )Ú_pytest.config)rM   r]   rN   rœ   r~   s   ` ` @r   rZ   z pytestPDB._get_pdb_wrapper_class”   s#   ú€ ã÷L	 ð L	 ˜wô L	 ð\  Ðr/   c                óÜ  — ddl }| j                  €d}n| j                  j                  d«      }|r|j                  d¬«       | j                  rÉ|j
                  j                  | j                  «      }|j                  «        | j                  dk(  r…|j                  dd«      }|�|j                  d|«       n^| j                  |«      }|dk(  r|j                  dd	|› d
�«       n1|r|j                  dd	|› d|› d�«       n|j                  dd	|› �«        | j                  |«      di |¤Ž}	| j                  r1| j                  j                  j                  | j                  |	¬«       |	S )z4Initialize PDB debugging, dropping any IO capturing.r   NÚcapturemanagerTr„   Úheaderrp   ro   zPDB z (IO-capturing turned off)z (IO-capturing turned off for rq   rr   © )r�   r9   Ú	getpluginÚsuspendr:   rG   rt   ru   rf   r7   rw   rO   ra   ry   Úpytest_enter_pdb)
rM   ÚmethodÚargsÚkwargsr~   rN   r|   r    r}   Ú_pdbs
             r   Ú	_init_pdbzpytestPDB._init_pdbè   sQ  € ó 	à×ÑÐ%Ø,0‰Fà×'Ñ'×1Ñ1Ð2BÓCˆFÙØ�N‰N˜tˆNÔ$à�;Š;Ø—‘×6Ñ6°s·{±{ÓCˆBØ�G‰GŒIà×#Ñ# qÒ(àŸ™ H¨dÓ3�ØÐ%Ø—F‘F˜3 Õ'à #× 1Ñ 1°&Ó 9�IØ  HÒ,ØŸ™˜s d¨6¨(Ð2LÐ$MÕNÙ"ØŸ™ØØ" 6 (Ð*HÈÈÐSTÐUõð
 Ÿ™˜s d¨6¨( OÔ4à*ˆs×"Ñ" 6Ó*Ñ4¨VÑ4ˆà×ÒØ×Ñ×#Ñ#×4Ñ4¸C¿K¹KÈTÐ4ÔRØˆr/   c                óŽ   — t        j                  «       j                  } | j                  dg|¢­i |¤Ž}|j	                  |«       y)zBInvoke debugging via ``Pdb.set_trace``, dropping any IO capturing.r8   N)rU   Ú	_getframeÚf_backr©   r8   )rM   r¦   r§   Úframer¨   s        r   r8   zpytestPDB.set_trace  s;   € ô —‘“×&Ñ&ˆØˆs�}‰}˜[Ð:¨4Ò:°6Ñ:ˆØ�‰�uÕr/   )rN   úCaptureManager | Noner>   z
str | bool)rN   r®   r=   )r”   r•   r–   Ú__doc__r9   Ú__annotations__r:   r6   rf   rJ   ÚclassmethodrO   ra   rZ   r©   r8   r¡   r/   r   r5   r5   \   s©   … Ù1à15€NÐ.Ó5Ø!€Gˆ]Ó!ð 	ð ð ó ð ÐØ;?ÐÐ8Ó?àòó ðð
 ò$ó ð$ðL òQ ó ðQ ðf ñ$ó ð$ðL òó ñr/   r5   c                  ó,   — e Zd Z	 	 	 	 	 	 	 	 dd„Zdd„Zy)rD   c                óÀ  — |j                   j                  j                  d«      }|rc|j                  d¬«       |j	                  «       \  }}t
        j                  j                  |«       t
        j                  j                  |«       |j                  €J ‚t        |j                  j                  t        j                  «      st        ||j                  |«       y y )NrŸ   Tr„   )rG   rA   r¢   r‡   Úread_global_capturerU   ÚstdoutÚwriteÚexcinfoÚ
isinstancer   ÚunittestÚSkipTestÚ
_enter_pdb)rj   ÚnodeÚcallÚreportrN   ÚoutÚerrs          r   Úpytest_exception_interactz#PdbInvoke.pytest_exception_interact  s©   € ð —‘×*Ñ*×4Ñ4Ð5EÓFˆÙØ×)Ñ)¨dÐ)Ô3Ø×1Ñ1Ó3‰HˆC�Ü�J‰J×Ñ˜SÔ!Ü�J‰J×Ñ˜SÔ!Ø�|‰|Ð'Ð'Ð'ä˜$Ÿ,™,×,Ñ,¬h×.?Ñ.?Ô@Ü�t˜TŸ\™\¨6Õ2ð Ar/   c                ó0   — t        |«      }t        |«       y r4   )Ú_postmortem_tracebackÚpost_mortem)rj   r·   r‰   s      r   Úpytest_internalerrorzPdbInvoke.pytest_internalerror&  s   € Ü" 7Ó+ˆÜ�B�r/   N)r¼   r   r½   zCallInfo[Any]r¾   r   r>   r?   )r·   úExceptionInfo[BaseException]r>   r?   )r”   r•   r–   rÁ   rÅ   r¡   r/   r   rD   rD     s,   „ ð3Øð3Ø -ð3Ø7Að3à	ó3ôr/   rD   c                  ó,   — e Zd Z ed¬«      dd„«       Zy)rC   T)Úwrapperc              #  ó(   K  — t        |«       d –—S ­wr4   )Ú wrap_pytest_function_for_tracing)rj   Ú
pyfuncitems     r   Úpytest_pyfunc_callzPdbTrace.pytest_pyfunc_call,  s   è ø€ ä(¨Ô4Úˆùs   ‚N)r>   zGenerator[None, object, object])r”   r•   r–   r   rÌ   r¡   r/   r   rC   rC   +  s   „ Ù�dÔòó ñr/   rC   c                ó–   ‡‡— t         j                  d«      Š| j                  Št        j                  ‰«      dˆˆfd„«       }|| _        y)zñChange the Python function object of the given Function item by a
    wrapper which actually enters pdb before calling the python function
    itself, effectively leaving the user in the pdb prompt in the first
    statement of the function.Úruncallc                 óZ   •— t        j                  ‰g| ¢­i |¤Ž}‰j                  |«       y r4   )Ú	functoolsÚpartialrÎ   )r¦   r§   Úfuncr¨   Útestfunctions      €€r   rÈ   z1wrap_pytest_function_for_tracing.<locals>.wrapper=  s)   ø€ ä× Ñ  Ð?°Ò?¸Ñ?ˆØ�‰�TÕr/   Nr=   )r5   r©   ÚobjrÐ   Úwraps)rË   rÈ   r¨   rÓ   s     @@r   rÊ   rÊ   2  sD   ù€ ô
 ×Ñ˜yÓ)€DØ—>‘>€Lô
 ‡_�_�\Ó"õó #ðð €J…Nr/   c                óR   — | j                   j                  d«      rt        | «       yy)zaWrap the given pytestfunct item for tracing support if --trace was given in
    the command line.r)   N)rG   r@   rÊ   )rË   s    r   Ú&maybe_wrap_pytest_function_for_tracingr×   E  s%   € ð ×Ñ×!Ñ! 'Ô*Ü(¨Õ4ð +r/   c                óD  — | j                   j                  j                  d«      j                  }|j	                  «        | j                   j
                  j                  }d|j                  fd|j                  fd|j                  ffD ]B  \  }}||dfv sŒ|sŒ|j                  dd|z   «       |dd  d	k(  r|d d }|j	                  |«       ŒD |j                  dd
«       |j                  |«       |j                  dd«       t        |«      }d|_        t        |«       |S )NÚterminalreporterrµ   ÚstderrÚlogÚallrp   z	captured éÿÿÿÿÚ
Ú	tracebackzentering PDBT)rG   rA   r¢   Ú_twru   ÚoptionÚshowcaptureÚ	capstdoutÚ	capstderrÚcaplogrw   Ú
toterminalrÃ   Ú	_pdbshownrÄ   )r¼   r·   Úrepr|   râ   ÚsectionnameÚcontentr‰   s           r   r»   r»   L  s
  € ð 
�‰×	"Ñ	"×	,Ñ	,Ð-?Ó	@×	DÑ	D€BØ‡G�G„Ià—+‘+×$Ñ$×0Ñ0€Kð 
�3—=‘=Ð!Ø	�3—=‘=Ð!Ø	�—
‘
Ðó!Ñˆ�Wð
 ˜;¨Ð.Ò.²7Ø�F‰F�3˜ kÑ1Ô2Ø�r�sˆ|˜tÒ#Ø! # 2˜,�Ø�G‰G�GÕð!ð ‡F�Fˆ3�ÔØ‡N�N�2ÔØ‡F�Fˆ3�ÔÜ	˜wÓ	'€BØ€C„MÜ�„OØ€Jr/   c                ó^  — ddl m} t        | j                  |«      r| j                  j                  d   S t        | j                  t
        «      rB| j                  j                  j                  €J ‚| j                  j                  j                  S | j                  €J ‚| j                  d   S )Nr   )ÚUnexpectedExceptioné   )	Údoctestrì   r¸   r   Úexc_infor   ÚcauseÚ__traceback__Ú_excinfo)r·   rì   s     r   rÃ   rÃ   k  s‘   € Ý+ä�'—-‘-Ð!4Ô5ð �}‰}×%Ñ% aÑ(Ð(Ü	�G—M‘MÔ#8Ô	9ð �}‰}×"Ñ"×0Ñ0Ð<Ð<Ð<Ø�}‰}×"Ñ"×0Ñ0Ð0à×ÑÐ+Ð+Ð+Ø×Ñ Ñ"Ð"r/   c                ó¶   — t         j                  d«      }|j                  «        |j                  d | «       |j                  rt        j                  d«       y y )NrÄ   r€   )r5   r©   ÚresetÚinteractionÚquittingr   r‚   )r‘   Úps     r   rÄ   rÄ   |  sB   € Ü×Ñ˜MÓ*€AØ‡G�G„IØ‡M�M�$˜ÔØ‡z‚zÜ�‰Ð)Õ*ð r/   )r   Ústrr>   ztuple[str, str])r,   r   r>   r?   )rG   r
   r>   r?   r=   )r¼   r   r·   rÆ   rè   r   r>   r   )r·   rÆ   r>   útypes.TracebackType)r‘   rù   r>   r?   ),r¯   Ú
__future__r   r   rÐ   rU   ÚtypesÚtypingr   r   r   r¹   r~   r   Ú_pytest._coder   Ú_pytest.capturer	   r�   r
   r   r   r   Ú_pytest.config.argparsingr   Ú_pytest.config.exceptionsr   Ú_pytest.nodesr   Ú_pytest.reportsr   Ú_pytest.runnerr   r   r.   rH   r5   rD   rC   rÊ   r×   r»   rÃ   rÄ   r¡   r/   r   Ú<module>r     s²   ðñ ;å "ã Û Û 
Û Ý Ý Ý Û å Ý 'Ý *Ý !Ý 0Ý #Ý .Ý ,Ý 0Ý Ý &Ý #ó óó0÷6xñ x÷vñ ÷(ñ óó&5ðØ
ðØ5ðØ<Fðàóó>#ô"+r/   