B Hë`<‘hÑÛã @sÔddlZedkr ejdejd<y ddlTWn*ek rVedejdedƒ‚YnXejdkržy ddl Z dZ e   d ¡  e ¡Wnee efk rœYnXddlmZed 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éZwin32Zshcoreg!@)Ú 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 CsP|dkr t}y&| t|||||d¡| d¡Wnttfk rJYnXdS)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)Úlinez>>> )Úwarning_streamÚwriterÚAttributeErrorÚOSError)ÚmessageÚcategoryÚfilenameÚlinenorr©r!ú2/opt/alt/python37/lib/python3.7/idlelib/pyshell.pyÚidle_showwarningEsr#cCs0|rtdkr,tjatt_ntdk r,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)Ú_warnings_showwarningÚwarningsÚ showwarningr#)Zcapturer!r!r"Úcapture_warningsXsr'TcCs\tj}i}x:t|ƒD].}|dd…|dd…dkr| |¡||<qW||ƒ| |¡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éÿÿÿÿz<>)Ú linecacheÚcacheÚlistÚpopÚupdate)rZorig_checkcacher*ÚsaveÚkeyr!r!r"Úextended_linecache_checkcachegs r0c@s~eZdZdZdd„Zdddddd gZd d d „Zd d„Zd!dd„Zd"dd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„ZdS)#ÚPyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGs”g|_tj|f|žŽ|j d|j¡|j d|j¡|j d|jj¡t j   t j d¡|_|jj|fdd„}|j |¡|jjrˆ| ¡| ¡dS)Nz<>z<>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Újoinr ZuserdirÚbreakpointPathÚioZfilename_change_hookZset_filename_change_hookrr2Úcolor_breakpoint_text)r3Úargsr4r!r!r"r6s   zPyShellEditorWindow.__init__)ZCutz<>Úrmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>Úrmenu_check_paste)NNN)zSet Breakpointz<>N)zClear Breakpointz<>NTcCsD|jdkrdS|r(t ¡}t |d¡}n dddœ}|j d|¡dS)z,Turn colorizing of breakpoint text on or offNÚbreakÚ)Ú foregroundÚ backgroundÚBREAK)rAr Ú CurrentThemeÚ GetHighlightr7Z tag_config)r3ZcolorÚthemeZcfgr!r!r"rBžs  z)PyShellEditorWindow.color_breakpoint_textcCsˆ|j}|jj}| dd|d|d¡y|j |¡Wn tk rX|j |¡YnXy|jj j j }|  ||¡Wn YnXdS)NrJz%d.0r) r7rArÚtag_addr5ÚindexÚ ValueErrorÚappendr;ÚpyshellÚinterpr r9)r3r r7rÚdebugr!r!r"Úset_breakpointªs z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s| ¡dStt| d¡ƒƒ}| |¡dS)NÚinsert)r7rArÚbellÚintÚfloatrOrU)r3Úeventr7rr r!r!r"r9¸sz'PyShellEditorWindow.set_breakpoint_herecCsŠ|j}|jj}|s| ¡dStt| d¡ƒƒ}y|j |¡Wn YnX|  ddd¡y|j j j j }| ||¡Wn YnXdS)NrVrJzinsert linestartzinsert lineend +1char)r7rArrWrXrYrOr5ÚremoveÚ tag_remover;rRrSr r:)r3rZr7rr rTr!r!r"r:Ás" z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$| ¡dSg|_| ddt¡y|jjj j }|  |¡Wn YnXdS)NrJz1.0) r5r7rArrWr\ZENDr;rRrSr Úclear_file_breaks)r3r7rrTr!r!r"r]Ôs z%PyShellEditorWindow.clear_file_breaksc Cs|j}|jj}y$t|jdƒ}| ¡}WdQRXWntk rJg}YnXynt|jdƒX}x$|D]}| |d¡sb| |¡qbW|  ¡|j}|r®| |dt |ƒd¡WdQRXWnTtk r}z4t |j ddƒsþd|j _ tjd d t |ƒ|jd Wdd}~XYnXdS) z#Save breakpoints when file is savedÚrNÚwú=Ú Úbreakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)Útitlerr)r5rArÚopenr@Ú readlinesrÚ startswithrÚupdate_breakpointsÚstrÚgetattrÚrootrbÚ tkMessageBoxÚ showerrorr7)r3ZbreaksrÚfpÚlinesZnew_filerÚerrr!r!r"Ústore_file_breaksãs.  (z%PyShellEditorWindow.store_file_breaksc Csª|j ¡|jdkrdS|jj}|dkr,dStj |j¡r¦t|jdƒ}|  ¡}WdQRXxJ|D]B}|  |d¡r`t |t |ƒdd…ƒ}x|D]}|  |¡qWq`WdS)Nr^r`r)r7r-rArr=r>Úisfiler@rdrerfÚevalÚlenrU)r3rrmrnrZbreakpoint_linenumbersZbreakpoint_linenumberr!r!r"r2 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}| d¡}| |¡}||_dS)z3Retrieves all the breakpoints in the current windowrJN)r7Z tag_rangesÚranges_to_linenumbersr5)r3r7ÚrangesZlinenumber_listr!r!r"rgs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|ƒdƒD]L}tt||jƒƒ}tt||djƒƒ}x||kr`| |¡|d7}qDWqW|S)Nrér)ÚrangersrXrYÚstringrQ)r3rurnrOr Úendr!r!r"rt%s  z)PyShellEditorWindow.ranges_to_linenumberscCs| ¡t |¡dS)z7Extend base method - clear breaks when module is closedN)r]rÚ_close)r3r!r!r"rz6szPyShellEditorWindow._close)T)N)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r6Ú rmenu_specsrBrUr9r:r]rpr2rgrtrzr!r!r!r"r1~s$  *r1c@s"eZdZdZeZdZddd„ZdS)ÚPyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jj ¡nt|ƒ|_|jr2|j ¡s2dS|jS)N)rRÚtopÚwakeupÚPyShellÚbegin)r3rZr!r!r"r<Es  zPyShellFileList.open_shell)N)r{r|r}r~r1rrRr<r!r!r!r"r€<sr€c@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst |¡| ¡dS)N)r r6Ú LoadTagDefs)r3r!r!r"r6Ss zModifiedColorDelegator.__init__cCs*| ddd¡| ddd¡t |¡dS)NZTODOz1.0ÚiomarkZSYNC)r\rNr Úrecolorize_main)r3r!r!r"rˆWsz&ModifiedColorDelegator.recolorize_mainc CsJt |¡t ¡}|j dddœt |d¡t |d¡t |d¡dœ¡dS)N)rIrHÚstdoutÚstderrÚconsole)Ústdinr‰rŠr‹)r r†r rKÚtagdefsr-rL)r3rMr!r!r"r†\s   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}| |dd¡qWdS)Nr‡ry)rr\)r3Útagr!r!r"Ú removecolorsfs z#ModifiedColorDelegator.removecolorsN)r{r|r}r~r6rˆr†rr!r!r!r"r…Ps  r…c@s$eZdZdZddd„Zddd„ZdS) ÚModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNcCsLy"|j |dd¡r |j ¡dSWntk r6YnXt ||||¡dS)Nú„Z%dS)CÚModifiedInterpretercCsB||_tjdj}tj||dd|_d|_t|_ |j j j |_ dS)Nr)ÚlocalsF)Ú tkconsoleÚsysÚmodulesÚ__dict__rr6Ú restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r3r¢r¡r!r!r"r6—s zModifiedInterpreter.__init__NcCs&|jdkr| ¡|_t |j¡|_dS)N)r§Úbuild_subprocess_arglistÚ subprocessÚPopenÚ rpcsubproc)r3r!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"ú ¬sz@ModifiedInterpreter.build_subprocess_arglist..ÚmainÚGeneralzdelete-exitfuncFÚbool)ÚdefaultÚtypez&__import__('idlelib.run').run.main(%r)z-c)r£Ú warnoptionsr Ú GetOptionÚ executablerhr©)r3r_Z del_exitfZcommandr!r!r"r®©s    z,ModifiedInterpreter.build_subprocess_arglistc CsZt|jf}xLtdƒD]4}t |¡yt|ƒ|_PWqtk rFYqXqW| ¡dS|jj   ¡d|_t dkrˆ|jj   t jt jd¡| ¡|jj  d¡y|j ¡Wnt jk rÊ| ¡dSX|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Šr;r)rST)Úwith_cwd)ÚHOSTr©rwÚtimeZsleepr˜ÚrpccltrÚdisplay_port_binding_errorÚlistening_sockZ getsocknamer¨Z setsockoptÚsocketZ SOL_SOCKETZ SO_REUSEADDRr²Z settimeoutÚacceptÚtimeoutÚdisplay_no_subprocess_errorÚregisterr¢rŒr‰rŠr;r)Ú transfer_pathÚpoll_subprocess)r3ZaddrÚir!r!r"Ústart_subprocessµs>       z$ModifiedInterpreter.start_subprocessFrGcCs0|jr |jSd|_| ¡}|rYnXy|j ¡Wntk rbYnX| ¡d|j_ d|_dS)NF) Ú_afteridr¢r7Z after_cancelrÃrÅrÒrrÓrÔ)r3r!r!r"Úkill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|j ¡Wntk r"dSXy|j ¡Wntk rFdSXdS)z"Make sure subprocess is terminatedN)r±ÚkillrÚwait)r3r!r!r"rÓ!sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}| tj¡ntj}| d|f¡dS)NrGzRif 1: import sys as _sys _sys.path = %r del _sys )Úextendr£r>Ú runcommand)r3rÀr>r!r!r"rË.s z!ModifiedInterpreter.transfer_pathc Cs6|j}|dkrdSy|j|jdd}Wn2tttfk rX|jjrHdSd}| ¡YnX|r|j  ¡d|_|\}}|jj }|dkr¢|dk rêt t |ƒ|dnH|dkrÀ|j  d¡rê| ¡n*|dkrêd}t ||tjdt |||dy|j ¡Wntk rYnX|jjs2|jj |jj|j¡|_dS) Ngš™™™™™©?)räZOK)rZ EXCEPTIONz<>ÚERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rÃZ pollresponseÚ active_seqr™rÚKeyboardInterruptr¢ÚclosingrÚÚ resetoutputr‹ÚprintÚreprÚgetvarÚremote_stack_viewerr£Ú __stderr__Ú endexecutingrr7ÚafterÚ pollintervalrÌrá)r3ZcltÚresponseZhowZwhatr‹Úerrmsgr!r!r"rÌ=s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r )r3r r!r!r"Ú setdebuggereszModifiedInterpreter.setdebuggercCs|jS)N)r )r3r!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¢r7ròrï)r3r!r!r"Úopen_remote_stack_viewerks z,ModifiedInterpreter.open_remote_stack_viewerc Cs°ddlm}|j dddi¡}|dkr6|jj ¡dS| |j|¡}ddlm }m }t |jjƒ}t   ¡}t  |d¡d}|||dd } | jjd d d || jd|ƒ} |  ¡dS) Nr)Ú debugobj_rrÛZ stackviewer)r;)ÚScrolledCanvasÚTreeNodeZnormalrI)ZbgZhighlightthicknessrZboth)ÚexpandZfill)ÚidlelibrørÃÚ remotequeuer¢rjrWZStubObjectTreeItemZ idlelib.treerùrúZToplevelr rKrLÚframeZpackZcanvasrû) r3røZoidÚitemrùrúrrMrIZscZnoder!r!r"rïxs   z'ModifiedInterpreter.remote_stack_viewerrcCs| |¡}| ||¡dS)z1Like runsource() but assumes complete exec sourceN)Ú stuffsourceÚexecfile)r3Úsourcerr!r!r"Ú execsource‹s zModifiedInterpreter.execsourcec Cs®|dkrFt |¡.}| ¡}trÚabspathrªÚ OverflowErrorÚ SyntaxErrorr¢rërìrŠrÚshowsyntaxerrorrØÚruncode)r3rrrmÚcoder!r!r"rs &   zModifiedInterpreter.execfilecCs| |¡}t |||¡S)zBExtend base class method: Stuff the source in the line cache first)rrÚ runsource)r3rrr!r!r"r ¤s zModifiedInterpreter.runsourcecCs>d|j}|jd|_| d¡}t|ƒdd||ftj|<|S)z"Stuff source in the filename cachez rrar)ÚgidÚsplitrsr)r*)r3rrrnr!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æ)r3rr!r!r"Úprepend_syspathµsz#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. rçz1.0ryÚmsgrGzr rÚoffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s N) r¢r7r\r£Úexc_inforiZcolorize_syntax_errorrërrØ) r3rr¢r7rºÚvalueÚtbrr rÚposr!r!r"r Ás" z#ModifiedInterpreter.showsyntaxerrorcCs6|j ¡| ¡t |¡|j d¡r2|j ¡dS)z1Extend base class method to reset output properlyz<>N)r¢rëÚchecklinecacherÚ showtracebackrîÚopen_stack_viewer)r3r!r!r"rÛs    z!ModifiedInterpreter.showtracebackcCsBtj}x6t| ¡ƒD]&}|dd…|dd…dkr||=qWdS)Nrr(z<>)r)r*r+Úkeys)r3Úcr/r!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ÃrýrÛr¡)r3r r!r!r"ræés zModifiedInterpreter.runcommandcCsN|jjr|j ¡| ¡|j}zúyT|j ¡|sT|jdk rT|j dd|fi¡|_ n |rh|  ||j ¡n t ||j ƒWn t k r¸|jjs²tjddd|jjdr¨‚q´| ¡n‚Yn`trætd|jjd | ¡|j ¡n,|jjr d |j_td |jjd n| ¡YnXWdtsHy|j ¡Wntk rFYnXXdS) zOverride base class methodNrÛr zExit?zDo you want to exit altogether?Zyes)r¹rz IDLE internal error in runcode())rFré)r¢rÔrSrÚrr ÚbeginexecutingrÃZ asyncqueuerèÚrunr¡rÛÚ SystemExitrêrkZaskyesnor7rrrìrŠrñÚcanceledr)r3r r r!r!r"r õsJ        zModifiedInterpreter.runcodecCs|jj |¡S)zOverride base class method)r¢rŠr)r3r´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)rkrlr¢r7)r3r!r!r"rÄ'sz.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-failure)r)rkrlr¢r7)r3r!r!r"rÉ2sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rkrlr¢r7)r3r!r!r"r:sz,ModifiedInterpreter.display_executing_dialog)FrG)F)N)N)&r{r|r}r6rárÃr±r²r®rÎrÚrÞràrârÓrËrèrÌr rörÑr÷rïrrrr rrr rrrær rrÄrÉrr!r!r!r"r •sF  + , &     . r cs–eZdZdeƒdZeZeZddddddgZ e j d gZ d Z d d l mZdTdd„Zdd„Zd Zd Zd Zd Zd Zd Zdd„Zdd„ZdUdd„Zdd„ZdVdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Z d&d'„Z!d(d)„Z"d*d+„Z#d,Z$d-d.„Z%d/d0„Z&d1d2„Z'd3d4„Z(dWd5d6„Z)d7d8„Z*d9d:„Z+d;d<„Z,d=d>„Z-d?d@„Z.dXdAdB„Z/dYdCdD„Z0dZdEdF„Z1dGdH„Z2dIdJ„Z3dKdL„Z4d[dNdO„Z5‡fdPdQ„Z6‡fdRdS„Z7‡Z8S)\rƒzPython z Shell)rZ_File)ZeditZ_Edit)rTZ_Debug)ZoptionsZ_Options)ZwindowZ_Window)ÚhelpZ_Help)ZSqueezez<>Fr)ÚHistoryNcCs$tr&|j}|dddkr&| dd¡t|ƒ|_|dkrVtƒ}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_&yddl/}|j0|_1Wntj2t_$‚YnX| 3|j¡|_4d|_5dS)NrvrÚshell)r#ZShe_llTéÚps1z>>> rar(Úchar)Úwrapz<>z<>z<>z<>z<>z<>z<>z<>z<>z<>)ÚiomenurŒr‰rŠÚbackslashreplacer‹é2)6rÚ menu_specsrVr rSÚTkrÚwithdrawr€rr6ZusetabsZ indentwidthÚhasattrr£r%Úsys_ps1rZprompt_last_lineÚpromptr7Z configurer8Ú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_stdinrür(rÚencodingÚerrorsrr‹ÚpydocZ plainpagerZpagerrðr"Úhistoryró)r3r;Zmsrjr7Zsqueezerr(r>r!r!r"r6^sn       zPyShell.__init__cCs tjddS)NT)Z shell_only)r Z GetExtensions)r3r!r!r"Úget_standard_extension_names¡sz$PyShell.get_standard_extension_namescCs|adS)N)r)r3Ústreamr!r!r"Úset_warning_stream«szPyShell.set_warning_streamcCstS)N)r)r3r!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 idle)rrF) rÔrkrlr7Úset_debugger_indicatorrSrÑÚclose_debuggerÚ open_debugger)r3rZÚdbr!r!r"r5²s   zPyShell.toggle_debuggercCs|j ¡}| d| ¡dS)Nz<>)rSrÑZsetvar)r3rGr!r!r"rDÀs zPyShell.set_debugger_indicatorcCsdS)Nr!)r3rZr!r!r"r6ÄszPyShell.toggle_jit_stack_viewercCsh|j ¡}|r\|j d¡| ¡|jjr8t |jj¡| ¡|j  d¡|j |_ |  ¡|  ¡dS)Nz [DEBUG OFF] )rSrÑrörÒrÃrZclose_remote_debuggerrër‹rr/r0rØrD)r3rGr!r!r"rEÇs   zPyShell.close_debuggercCsX|jjrt |jj|¡}n t |¡}|j |¡| ¡d|j|_ |  ¡|  ¡dS)Nz [DEBUG ON] ) rSrÃrZstart_remote_debuggerr ZDebuggerrörÙr/r0rØrD)r3Zdbg_guir!r!r"rFÔs    zPyShell.open_debuggercCs| ¡d|_dS)zHelper for ModifiedInterpreterTN)rërÔ)r3r!r!r"ràszPyShell.beginexecutingcCsd|_d|_| ¡dS)zHelper for ModifiedInterpreterFN)rÔr rØ)r3r!r!r"rñåszPyShell.endexecutingcCsD|jr&tjddd|jd}|dkr&dS| ¡d|_d|_t |¡S)zExtend EditorWindow.close()zKill?z7Your program is still running! Do you want to kill it?Úok)r¹rFZcancelT) rÔrkZ askokcancelr7rÕr rêrrÒ)r3rôr!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)rErrSrâr9r£r‰r:rŠr;rŒr‹r;rRr?rrz)r3r!r!r"rzús zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr!)r3rr!r!r"Úispythonsource szPyShell.ispythonsourcecCs|jS)N)Ú shell_title)r3r!r!r"Ú short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs†|j dd¡| ¡tr:d}|j ¡}|sF| ¡dSn d}tjt _|  dt j t j |j |f¡|j ¡| ¡ddl}d|_dS) Nr‡rVrGFz›==== 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)r7rÖrërrSrÎrÒrÚ displayhookr£rÚversionÚplatformÚ COPYRIGHTZ focus_forcerØÚtkinterZ _default_root)r3ZnosubZclientrPr!r!r"r„s"  z PyShell.begincCs|js dSd|_|j ¡dS)NT)ÚreadingÚ_stop_readline_flagrÚquit)r3r!r!r"rÕ,szPyShell.stop_readlinecCs‚|j}zd|_|j ¡Wd||_X|jr4d|_dS|j dd¡}t|ƒdkrRd}| ¡|jrnd|_t snt ‚|j r~d|_ d}|S)NTFrGr‡zend-1crra) rQrÚmainlooprRr7Úgetrsrër rréÚ endoffile)r3r.rr!r!r"Úreadline2s( zPyShell.readlinecCsdS)NTr!)r3r!r!r"ÚisattyIszPyShell.isattycCs y|j ddd¡rdSWn YnX|jsR|jsR| ¡|j d¡| ¡dSd|_d|_ |jrŒ|jj rŒ|j  ¡r‚|j  ¡n |j  ¡|jrœ|j ¡dS)Nz sel.firstz!=zsel.lastzKeyboardInterrupt rFFT)r7r“rÔrQrërSrrØrVr rÃrÑrÚràrrS)r3rZr!r!r"r3Ls&      zPyShell.cancel_callbackcCsf|jr|jsdS|j ddd¡r0|j ddd¡s4dS|jsL| ¡| ¡nd|_d|_|j  ¡dS)Nr‡z==rVzend-1cFTrF) rÔrQr7r“rërÒr rVrrS)r3rZr!r!r"r4bs   zPyShell.eof_callbackcCs0|jr"|j dd¡|j d¡n | |¡dS)NrVrarF)rQr7rVÚseeÚnewline_and_indent_event)r3rZr!r!r"r2qs  zPyShell.linefeed_callbackcCs8|jr|jsdSy6|j dd¡}|rD|j ddd¡rD| ||¡dSWn YnX|j ddd¡rV|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¡rv|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)Nz sel.firstzsel.lastz<=r‡rFrVr‘ziomark linestartrŒrrzinsert lineendz>=r‹zinsert linestartzend-1czend-1c linestartra)rÔrQr7rUr“ÚrecallZ tag_prevrangeZ tag_nextrangerÖÚstripr—rZrVrYrNZupdate_idletasksrrSÚrunit)r3rZÚselÚprevÚnextÚindicesr´r!r!r"r1zsX      zPyShell.enter_callbackc Cs<t 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 ¡}xJ|d d…D]:}| |¡r||t |ƒd…}|j  dd| ¡¡qÞWWd|j d¡|j ¡XdS)Nz^\s*\nrGz\n\s*$rar^z1.0ryrVzend-1czinsert linestartú:rrz ^([ \t]*))ÚreÚsubrr7Zundo_block_startr\rÖrUÚrstripÚendswithrZrVr\rsÚsearchÚgrouprfrYZundo_block_stop)r3r´rZrnÚprefixZorig_base_indentZnew_base_indentrr!r!r"r[¹s*     zPyShell.recallcCsž|j dd¡}t|ƒ}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr€||ddkr€|d}q^W|d|…}|j |¡dS)Nr‡zend-1crrz ra)r7rUrsrSr )r3rrÍr!r!r"r]Ós   z PyShell.runitcCsX|jjr|j ¡Sy tjWntjdd|jddSddlm }||j |j ƒdS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined))rr)Ú StackBrowser) rSrÃrïr£Úlast_tracebackrkrlr7Zidlelib.stackviewerrjrjr;)r3rZrjr!r!r"rás    zPyShell.open_stack_viewercCs|j d¡|j d¡dS)Nr‡rÏ)r7rY)r3rZr!r!r"r7ïs zPyShell.view_restart_markcCs|jjdddS)z&Callback for Run/Restart Shell Cntl-F6T)rÀN)rSrÚ)r3rZr!r!r"r8ószPyShell.restart_shellcCs:| ¡|j |j¡|j dd¡| ¡|j ¡dS)NrVzend-1c) rër‹rr0r7rÖÚset_line_and_columnrAZ reset_undo)r3r!r!r"rØ÷s zPyShell.showpromptcCsP|jjj}t|ddd}d | |¡¡}| d¡s:|d7}|jj  d|d¡dS)Nr$T)rÚtabsizeZ expand_tabsraziomark linestartrŠ) rSr¢rr r?r'rfZperZbottomrV)r3rrÚ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‡zend-1czend-2cra) r7rUr?ZstorerVrÖrlZctipZremove_calltip_window)r3rr!r!r"rës zPyShell.resetoutputr!cCsXy0|j dd¡t |||d¡}|j dd¡Wn‚YnX|jrTd|_tsTt‚|S)Nr‡ÚrightrÐF)r7r×rrr rré)r3r´r–Úcountr!r!r"rsz PyShell.writecs8y|j ddd¡rdSWntk r,dSXtƒ ¡S)Nz sel.firstr‘r‡Údisabled)r7r“r”ÚsuperrD)r3)Ú __class__r!r"rDs zPyShell.rmenu_check_cutcs|j ddd¡rdStƒ ¡S)NrVr‘r‡rr)r7r“rsrE)r3)rtr!r"rE&szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r!)9r{r|r}r rJr…r rrr+rrZallow_line_numbersZidlelib.historyr"r6r@rQrÔr rVrêrRrBrCr5rDr6rErFrrñrÒrzrIrKrOr„rÕrWrXr3r4r2r1r[r]rr7r8rØrorërrDrEÚ __classcell__r!r!)rtr"rƒBsl  C      ?     rƒc Cs6|jdkr2x&dD]}| |dd| |d¡¡qWdS)z6Make paste replace selection on x11. See issue #5124.Zx11)ZTextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} N)Z_windowingsystemZ bind_class)rjÚclsr!r!r"Ú fix_x11_paste,s  rwa¢ 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 snddl}ddlm}ddlm}ddlm}tdƒdad}d}d}d}d}d} y| tj dd…d¡\} } WnD|j k r²} z$t d | t ftj d t d ¡Wdd} ~ XYnXxÜ| 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ºW| r´| ddkr´tj ¡}d}x0tttjƒƒD]}tj tj|¡tj|<qÄW| r| ddkrdg| dd…t_ n²|r$d g| t_ nž|r8|g| t_ nŠ| r d}g}x | D]}| tj |¡¡qLWxX|D],}tj |¡}|tjkrntj d|¡qnWn"t ¡}|tjkrÂtj d|¡tj ddddd}|pÜ|}|pè| }trü|süt!ƒt"dda#t# $¡dd l%m&}|t#ƒtj 'tj t(¡d!¡‰|ƒd"kr`tj 'ˆd#¡}t#j)|d$nV| *¡s¶t+d%kr~d&‰d'}nd(‰d)}‡‡fd*d+„|Dƒ}d,d+„|Dƒ}t#j,d0|žŽt-t#ƒt.t#ƒt/t#ƒa0| 1t#t0¡|r,|s,|s,x0| dd…D] }t0 2|¡dkrú|  3|¡qúW| s,t0 4¡|rbt0 5¡}|sDdS| *¡rht0j6rh|j7 8¡nt0j9}|rv| :¡| r¶tj; |¡|sÂ|r |j= ?d/tj f¡|rê|j= @|¡n|rB|j= A|¡|j= >|¡n8|rB| Bt#¡}|r*| C|¡| D¡}|rB| C|¡xt0jErXt# F¡qDWt# G¡tdƒdS)1Nr)Úsystem)Útesting)ÚmacosxTFrz c:deihnr:st:z Error: %s %s)rrvz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tú-rGr¶r·zeditor-on-startupr¸)rºZIdle)Z className)rZIconsZWindowszidle.ico)r¹g333333!@z.png)éé é0éz.gif)r|r}r~cs"g|]}tj ˆd|ˆf¡‘qS)z idle_%d%s)r=r>r?)r³Úsize)ÚextÚicondirr!r"rµÖszmain..cSsg|]}tt|d‘qS))Zmasterr)Z PhotoImagerj)r³Úiconfiler!r!r"rµØsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )T)HÚgetoptrNrxrüryrzr'rr£ÚargvÚerrorrìÚ usage_msgrŠÚexitr‰rr=r>rqrƒrJrŒrrwrsrrQÚdirnamerVÚgetcwdr r¼Z NoDefaultRootr,rjr-Ú idlelib.runrr?Ú__file__Z wm_iconbitmapZisAquaTkÚ TkVersionZ wm_iconphotorrwr€r;ZsetupApprdr[Únewr<ÚdictrÚlowerrRrFÚenvironrUrSrrærrZtkVersionWarningroZpreferTabsPreferenceWarningZ inversedictrTZdestroy)r„rxryrzZ enable_shellZ enable_editrTÚcmdZscriptZstartupZoptsrCrÚoÚarÍZpathxrÚdirZ edit_startrrƒZsizesZ iconfilesZiconsr#ZtkversionwarningZprefer_tabs_preference_warningr!)rr‚r"r¶ms                                      r¶F)NN)Pr£r{r¤rPÚ ImportErrorrìrðrrNZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrkrr,rjr-r‹rrlr rr)r=Zos.pathr rcrÆr¯Útextwrapr rÝrÂrr%Zidlelib.colorizerr Zidlelib.configr rür rZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrÁr¨rr#r$r'Ú checkcacher0r1r€r…rZ RPCClientr˜rŸr rƒrwr‡r¶r!r!r!r"Ús                   ?0m?6