wL iddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZmZddlmZdej<vZGddeZ ddZ!e"dk(rDddl#Z#e#jjHZ%e e#_e%e#j_$e#jLyy)N)Pdb) IPCompleter)IPythonPTCompleter)create_ipython_shortcuts)embed)Path)Token)create_app_session) PromptSession) EditingModePygmentsTokens)InMemoryHistory FileHistory)ThreadPoolExecutorIPY_TEST_SIMPLE_PROMPTc8eZdZdZdddZd dZdZd dZdZy) TerminalPdbzStandalone IPython debugger.N)pt_session_optionsctj|g|i|d|_|j|t d|_y)Nr)r__init___ptcomppt_initrthread_executor)selfrargskwargss _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/IPython/terminal/debugger.pyrzTerminalPdb.__init__s9 T+D+F+  '(1!4c& |i}fd jtjiij}tDcgc]}|j ds|ddc} fd}ddl}|j ||}|jjd|t|_jjjjtjjj}|js|jt!t"j$jt'|_ n+t)_ njj_ t+ fdt-t.jj0j3t5jjjd jj6jj8t-jd djj: }|j=|t>s*tAjB_"tGd i|_$yycc}w) zInitialize the prompt session and the prompt loop and store them in self.pt_app and self.pt_loop. Additional keyword arguments for the PromptSession class can be specified in pt_session_options. Nc>tjjfgSN)r Promptpromptrsrget_prompt_tokensz.TerminalPdb.pt_init..get_prompt_tokens,s\\4;;/0 0r )shell namespaceglobal_namespaceparentdo_cRDcgc]}|j|s|c}Scc}wr#) startswith)rtextm methods_namess rgen_compz%TerminalPdb.pt_init..gen_comp6s"#0GaALL4FGGGs$$rc$tSr#r)r'srz%TerminalPdb.pt_init..Ls^,=,?@r Tstyle) message editing_mode key_bindingshistory completerenable_history_search mouse_supportcomplete_styler6 color_depth)%rrr(dirr/types MethodTypecustom_matchersinsertrdebugger_historydebugger_history_filer expanduserexiststouchrospathstrrdictgetattrr r8upperrr=pt_complete_styler?update_use_simple_promptasyncionew_event_looppt_loopr pt_app) rrcomplr1r3rBnewcomppoptionsr'r2s ` @@rrzTerminalPdb.pt_init"s  %!#  1 << jjBDJJE-0IMqe9LQqrUMM H &&x7G  ! ! ( (G 4.e4DL :: & & .zz//;99:EEGxxzGGI(3BGG4F4Fs1v4N(O%(7(9%$(JJ$?$?D !@ djj.E.E.K.K.MN1$**=))ll"&**22::77$**gt4 ..   )*!"113DL'2'2DK"KNs J Jcvt5|jjcdddS#1swYyxYw)a In case other prompt_toolkit apps have to run in parallel to this one (e.g. in madbg), create_app_session must be used to prevent mixing up between them. According to the prompt_toolkit docs: > If you need multiple applications running at the same time, you have to create a separate > `AppSession` using a `with create_app_session():` block. N)r rWr%r&s r_promptzTerminalPdb._prompt]s/ ! (;;%%' ( ( (s/8c|js td|j |||_|jr!t |j|j d}|s|j r|j jd}n|j|jj_ |jj|jj_ts5 |j j#|j$j'}n t+d}|j-|}|j/|}|j1||}|s|j3y#t($rd}YUwxYw#t4$rwxYw)aRepeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. override the same methods from cmd.Cmd to provide prompt toolkit replacement. z.Sorry ipdb does not support use_rawinput=FalseN)filerEOFzipdb> ) use_rawinput ValueErrorpreloopintroprintstdoutcmdqueuepopcurframe_localsr ipy_completerr)curframe f_globalsr*rSrsubmitr]resultEOFErrorinputprecmdonecmdpostcmdpostloop Exception)rrdstoplines rcmdloopzTerminalPdb.cmdloophsC  MN N   " zzdjjt{{3D====,,Q/D;?;O;ODLL..8BF--BYBYDLL..?.)#'#7#7#>#>t||#L#S#S#UD %X{{4({{4(||D$/%& MMO ()#(D)   s7B&3E-AE>E>- E;8E>:E;;E>> F ctj|jjdd}|jj }|t jj|dd|jy)Nz *interactive*z *exiting interactive console...*)configbanner1exit_msg__name__)modulelocal_ns) rInteractiveShellEmbedr(rzrkrlsysmodulesgetri)rargipshell global_nss r do_interactzTerminalPdb.do_interacts^--::$$#7  MM++ ;;??9Z#8$?)) r r#) r} __module__ __qualname____doc__rrr]rxrr@r rrrs#&155 93v (,\  r rcvtj|xstjjy)zm Start debugging from `frame`. If frame is not specified, debugging starts from caller's frame. N)r set_tracer _getframef_back)frames rrrs% ME;S]]_%;%;rs %.'/ 99,8?1.;G #G T= z //CG/CGG CHHJr