f ž _Œßã @sÐddlZedkr ejdejd<z ddlTWn(eyTedejdedƒ‚Yn0ejdkršz ddl Z dZ e   d ¡  e ¡Wnee efy˜Yn0ddlmZed krìeƒat ¡dd lmZetƒejd d etdedƒ‚ddlmZddlZddlZddlZddlmZddlZddl Z ddl!Z!ddl"m#Z#ddl$Z$ddl%Z%ddl&Z&ddl'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl,m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl,m6Z6ddlm7Z7m8Z8m9Z9ddl:m;Z;dZd:dd„Z?da@dd „ZAeAd!ƒdejBfd"d#„ZCeCe_BGd$d%„d%e0ƒZDGd&d'„d'e3ƒZEGd(d)„d)e)ƒZFGd*d+„d+e;ƒZGGd,d-„d-e6jHƒZId.d/„ZJGd0d1„d1eƒZKGd2d3„d3e5ƒZLd4d5„ZMd6ZNd7d8„ZOedkrÄeOƒeAd9ƒdS);éNÚ__main__zidlelib.pyshell)Ú*zJ** IDLE can't import Tkinter. Your Python may not be configured for Tk. **©ÚfileéÚwin32Zshcoreg!@©Ú fix_scalingzIdle Cannot Startz"Idle requires tcl/tk 8.5+, not %s.©Úparent)ÚInteractiveInterpreter)Úpython_version)Ú TextWrapper)ÚColorDelegator)ÚidleConf©Údebugger)Ú debugger_r)Ú EditorWindowÚ fixwordbreaks)ÚFileList)Ú OutputWindow)Úrpc)Úidle_formatwarningÚ StdInputFileÚ StdOutputFile)Ú UndoDelegatorz 127.0.0.1c CsN|dur t}z&| t|||||d¡| d¡WnttfyHYn0dS)aShow Idle-format warning (after replacing warnings.showwarning). The differences are the formatter called, the file=None replacement, which can be None, the capture of the consequence AttributeError, and the output of a hard-coded prompt. N)Úlineú>>> )Úwarning_streamÚwriterÚAttributeErrorÚOSError)ÚmessageÚcategoryÚfilenameÚlinenorr©r'ú(/usr/lib64/python3.10/idlelib/pyshell.pyÚidle_showwarningEs ÿr)cCs0|rtdur,tjatt_ntdur,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)Ú_warnings_showwarningÚwarningsÚ showwarningr))Úcapturer'r'r(Úcapture_warningsXsr.TcCsXtj}i}t|ƒD].}|dd…|dd…dkr| |¡||<q||ƒ| |¡dS)aoExtend linecache.checkcache to preserve the entries Rather than repeating the linecache code, patch it to save the entries, call the original linecache.checkcache() (skipping them), and then restore the saved entries. orig_checkcache is bound at definition time to the original method, allowing it to be patched. Nréÿÿÿÿú<>)Ú linecacheÚcacheÚlistÚpopÚupdate)r%Zorig_checkcacher2ÚsaveÚkeyr'r'r(Úextended_linecache_checkcachegs  r8c@sveZdZdZdd„Zgd¢Zddd„Zdd „Zdd d „Zdd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zd S)ÚPyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGs–g|_tj|g|¢RŽ|j d|j¡|j d|j¡|j d|jj¡t j   t j d¡|_|jj|fdd„}|j |¡|jjrŠ| ¡| ¡dS)Nú<>ú<>z<>zbreakpoints.lstcSs| ¡|ƒdS©N)Úrestore_file_breaks)Zold_hookÚselfr'r'r(Úfilename_changed_hookŒsz;PyShellEditorWindow.__init__..filename_changed_hook)Ú breakpointsrÚ__init__ÚtextÚbindÚset_breakpoint_hereÚclear_breakpoint_hereÚflistÚ open_shellÚosÚpathÚjoinrZuserdirÚbreakpointPathÚioZfilename_change_hookZset_filename_change_hookr%r=Úcolor_breakpoint_text)r>Úargsr?r'r'r(rAsÿÿ  zPyShellEditorWindow.__init__))ZCutz<>Úrmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>Úrmenu_check_paste)NNN)zSet Breakpointr:N)zClear Breakpointr;NTcCsD|jdurdS|r(t ¡}t |d¡}n dddœ}|j d|¡dS)z,Turn colorizing of breakpoint text on or offNÚbreakÚ)Ú foregroundÚ backgroundÚBREAK)rLrÚ CurrentThemeÚ GetHighlightrBZ tag_config)r>ZcolorÚthemeZcfgr'r'r(rMžs  z)PyShellEditorWindow.color_breakpoint_textcCs†|j}|jj}| dd|d|d¡z|j |¡WntyV|j |¡Yn0z|jj j j }|  ||¡Wn Yn0dS)NrUz%d.0r) rBrLr%Útag_addr@ÚindexÚ ValueErrorÚappendrFÚpyshellÚinterprrD)r>r&rBr%Údebugr'r'r(Úset_breakpointªs  z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s| ¡dStt| d¡ƒƒ}| |¡dS)NÚinsert)rBrLr%ÚbellÚintÚfloatrZr`)r>ÚeventrBr%r&r'r'r(rD¸sz'PyShellEditorWindow.set_breakpoint_herecCsŠ|j}|jj}|s| ¡dStt| d¡ƒƒ}z|j |¡Wn Yn0|  ddd¡z|j j j j }| ||¡Wn Yn0dS)NrarUúinsert linestartzinsert lineend +1char)rBrLr%rbrcrdrZr@ÚremoveÚ tag_removerFr]r^rrE)r>rerBr%r&r_r'r'r(rEÁs$ÿ z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$| ¡dSg|_| ddt¡z|jjj j }|  |¡Wn Yn0dS)NrUú1.0) r@rBrLr%rbrhZENDrFr]r^rÚclear_file_breaks)r>rBr%r_r'r'r(rjÔs z%PyShellEditorWindow.clear_file_breaksc Cs:|j}|jj}z8t|jdƒ}| ¡}Wdƒn1s:0YWnty\g}Yn0z~t|jdƒ^}|D]}| |d¡sr| |¡qr|  ¡|j}|r¼| |dt |ƒd¡Wdƒn1sÐ0YWnXty4}z>t |j ddƒs d|j _ tjd d t |ƒ|jd WYd}~n d}~00dS) z#Save breakpoints when file is savedÚrNÚwú=Ú Úbreakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)Útitler#r )r@rLr%ÚopenrKÚ readlinesr"Ú startswithr Úupdate_breakpointsÚstrÚgetattrÚrootroÚ tkMessageBoxÚ showerrorrB)r>Zbreaksr%ÚfpÚlinesZnew_filerÚerrr'r'r(Ústore_file_breaksãs2*   <ÿýz%PyShellEditorWindow.store_file_breakscCs¶|j ¡|jdurdS|jj}|dur,dStj |j¡r²t|jdƒ}|  ¡}Wdƒn1sd0Y|D]>}|  |d¡rrt |t |ƒdd…ƒ}|D]}|  |¡q qrdS)Nrkrmr)rBr5rLr%rHrIÚisfilerKrqrrrsÚevalÚlenr`)r>r%rzr{rZbreakpoint_linenumbersZbreakpoint_linenumberr'r'r(r= s  &z'PyShellEditorWindow.restore_file_breakscCs$|j}| d¡}| |¡}||_dS)z3Retrieves all the breakpoints in the current windowrUN)rBZ tag_rangesÚranges_to_linenumbersr@)r>rBÚrangesZlinenumber_listr'r'r(rts  z&PyShellEditorWindow.update_breakpointscCsbg}tdt|ƒdƒD]H}tt||jƒƒ}tt||djƒƒ}||kr| |¡|d7}q@q|S)Nrér)Úranger€rcrdÚstringr\)r>r‚r{rZr&Úendr'r'r(r%s  z)PyShellEditorWindow.ranges_to_linenumberscCs| ¡t |¡dS)z7Extend base method - clear breaks when module is closedN)rjrÚ_close©r>r'r'r(r‡6szPyShellEditorWindow._close)T)N)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rAÚ rmenu_specsrMr`rDrErjr}r=rtrr‡r'r'r'r(r9~s  *r9c@s"eZdZdZeZdZddd„ZdS)ÚPyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jj ¡nt|ƒ|_|jr2|j ¡s2dS|jSr<)r]ÚtopÚwakeupÚPyShellÚbegin©r>rer'r'r(rGEs  zPyShellFileList.open_shell)N)r‰rŠr‹rŒr9rr]rGr'r'r'r(rŽ<srŽc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst |¡| ¡dSr<)rrAÚ LoadTagDefsrˆr'r'r(rASs zModifiedColorDelegator.__init__cCs*| ddd¡| ddd¡t |¡dS)NZTODOriÚiomarkZSYNC)rhrYrÚrecolorize_mainrˆr'r'r(r—Wsz&ModifiedColorDelegator.recolorize_mainc CsJt |¡t ¡}|j dddœt |d¡t |d¡t |d¡dœ¡dS)N)rTrSÚstdoutÚstderrÚconsole)Ústdinr˜r™rš)rr•rrVÚtagdefsr5rW)r>rXr'r'r(r•\s    üz"ModifiedColorDelegator.LoadTagDefscCs|jD]}| |dd¡qdS)Nr–r†)rœrh)r>Útagr'r'r(Ú removecolorsfs z#ModifiedColorDelegator.removecolorsN)r‰rŠr‹rŒrAr—r•ržr'r'r'r(r”Ps  r”c@s$eZdZdZddd„Zddd„ZdS) ÚModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNcCsLz$|j |dd¡r"|j ¡WdSWnty6Yn0t ||||¡dS©NúrZÚcharsÚtagsr'r'r(rans   zModifiedUndoDelegator.insertcCsJz$|j |dd¡r"|j ¡WdSWnty6Yn0t |||¡dSr )r¢r£rbr¤rÚdelete)r>Zindex1Úindex2r'r'r(r§ws   zModifiedUndoDelegator.delete)N)N)r‰rŠr‹rŒrar§r'r'r'r(rŸks rŸc@seZdZdd„ZdS)Ú MyRPCClientcCst‚dS)z0Override the base class - just re-raise EOFErrorN)ÚEOFErrorrˆr'r'r(Ú handle_EOFƒszMyRPCClient.handle_EOFN)r‰rŠr‹r«r'r'r'r(r©sr©cCsZd|pd›d}|t|ƒkrNt|t|ƒdƒ\}}||d›|›|d›S|dd…S)z¹Return width long restart line formatted with filename. Fill line with balanced '='s, with any extras and at least one at the beginning. Do not end with a trailing space. z = RESTART: ZShellz =rƒrmNéþÿÿÿ)r€Údivmod)Úwidthr%rZdivÚmodr'r'r(Ú restart_line‡s  r°c@seZdZdd„ZdZdZdZdd„Zdd„Zdd „Z d?d d „Z dd„Z dd„Z dd„Z dd„Zd@dd„ZdZdd„ZdZdd„Zdd„Zdd„Zd d!„Zd"Zd#d$„ZdAd%d&„Zd'd(„Zd)d*„Zd+d,„ZdBd-d.„Zd/d0„Zd1d2„Zd3d4„Z d5d6„Z!d7d8„Z"d9d:„Z#d;d<„Z$d=d>„Z%dS)CÚModifiedInterpretercCsB||_tjdj}tj||dd|_d|_t|_ |j j j |_ dS)Nr)ÚlocalsF)Ú tkconsoleÚsysÚmodulesÚ__dict__r rAÚ restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r>r³r²r'r'r(rA—s zModifiedInterpreter.__init__NcCs&|jdur| ¡|_t |j¡|_dSr<)r¸Úbuild_subprocess_arglistÚ subprocessÚPopenÚ rpcsubprocrˆr'r'r(Úspawn_subprocess¤s  z$ModifiedInterpreter.spawn_subprocesscCsJdd„tjDƒ}tjdddddd}d |f}tjg|d |t|jƒgS) NcSsg|] }d|‘qS)z-Wr')Ú.0Úsr'r'r(Ú ¬óz@ModifiedInterpreter.build_subprocess_arglist..ÚmainÚGeneralzdelete-exitfuncFÚbool)ÚdefaultÚtypez&__import__('idlelib.run').run.main(%r)ú-c)r´Ú warnoptionsrÚ GetOptionÚ executablerurº)r>rlZ del_exitfZcommandr'r'r(r¿©s  ÿ z,ModifiedInterpreter.build_subprocess_arglistc CsVt|jf}tdƒD]4}t |¡zt|ƒ|_WqTWqtyFYq0| ¡dS|jj   ¡d|_t dkr„|jj   t jt jd¡| ¡|jj  d¡z|j ¡Wnt jyÆ| ¡YdS0|j d|j¡|j d|jj¡|j d|jj¡|j d|jj¡|j d |jj¡|j d t¡|j d |¡|jd d | ¡|jS)Nérré ršr›r˜r™rFr1r^T©Úwith_cwd)ÚHOSTrºr„ÚtimeÚsleepr©Úrpccltr"Údisplay_port_binding_errorÚlistening_sockÚ getsocknamer¹Ú setsockoptÚsocketÚ SOL_SOCKETÚ SO_REUSEADDRrÃÚ settimeoutÚacceptÚtimeoutÚdisplay_no_subprocess_errorÚregisterr³r›r˜r™rFr1Ú transfer_pathÚpoll_subprocess)r>ÚaddrÚir'r'r(Ústart_subprocessµs@       ÿ z$ModifiedInterpreter.start_subprocessFrRcCs.|jr |jSd|_| ¡}|rrÔr%r_ršZ was_executingr'r'r(Úrestart_subprocessàsF     z&ModifiedInterpreter.restart_subprocesscCs|j dddi¡dS)NÚexecZinterrupt_the_serverr')rØZ remotecallrˆr'r'r(Z__request_interrupt sz'ModifiedInterpreter.__request_interruptcCstj|jd ¡dS)N)Útarget)Ú threadingÚThreadÚ'_ModifiedInterpreter__request_interruptÚstartrˆr'r'r(Úinterrupt_subprocesssz(ModifiedInterpreter.interrupt_subprocesscCsz|jdur|jj |j¡z|jj ¡Wnty<Yn0z|j ¡Wnty^Yn0| ¡d|j_ d|_dS)NF) Ú_afteridr³rBZ after_cancelrØrÚrîr!rïrðrˆr'r'r(Úkill_subprocesss   z#ModifiedInterpreter.kill_subprocesscCsLz|j ¡Wnty"YdS0z|j ¡WntyFYdS0dS)z"Make sure subprocess is terminatedN)rÂÚkillr"Úwaitrˆr'r'r(rï!s  z(ModifiedInterpreter.terminate_subprocesscCs2|rdg}| tj¡ntj}| d|f¡dS)NrRzRif 1: import sys as _sys _sys.path = %r del _sys )Úextendr´rIÚ runcommand)r>rÔrIr'r'r(rå.süz!ModifiedInterpreter.transfer_pathc Cs4|j}|durdSz|j|jdd}Wn2tttfyX|jjrHYdSd}| ¡Yn0|r|j  ¡d|_|\}}|jj }|dkr¢|durêt t |ƒ|dnH|dkrÀ|j  d¡rê| ¡n*|dkrêd}t ||tjdt |||dz|j ¡Wnty Yn0|jjs0|jj |jj|j¡|_dS) Ngš™™™™™©?)rZOKrZ EXCEPTIONú<>ÚERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rØZ pollresponseÚ active_seqrªr"ÚKeyboardInterruptr³ÚclosingröÚ resetoutputršÚprintÚreprÚgetvarÚremote_stack_viewerr´Ú __stderr__Ú endexecutingr!rBÚafterÚ pollintervalrærþ)r>ZcltÚresponseÚhowZwhatršÚerrmsgr'r'r(ræ=sB     ÿz#ModifiedInterpreter.poll_subprocesscCs ||_dSr<r)r>rr'r'r(Ú setdebuggereszModifiedInterpreter.setdebuggercCs|jSr<rrˆr'r'r(ríhszModifiedInterpreter.getdebuggercCs|jj d|j¡dS)a’Initiate the remote stack viewer from a separate thread. This method is called from the subprocess, and by returning from this method we allow the subprocess to unblock. After a bit the shell requests the subprocess to open the remote stack viewer which returns a static object looking at the last exception. It is queried through the RPC mechanism. i,N)r³rBrr rˆr'r'r(Úopen_remote_stack_viewerks z,ModifiedInterpreter.open_remote_stack_viewerc Cs°ddlm}|j dddi¡}|dur6|jj ¡dS| |j|¡}ddlm }m }t |jjƒ}t   ¡}t  |d¡d}|||dd } | jjd d d || jd|ƒ} |  ¡dS) Nr)Ú debugobj_rr÷Z stackviewer)rF)ÚScrolledCanvasÚTreeNodeZnormalrT)ÚbgZhighlightthicknessrZboth)ÚexpandÚfill)ÚidlelibrrØÚ remotequeuer³rwrbZStubObjectTreeItemZ idlelib.treerrZToplevelrrVrWÚframeÚpackZcanvasr) r>rZoidÚitemrrrrXrTZscZnoder'r'r(r xs   z'ModifiedInterpreter.remote_stack_viewerrcCs| |¡}| ||¡dS)z1Like runsource() but assumes complete exec sourceN)Ú stuffsourceÚexecfile©r>Úsourcer%r'r'r(Ú execsource‹s zModifiedInterpreter.execsourcec CsÀ|durZt |¡8}| ¡}trr%r%rzÚcoder'r'r(r#s& ÿÿ" þ zModifiedInterpreter.execfilecCs| |¡}t |||¡S)zBExtend base class method: Stuff the source in the line cache first)r"r Ú runsourcer$r'r'r(r0¤s zModifiedInterpreter.runsourcecCs>d|j}|jd|_| d¡}t|ƒdd||ftj|<|S)z"Stuff source in the filename cachez rrnr)ÚgidÚsplitr€r1r2)r>r%r%r{r'r'r(r"­s    zModifiedInterpreter.stuffsourcecCs| d|f¡dS)z>Prepend sys.path with file's directory if not already includeda(if 1: _filename = %r import sys as _sys from os.path import dirname as _dirname _dir = _dirname(_filename) if not _dir in _sys.path: _sys.path.insert(0, _dir) del _filename, _sys, _dirname, _dir N)r©r>r%r'r'r(Úprepend_syspathµsøz#ModifiedInterpreter.prepend_syspathc CsÄ|j}|j}| ddd¡t ¡\}}}t|ddƒp:|p:d}t|ddƒpJd}t|d dƒpZd } | d krl|d7}|dkr‚d | d} nd |d| df} | || ¡| ¡| d |¡|  ¡dS)z§Override Interactive Interpreter method: Use Colorizing Color the offending position instead of printing it and pointing at it with a caret. rrir†ÚmsgrRzr&rÚoffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s N) r³rBrhr´Úexc_inforvZcolorize_syntax_errorr r rô) r>r%r³rBrÌÚvalueÚtbr5r&r6Úposr'r'r(r-Ás$ÿ z#ModifiedInterpreter.showsyntaxerrorcCs6|j ¡| ¡t |¡|j d¡r2|j ¡dS)z1Extend base class method to reset output properlyrN)r³r Úchecklinecacher Ú showtracebackr Úopen_stack_viewerrˆr'r'r(r<Ûs    z!ModifiedInterpreter.showtracebackcCs>tj}t| ¡ƒD]&}|dd…|dd…dkr||=qdS)Nrr/r0)r1r2r3Úkeys)r>Úcr7r'r'r(r;ãsz"ModifiedInterpreter.checklinecachecCs@|jjr| ¡dS|jr0|j dd|fi¡n t||jƒdS)z*Run the code without invoking the debuggerrr÷r.r)r³rðÚdisplay_executing_dialogrØrr÷r²)r>r/r'r'r(rés zModifiedInterpreter.runcommandcCst|jjr|j ¡| ¡|j}z zT|j ¡|sV|jdurV|j dd|fi¡|_ n |rj|  ||j ¡n t ||j ƒWnžt y¸|jjs²tjddd|jjdr¨‚n | ¡n‚Yn`trætd|jjd | ¡|j ¡n,|jjr d |j_td |jjd n| ¡Yn0Wtspz|j ¡Wn@tyBYn.0tsnz|j ¡W0tylY000dS) úOverride base class methodNr÷r.zExit?zDo you want to exit altogether?Zyes©rËr z IDLE internal error in runcode()rFr)r³rðr^rör;rÚbeginexecutingrØZ asyncqueuerÚrunr²r÷Ú SystemExitrrxZaskyesnorBr<r)r r™rÚcanceledr!)r>r/rr'r'r(r.õsZ   ÿ ü ÿ  üzModifiedInterpreter.runcodecCs|jj |¡S)rA)r³r™r )r>rÅr'r'r(r #szModifiedInterpreter.writecCstjdd|jjddS)NzPort Binding ErroraAIDLE can't bind to a TCP/IP port, which is necessary to communicate with its Python execution server. This might be because no networking is installed on this computer. Run IDLE with the -n command line switch to start without a subprocess and refer to Help/IDLE Help 'Running without a subprocess' for further details.r ©rxryr³rBrˆr'r'r(rÙ's øz.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjddS)NzSubprocess Connection Errorz¢IDLE's subprocess didn't make connection. See the 'Startup failure' section of the IDLE doc, online at https://docs.python.org/3/library/idle.html#startup-failurer rGrˆr'r'r(rã2s ûz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.r rGrˆr'r'r(r@:s üz,ModifiedInterpreter.display_executing_dialog)FrR)F)N)N)&r‰rŠr‹rArþrØrÂrÃr¿rérörûrýrÿrïrårrærrrírr r1r&r#r0r"r4r-r<r;rr.r rÙrãr@r'r'r'r(r±•sF  + , &     . r±csŠeZdZdeƒZeZeZgd¢Z e j dgZ dZ ddl mZdNdd „Zd d „ZdZdZdZdZdZdZd d „Zdd„ZdOdd„Zdd„ZdPdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z d d!„Z!d"d#„Z"d$d%„Z#d&Z$d'd(„Z%d)d*„Z&d+d,„Z'd-d.„Z(dQd/d0„Z)d1d2„Z*d3d4„Z+d5d6„Z,d7d8„Z-d9d:„Z.dRd;d<„Z/dSd=d>„Z0dTd?d@„Z1dAdB„Z2dCdD„Z3dEdF„Z4dUdHdI„Z5‡fdJdK„Z6‡fdLdM„Z7‡Z8S)Vr‘z IDLE Shell ))rZ_File)ZeditZ_Edit)r_Z_Debug)ÚoptionsZ_Options)ZwindowZ_Window)ÚhelpZ_Help)ZSqueezeú<>Fr)ÚHistoryNcCs$tr&|j}|dddkr&| dd¡t|ƒ|_|durVtƒ}t|ƒ| ¡t|ƒ}t   ||dd¡d|_ d|_ t tdƒr‚tjnd|_|j d ¡d |_|j|_|j}|jd d | d |j¡| d|j¡| d|j¡| d|j¡| d|j¡| d|j¡| d|j¡tr8| d|j¡| d|j¡|  |¡}| d|j!¡tj"|_#tj$|_%tj&|_'ddl(m)}t*|d|j+|j,ƒ|_&t-|d|j+|j,ƒ|_"t-|d|j+dƒ|_$t-|d|j+|j,ƒ|_.tsà|j"t_"|j$t_$|j&t_&zddl/}|j0|_1Wntj2t_$‚Yn0| 3|j¡|_4d|_5dS)NrƒrÚshell)rLZShe_llTéÚps1rrnr/Úchar)Úwrapz<>z<>z<>z<>z<>ú<>rz<>z<>rJ)Úiomenur›r˜r™Úbackslashreplaceršé2)6r)Ú menu_specsrar±r^ÚTkrÚwithdrawrŽrrAZusetabsZ indentwidthÚhasattrr´rNÚsys_ps1r2Zprompt_last_lineÚpromptrBZ configurerCÚenter_callbackÚlinefeed_callbackÚcancel_callbackÚ eof_callbackr=Útoggle_debuggerÚtoggle_jit_stack_viewerÚview_restart_markÚ restart_shellZSqueezerZsqueeze_current_text_eventr˜Ú save_stdoutr™Ú save_stderrr›Ú save_stdinrrRrÚencodingÚerrorsrršÚpydocZ plainpagerZpagerrrKÚhistoryr)r>rFÚmsrwrBZsqueezerrRrhr'r'r(rA^sx    ÿ ÿÿÿÿ zPyShell.__init__cCs tjddS)NT)Z shell_only)rZ GetExtensionsrˆr'r'r(Úget_standard_extension_names¡sz$PyShell.get_standard_extension_namescCs|adSr<©r)r>Ústreamr'r'r(Úset_warning_stream«szPyShell.set_warning_streamcCstSr<rlrˆr'r'r(Úget_warning_stream¯szPyShell.get_warning_streamcCsH|jr$tjdd|jd| ¡dS|j ¡}|r<| ¡n| ¡dS)NzDon't debug nowz*You can only toggle the debugger when idler rQ) rðrxryrBÚset_debugger_indicatorr^ríÚclose_debuggerÚ open_debugger)r>reÚdbr'r'r(r_²sþ  zPyShell.toggle_debuggercCs|j ¡}| d| ¡dS)NrQ)r^ríZsetvar©r>rsr'r'r(rpÀs zPyShell.set_debugger_indicatorcCsdSr<r'r“r'r'r(r`ÄszPyShell.toggle_jit_stack_viewercCsh|j ¡}|r\|j d¡| ¡|jjr8t |jj¡| ¡|j  d¡|j |_ |  ¡|  ¡dS)Nz [DEBUG OFF] )r^rírrîrØrZclose_remote_debuggerr ršr rYrZrôrprtr'r'r(rqÇs   zPyShell.close_debuggercCsX|jjrt |jj|¡}n t |¡}|j |¡| ¡d|j|_ |  ¡|  ¡dS)Nz [DEBUG ON] ) r^rØrZstart_remote_debuggerrZDebuggerrrõrYrZrôrp)r>Zdbg_guir'r'r(rrÔs ÿ   zPyShell.open_debuggercCs| ¡d|_dS)úHelper for ModifiedInterpreterTN)r rðrˆr'r'r(rCàszPyShell.beginexecutingcCsd|_d|_| ¡dS)ruFN)rðrFrôrˆr'r'r(råszPyShell.endexecutingcCsD|jr&tjddd|jd}|dur&dS| ¡d|_d|_t |¡S)zExtend EditorWindow.close()zKill?z7Your program is still running! Do you want to kill it?ÚokrBFÚcancelT) rðrxZ askokcancelrBrñrFrrrî)r>rr'r'r(rîësüz PyShell.closecCsV| ¡tr|j ¡|jt_|jt_|j t_ d|_d|_ d|j _ d|_t |¡dS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)rqr)r^rÿrcr´r˜rdr™rer›ršrFr]rirr‡rˆr'r'r(r‡ús zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr'r3r'r'r(Úispythonsource szPyShell.ispythonsourcecCs|jSr<)Ú shell_titlerˆr'r'r(Ú short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs„|j dd¡| ¡tr8d}|j ¡}|sD| ¡dSd}tjt _|  dt j t j |j |f¡|j ¡| ¡ddl}d|_dS) Nr–rarRFz›==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated and will be removed in a later version. See Help/IDLE Help for details. zPython %s on %s %s %srT)rBròr r)r^rérîrÚ displayhookr´r ÚversionÚplatformÚ COPYRIGHTZ focus_forcerôÚtkinterZ _default_root)r>ZnosubÚclientrr'r'r(r’s$ ÿ z PyShell.begincCs|js dSd|_|j ¡dS©NT)ÚreadingÚ_stop_readline_flagrÚquitrˆr'r'r(rñ,szPyShell.stop_readlinecCsˆ|j}zd|_|j ¡W||_n||_0|jr:d|_dS|j dd¡}t|ƒdkrXd}| ¡|jrtd|_t stt ‚|j r„d|_ d}|S)NTFrRr–rêrrn) r‚rÚmainlooprƒrBÚgetr€r rFr)rÚ endoffile)r>r6rr'r'r(Úreadline2s(  zPyShell.readlinecCsdSrr'rˆr'r'r(ÚisattyIszPyShell.isattycCs¢z|j ddd¡rWdSWn Yn0|jsT|jsT| ¡|j d¡| ¡dSd|_d|_ |jrŽ|jj rŽ|j  ¡r„|j  ¡n |j  ¡|jrž|j ¡dS)Nú sel.firstz!=úsel.lastzKeyboardInterrupt rQFT)rBr£rðr‚r r^r rôr‡rFrØrírörýrr„r“r'r'r(r]Ls&       zPyShell.cancel_callbackcCsf|jr|jsdS|j ddd¡r0|j ddd¡s4dS|jsL| ¡| ¡nd|_d|_|j  ¡dS)Nr–z==rarêFTrQ) rðr‚rBr£r rîrFr‡rr„r“r'r'r(r^bs ÿ  zPyShell.eof_callbackcCs0|jr"|j dd¡|j d¡n | |¡dS)NrarnrQ)r‚rBraÚseeÚnewline_and_indent_eventr“r'r'r(r\qs  zPyShell.linefeed_callbackcCs:|jr|jsdSz8|j dd¡}|rF|j ddd¡rF| ||¡WdSWn Yn0|j ddd¡rX|j d d¡}|r°|j dd|d ¡r°| |j |d |d ¡|¡dS|j d d¡}|rø|j d d |d ¡rø| |j |d |d ¡|¡dS|j dd¡}|r>|j |d dd¡r>| |j |d d ¡|¡n| |j dd ¡|¡dS|j ddd¡rx|j dd¡|j dd¡}|r¤|  ¡s¤|j  dd¡|j ddd¡rÄ|  |¡dS|j dd¡|jrö|j  dd¡|j  d¡n |  |¡|j d dd¡|j ¡|jr.|j ¡n| ¡dS)NrŠr‹z<=r–rQrar¡úiomark linestartr›rrzinsert lineendz>=ršrfrêzend-1c linestartrn)rðr‚rBr†r£ÚrecallZ tag_prevrangeZ tag_nextrangeròÚstripr§rrarŒrYZupdate_idletasksrr„Úrunit)r>reÚselÚprevÚnextÚindicesrÅr'r'r(r[zsZ   ÿ    zPyShell.enter_callbackc CsLt dd|¡}t dd|¡}| d¡}|j ¡zþ|j ddd¡|j dd ¡|j d d¡}| ¡  d ¡r„|  |¡|j d d¡}|j  d|d   ¡¡t |ƒd krt d|d ¡ d ¡}t d|¡ d ¡}|d d…D]8}| |¡rþ||t |ƒd…}|j  dd| ¡¡qÜW|j d¡|j ¡n|j d¡|j ¡0dS)Nz^\s*\nrRz\n\s*$rnr’rir†rarêrfú:rrz ^([ \t]*))ÚreÚsubr2rBZundo_block_startrhròr†ÚrstripÚendswithrrarr€ÚsearchÚgrouprsrŒZundo_block_stop)r>rÅrer{ÚprefixZorig_base_indentZnew_base_indentrr'r'r(r¹s.      ÿ zPyShell.recallcCs–|j dd¡}t|ƒ}|dkr8||ddvr8|d}q|dkrX||ddkrX|d}|dkrz||ddvrz|d}qX|d|…}|j |¡dS)Nr–rêrrz rn)rBr†r€r^r0)r>rrèr'r'r(r‘Ós   z PyShell.runitcCsZ|jjr|j ¡Sz tjWntjdd|jdYdSddlm }||j |j ƒdS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined)r r)Ú StackBrowser) r^rØr r´Úlast_tracebackrxryrBZidlelib.stackviewerržrwrF)r>reržr'r'r(r=ás  ý zPyShell.open_stack_viewercCs|j d¡|j d¡dS)Nr–rë)rBrŒr“r'r'r(raïs zPyShell.view_restart_markcCs|jjdddS)z&Callback for Run/Restart Shell Cntl-F6TrÓN)r^rör“r'r'r(rbószPyShell.restart_shellcCs:| ¡|j |j¡|j dd¡| ¡|j ¡dS)Nrarê) r ršr rZrBròÚset_line_and_columnrLZ reset_undorˆr'r'r(rô÷s zPyShell.showpromptcCsP|jjj}t|ddd}d | |¡¡}| d¡s:|d7}|jj  d|d¡dS)NrMT)r®ÚtabsizeZ expand_tabsrnrŽr™) r^r³r®rrJrPršZperZbottomra)r>r5r®ÚwrapperZ wrapped_msgr'r'r(Ú show_warningþs   zPyShell.show_warningcCsb|j dd¡}|jr |j |¡|j d¡dkr>|j dd¡|j dd¡| ¡|j ¡dS)Nr–rêzend-2crn) rBr†riÚstoreraròr ZctipZremove_calltip_window)r>r%r'r'r(r s zPyShell.resetoutputr'cCsXz0|j dd¡t |||d¡}|j dd¡Wn‚Yn0|jrTd|_tsTt‚|S)Nr–ÚrightrìF)rBrórr rFr)r)r>rÅr¦Úcountr'r'r(r sz PyShell.writecs:z|j ddd¡rWdSWnty.YdS0tƒ ¡S)NrŠr¡r–Údisabled)rBr£r¤ÚsuperrOrˆ©Ú __class__r'r(rOs   zPyShell.rmenu_check_cutcs|j ddd¡rdStƒ ¡S)Nrar¡r–r§)rBr£r¨rPrˆr©r'r(rP&szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r')9r‰rŠr‹r ryr”rrŸrrUrrZallow_line_numbersZidlelib.historyrKrArkr‚rðrFr‡rrƒrnror_rpr`rqrrrCrrîr‡rxrzr~r’rñrˆr‰r]r^r\r[rr‘r=rarbrôr£r r rOrPÚ __classcell__r'r'r©r(r‘Bsf  ÿ  C    ÿ  ?     r‘c Cs2|jdkr.dD]}| |dd| |d¡¡qdS)z6Make paste replace selection on x11. See issue #5124.Zx11)ZTextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} N)Z_windowingsystemZ bind_class)rwÚclsr'r'r(Ú fix_x11_paste,s  ÿýr­a¢ USAGE: idle [-deins] [-t title] [file]* idle [-dns] [-t title] (-c cmd | -r file) [arg]* idle [-dns] [-t title] - [arg]* -h print this help message and exit -n run IDLE without a subprocess (DEPRECATED, see Help/IDLE Help for details) The following options will override the IDLE 'settings' configuration: -e open an edit window -i open a shell window The following options imply -i and will open a shell: -c cmd run the command in a shell, or -r file run script from file -d enable the debugger -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window A default edit window will be bypassed when -c, -r, or - are used. [arg]* are passed to the command (-c) or script (-r) in sys.argv[1:]. Examples: idle Open an edit window or shell depending on IDLE's configuration. idle foo.py foobar.py Edit the files, also open a shell if configured to start with shell. idle -est "Baz" foo.py Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell window with the title "Baz". idle -c "import sys; print(sys.argv)" "foo" Open a shell window and run the command, passing "-c" in sys.argv[0] and "foo" in sys.argv[1]. idle -d -s -r foo.py "Hello World" Open a shell window, run a startup script, enable the debugger, and run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in sys.argv[1]. echo "import sys; print(sys.argv)" | idle - "foobar" Open a shell window, run the script piped in, passing '' in sys.argv[0] and "foobar" in sys.argv[1]. c s\ddl}ddlm}ddlm}ddlm}tdƒdad}d}d}d}d}d} z| tj dd…d¡\} } WnF|j y´} z,t d | t ftj d t d ¡WYd} ~ n d} ~ 00| D]Ô\} }| d krÒ|}d}| d krâd}d}| dkrîd}| dkr tj t ¡t ¡| dkrd}| dkr6t dtj d da| dkrj|}tj |¡rTnt d|ƒt ¡d}| dkr|d} d}| dkrº|t_d}qº| r²| ddkr²tj ¡}d}tttjƒƒD]}tj tj|¡tj|<qÀ| r | ddkr dg| dd…t_ nª|rd g| t_ n–|r2|g| t_ n‚| r’d}g}| D]}| tj |¡¡qD|D],}tj |¡}|tjvrbtj d|¡qbn"t ¡}|tjvr´tj d|¡tj ddddd}|pÎ|}|pÚ| }trî|sît!ƒt"dda#t# $¡dd l%m&}|t#ƒtj 'tj t(¡d!¡‰|ƒd"krRtj 'ˆd#¡}t#j)|d$nZ| *¡s¬t+d%krpd&‰d'}nd(‰d)}‡‡fd*d+„|Dƒ}d,d+„|Dƒ}t#j,dg|¢RŽt-t#ƒt.t#ƒt/t#ƒa0| 1t#t0¡|r|s|s| dd…D] }t0 2|¡durî|  3|¡qî| st0 4¡|rTt0 5¡}|s6dS| *¡rZt0j6rZ|j7 8¡nt0j9}|rh| :¡| r¨tj; |¡|s´|rü|j= ?d/tj f¡|rÜ|j= @|¡nX|r4|j= A|¡|j= >|¡n8|r4| Bt#¡}|r| C|¡| D¡}|r4| C|¡t0jErHt# F¡q4t# G¡tdƒdS)0Nr)Úsystem)Útesting)ÚmacosxTFrz c:deihnr:st:z Error: %s %srrƒrÍz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tú-rRrÈrÉzeditor-on-startuprÊ)rÌZIdle)Z classNamerZIconsZWindowszidle.ico)rËg333333!@z.png)éé é0éz.gif)r²r³r´cs"g|]}tj ˆd|ˆf¡‘qS)z idle_%d%s)rHrIrJ)rÄÚsize©ÚextZicondirr'r(rÆÖsÿzmain..cSsg|]}tt|d‘qS))Zmasterr)Z PhotoImagerw)rÄÚiconfiler'r'r(rÆØsÿZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )HÚgetoptr}r®rr¯r°r.r)r´ÚargvÚerrorr Ú usage_msgr™Úexitr˜r rHrIr~r‘ryr›r(r„r€r*r\ÚdirnameraÚgetcwdrrÏZ NoDefaultRootrVrwrWÚ idlelib.runr rJÚ__file__Z wm_iconbitmapZisAquaTkÚ TkVersionZ wm_iconphotorr­rŽrFZsetupApprqrgÚnewrGÚdictrÚlowerr]rrÚenvironr†r^r#rr&r4ZtkVersionWarningr£ZpreferTabsPreferenceWarningZ inversedictr…Zdestroy)rºr®r¯r°Z enable_shellZ enable_editr_ÚcmdZscriptZstartupZoptsrNr5ÚoÚarèZpathxr%ÚdirZ edit_startr r¹ZsizesZ iconfilesZiconsrLZtkversionwarningZprefer_tabs_preference_warningr'r·r(rÈms$         ÿ       ÿ         ÿÿ    ÿ  ü     rÈF)NN)Pr´r‰rµrÚ ImportErrorr rrEr}ZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr!r"Ztkinter.messageboxZ messageboxrxrÃrVrwrWrÁr ryr/r r1rHZos.pathr r—rÝrÀÚtextwraprrùrÖr'r+Zidlelib.colorizerrZidlelib.configrrrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrÕr¹rr)r*r.Ú checkcacher8r9rŽr”rŸZ RPCClientr©r°r±r‘r­r½rÈr'r'r'r(Ús¦  ÿ   þ             ÿ ?0m 66