B Oé ·Èã @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éÚ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 CsP|dkr t}y&| t|||||d¡| d¡Wnttfk rJYnXdS)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)N)Ú_warnings_showwarningÚwarningsÚ showwarningr$)Zcapturer"r"r#Úcapture_warningsXsr(TcCs\tj}i}x:t|ƒD].}|dd…|dd…dkr| |¡||<qW||ƒ| |¡dS)Nréÿÿÿÿz<>)Ú linecacheÚcacheÚlistÚpopÚupdate)r Zorig_checkcacher+ÚsaveÚkeyr"r"r#Úextended_linecache_checkcachegs r1c@szeZdZdd„ZddddddgZdd d „Zd d „Zd dd„Zd!dd„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„ZdS)"ÚPyShellEditorWindowcGs”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_hookr r3Úcolor_breakpoint_text)r4Úargsr5r"r"r#r7s   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)NÚbreakÚ)Ú foregroundÚ backgroundÚBREAK)rBr Ú CurrentThemeÚ GetHighlightr8Z tag_config)r4ZcolorÚthemeZcfgr"r"r#rCžs  z)PyShellEditorWindow.color_breakpoint_textcCsˆ|j}|jj}| dd|d|d¡y|j |¡Wn tk rX|j |¡YnXy|jj j j }|  ||¡Wn YnXdS)NrKz%d.0r) r8rBr Útag_addr6ÚindexÚ ValueErrorÚappendr<ÚpyshellÚinterprr:)r4r!r8r Údebugr"r"r#Úset_breakpointªs z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s| ¡dStt| d¡ƒƒ}| |¡dS)NÚinsert)r8rBr ÚbellÚintÚfloatrPrV)r4Úeventr8r r!r"r"r#r:¸sz'PyShellEditorWindow.set_breakpoint_herecCsŠ|j}|jj}|s| ¡dStt| d¡ƒƒ}y|j |¡Wn YnX|  ddd¡y|j j j j }| ||¡Wn YnXdS)NrWrKzinsert linestartzinsert lineend +1char)r8rBr rXrYrZrPr6ÚremoveÚ tag_remover<rSrTrr;)r4r[r8r r!rUr"r"r#r;Ás" z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$| ¡dSg|_| ddt¡y|jjj j }|  |¡Wn YnXdS)NrKz1.0) r6r8rBr rXr]ZENDr<rSrTrÚclear_file_breaks)r4r8r rUr"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 _ tjdd t |ƒ|jd Wdd}~XYnXdS) NÚrÚwú=Ú Úbreakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)Útitlerr)r6rBr ÚopenrAÚ readlinesrÚ startswithrÚupdate_breakpointsÚstrÚgetattrÚrootrcÚ tkMessageBoxÚ showerrorr8)r4Zbreaksr Ú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_rar)r8r.rBr r>r?ÚisfilerArerfrgÚevalÚlenrV)r4r rnrorZbreakpoint_linenumbersZbreakpoint_linenumberr"r"r#r3 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}| d¡}| |¡}||_dS)NrK)r8Z tag_rangesÚranges_to_linenumbersr6)r4r8ÚrangesZlinenumber_listr"r"r#rhs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|ƒdƒD]L}tt||jƒƒ}tt||djƒƒ}x||kr`| |¡|d7}qDWqW|S)Nrér)ÚrangertrYrZÚstringrR)r4rvrorPr!Úendr"r"r#ru%s  z)PyShellEditorWindow.ranges_to_linenumberscCs| ¡t |¡dS)N)r^rÚ_close)r4r"r"r#r{6szPyShellEditorWindow._close)T)N)N)Ú__name__Ú __module__Ú __qualname__r7Ú rmenu_specsrCrVr:r;r^rqr3rhrur{r"r"r"r#r2~s"  *r2c@seZdZeZdZddd„ZdS)ÚPyShellFileListNcCs8|jr|jj ¡nt|ƒ|_|jr2|j ¡s2dS|jS)N)rSÚtopÚwakeupÚPyShellÚbegin)r4r[r"r"r#r=Es  zPyShellFileList.open_shell)N)r|r}r~r2rrSr=r"r"r"r#r€<sr€c@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚModifiedColorDelegatorcCst |¡| ¡dS)N)r r7Ú LoadTagDefs)r4r"r"r#r7Ss zModifiedColorDelegator.__init__cCs*| ddd¡| ddd¡t |¡dS)NZTODOz1.0ÚiomarkZSYNC)r]rOr Úrecolorize_main)r4r"r"r#rˆWsz&ModifiedColorDelegator.recolorize_mainc CsJt |¡t ¡}|j dddœt |d¡t |d¡t |d¡dœ¡dS)N)rJrIÚstdoutÚstderrÚconsole)Ústdinr‰rŠr‹)r r†r rLÚtagdefsr.rM)r4rNr"r"r#r†\s   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}| |dd¡qWdS)Nr‡rz)rr])r4Útagr"r"r#Ú removecolorsfs z#ModifiedColorDelegator.removecolorsN)r|r}r~r7rˆr†rr"r"r"r#r…Ps r…c@s eZdZddd„Zddd„ZdS)ÚModifiedUndoDelegatorNcCsLy"|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__r r7Ú restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r4r¢r¡r"r"r#r7—s zModifiedInterpreter.__init__NcCs&|jdkr| ¡|_t |j¡|_dS)N)r§Úbuild_subprocess_arglistÚ subprocessÚPopenÚ rpcsubproc)r4r"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Ú executablerir©)r4r`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*rTT)Úwith_cwd)ÚHOSTr©rxÚ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)r4ZaddrÚir"r"r#Ústart_subprocessµs>       z$ModifiedInterpreter.start_subprocessFrHcCs0|jr |jSd|_| ¡}|rYnXy|j ¡Wntk rbYnX| ¡d|j_ d|_dS)NF) Ú_afteridr¢r8Z after_cancelrÃrÅrÒrrÓrÔ)r4r"r"r#Úkill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|j ¡Wntk r"dSXy|j ¡Wntk rFdSXdS)N)r±ÚkillrÚwait)r4r"r"r#rÓ!sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}| tj¡ntj}| d|f¡dS)NrHzRif 1: import sys as _sys _sys.path = %r del _sys )Úextendr£r?Ú runcommand)r4rÀ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__Ú endexecutingrr8ÚafterÚ pollintervalrÌrá)r4ZcltÚresponseZhowZwhatr‹Úerrmsgr"r"r#rÌ=s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r)r4rr"r"r#Ú setdebuggereszModifiedInterpreter.setdebuggercCs|jS)N)r)r4r"r"r#rÑhszModifiedInterpreter.getdebuggercCs|jj d|j¡dS)Ni,)r¢r8ròrï)r4r"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ÚTreeNodeZnormalrJ)ÚbgZhighlightthicknessrZboth)ÚexpandÚfill)ÚidlelibrørÃÚ remotequeuer¢rkrXZStubObjectTreeItemZ idlelib.treerùrúZToplevelr rLrMÚframeÚpackZcanvasrü) r4røZoidÚitemrùrúrrNrJZscZnoder"r"r#rïxs   z'ModifiedInterpreter.remote_stack_viewerrcCs| |¡}| ||¡dS)N)Ú stuffsourceÚexecfile)r4Úsourcer r"r"r#Ú execsource‹s zModifiedInterpreter.execsourcec Cs®|dkrFt |¡.}| ¡}trr?ÚabspathrªÚ OverflowErrorÚ SyntaxErrorr¢rërìrŠr ÚshowsyntaxerrorrØÚruncode)r4r rrnÚcoder"r"r#rs &   zModifiedInterpreter.execfilecCs| |¡}t |||¡S)N)rr Ú runsource)r4rr r"r"r#r¤s zModifiedInterpreter.runsourcecCs>d|j}|jd|_| d¡}t|ƒdd||ftj|<|S)Nz rrbr)ÚgidÚsplitrtr*r+)r4rr ror"r"r#r­s    zModifiedInterpreter.stuffsourcecCs| d|f¡dS)Na(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 )ræ)r4r r"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)Nrçz1.0rzÚmsgrHzr!rÚoffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) r¢r8r]r£Úexc_inforjZcolorize_syntax_errorrërrØ) r4r r¢r8rºÚvalueÚtbrr!rÚposr"r"r#r Ás" z#ModifiedInterpreter.showsyntaxerrorcCs6|j ¡| ¡t |¡|j d¡r2|j ¡dS)Nz<>)r¢rëÚchecklinecacher Ú showtracebackrîÚopen_stack_viewer)r4r"r"r#rÛs    z!ModifiedInterpreter.showtracebackcCsBtj}x6t| ¡ƒD]&}|dd…|dd…dkr||=qWdS)Nrr)z<>)r*r+r,Úkeys)r4Úcr0r"r"r#rãsz"ModifiedInterpreter.checklinecachecCs@|jjr| ¡dS|jr0|j dd|fi¡n t||jƒdS)NrrÛrr)r¢rÔÚdisplay_executing_dialogrÃrÿrÛr¡)r4rr"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 |jjdn| ¡YnXWdtsHy|j ¡Wntk rFYnXXdS) NrÛrzExit?zDo you want to exit altogether?Zyes)r¹rz IDLE internal error in runcode())rFré)r¢rÔrTrÚrrÚbeginexecutingrÃZ asyncqueuerèÚrunr¡rÛÚ SystemExitrêrlZaskyesnor8rr rìrŠrñÚcanceledr)r4rrr"r"r#rõsJ        zModifiedInterpreter.runcodecCs|jj |¡S)N)r¢rŠr)r4r´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)rlrmr¢r8)r4r"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)rlrmr¢r8)r4r"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)rlrmr¢r8)r4r"r"r#r:sz,ModifiedInterpreter.display_executing_dialog)FrH)F)N)N)&r|r}r~r7rárÃr±r²r®rÎrÚrÞràrârÓrËrèrÌrrörÑr÷rïrrrrrrr rrrærrrÄ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)rUZ_Debug)ÚoptionsZ_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)NrwrÚshell)r'ZShe_llTéÚps1z>>> rbr)Úchar)Úwrapz<>z<>z<>z<>z<>z<>z<>z<>z<>z<>)ÚiomenurŒr‰rŠÚbackslashreplacer‹é2)6r Ú menu_specsrWr rTÚTkrÚwithdrawr€rr7ZusetabsZ indentwidthÚhasattrr£r)Úsys_ps1rZprompt_last_lineÚpromptr8Z configurer9Ú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ó)r4r<Úmsrkr8Zsqueezerr,rBr"r"r#r7^sn       zPyShell.__init__cCs tjddS)NT)Z shell_only)r Z GetExtensions)r4r"r"r#Úget_standard_extension_names¡sz$PyShell.get_standard_extension_namescCs|adS)N)r)r4Ústreamr"r"r#Úset_warning_stream«szPyShell.set_warning_streamcCstS)N)r)r4r"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)rrG) rÔrlrmr8Úset_debugger_indicatorrTrÑÚclose_debuggerÚ open_debugger)r4r[Údbr"r"r#r9²s   zPyShell.toggle_debuggercCs|j ¡}| d| ¡dS)Nz<>)rTrÑZsetvar)r4rLr"r"r#rIÀs zPyShell.set_debugger_indicatorcCsdS)Nr")r4r[r"r"r#r:ÄszPyShell.toggle_jit_stack_viewercCsh|j ¡}|r\|j d¡| ¡|jjr8t |jj¡| ¡|j  d¡|j |_ |  ¡|  ¡dS)Nz [DEBUG OFF] )rTrÑrörÒrÃrZclose_remote_debuggerrër‹rr3r4rØrI)r4rLr"r"r#rJÇs   zPyShell.close_debuggercCsX|jjrt |jj|¡}n t |¡}|j |¡| ¡d|j|_ |  ¡|  ¡dS)Nz [DEBUG ON] ) rTrÃrZstart_remote_debuggerrZDebuggerrörÙr3r4rØrI)r4Zdbg_guir"r"r#rKÔs    zPyShell.open_debuggercCs| ¡d|_dS)NT)rërÔ)r4r"r"r#r àszPyShell.beginexecutingcCsd|_d|_| ¡dS)NF)rÔr#rØ)r4r"r"r#rñåszPyShell.endexecutingcCsD|jr&tjddd|jd}|dkr&dS| ¡d|_d|_t |¡S)NzKill?z7Your program is still running! Do you want to kill it?Úok)r¹rFZcancelT) rÔrlZ askokcancelr8rÕr#rêrrÒ)r4rôr"r"r#rÒës z PyShell.closecCsV| ¡tr|j ¡|jt_|jt_|j t_ d|_d|_ d|j _ d|_t |¡dS)N)rJr rTrâr=r£r‰r>rŠr?rŒr‹r<rSrCrr{)r4r"r"r#r{ús zPyShell._closecCsdS)NTr")r4r r"r"r#Úispythonsource szPyShell.ispythonsourcecCs|jS)N)Ú shell_title)r4r"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‡rWrHFz›==== 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)r8rÖrër rTrÎrÒrÚ displayhookr£rÚversionÚplatformÚ COPYRIGHTZ focus_forcerØÚtkinterZ _default_root)r4ZnosubZclientrUr"r"r#r„s"  z PyShell.begincCs|js dSd|_|j ¡dS)NT)ÚreadingÚ_stop_readline_flagrÚquit)r4r"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)NTFrHr‡zend-1crrb) rVrÚmainlooprWr8Úgetrtrër#r réÚ endoffile)r4r/rr"r"r#Úreadline2s( zPyShell.readlinecCsdS)NTr")r4r"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 rGFT)r8r“rÔrVrërTrrØr[r#rÃrÑrÚràrrX)r4r[r"r"r#r7Ls&      zPyShell.cancel_callbackcCsf|jr|jsdS|j ddd¡r0|j ddd¡s4dS|jsL| ¡| ¡nd|_d|_|j  ¡dS)Nr‡z==rWzend-1cFTrG) rÔrVr8r“rërÒr#r[rrX)r4r[r"r"r#r8bs   zPyShell.eof_callbackcCs0|jr"|j dd¡|j d¡n | |¡dS)NrWrbrG)rVr8rWÚseeÚnewline_and_indent_event)r4r[r"r"r#r6qs  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‡rGrWr‘ziomark linestartrŒrrzinsert lineendz>=r‹zinsert linestartzend-1czend-1c linestartrb)rÔrVr8rZr“ÚrecallZ tag_prevrangeZ tag_nextrangerÖÚstripr—r_rWr^rOZupdate_idletasksrrXÚrunit)r4r[ÚselÚprevÚnextÚindicesr´r"r"r#r5zsX      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*\nrHz\n\s*$rbrcz1.0rzrWzend-1czinsert linestartú:rrz ^([ \t]*))ÚreÚsubrr8Zundo_block_startr]rÖrZÚrstripÚendswithr_rWrartÚsearchÚgrouprgr^Zundo_block_stop)r4r´r[roÚ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 rb)r8rZrtrTr)r4rrÍr"r"r#rbÓ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) rTrÃrïr£Úlast_tracebackrlrmr8Zidlelib.stackviewerrorkr<)r4r[ror"r"r#rás    zPyShell.open_stack_viewercCs|j d¡|j d¡dS)Nr‡rÏ)r8r^)r4r[r"r"r#r;ïs zPyShell.view_restart_markcCs|jjdddS)NT)rÀ)rTrÚ)r4r[r"r"r#r<ószPyShell.restart_shellcCs:| ¡|j |j¡|j dd¡| ¡|j ¡dS)NrWzend-1c) rër‹rr4r8rÖÚset_line_and_columnrBZ reset_undo)r4r"r"r#rØ÷s zPyShell.showpromptcCsP|jjj}t|ddd}d | |¡¡}| d¡s:|d7}|jj  d|d¡dS)Nr(T)rÚtabsizeZ expand_tabsrbziomark linestartrŠ) rTr¢rr r@r+rkZperZbottomrW)r4rrÚ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-2crb) r8rZrCÚstorerWrÖrqZctipZremove_calltip_window)r4rr"r"r#rës zPyShell.resetoutputr"cCsXy0|j dd¡t |||d¡}|j dd¡Wn‚YnX|jrTd|_tsTt‚|S)Nr‡ÚrightrÐF)r8r×rrr#r ré)r4r´r–Úcountr"r"r#rsz PyShell.writecs8y|j ddd¡rdSWntk r,dSXtƒ ¡S)Nz sel.firstr‘r‡Údisabled)r8r“r”ÚsuperrE)r4)Ú __class__r"r#rEs zPyShell.rmenu_check_cutcs|j ddd¡rdStƒ ¡S)NrWr‘r‡rx)r8r“ryrF)r4)rzr"r#rF&szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r")9r|r}r~r rOr…r rrr/rrZallow_line_numbersZidlelib.historyr&r7rErVrÔr#r[rêrWrGrHr9rIr:rJrKr rñrÒr{rNrPrTr„rÕr\r]r7r8r6r5r`rbrr;r<rØrtrërrErFÚ __classcell__r"r")rzr#rƒBsl  C      ?     rƒc Cs6|jdkr2x&dD]}| |dd| |d¡¡qWdS)NZx11)ZTextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} )Z_windowingsystemZ bind_class)rkÚ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 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)rrwz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tú-rHr¶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 PhotoImagerk)r³Úiconfiler"r"r#rµØsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )T)HÚgetoptrSr~rþrr€r(r r£ÚargvÚerrorrìÚ usage_msgrŠÚexitr‰rr>r?rrrƒrOrŒrrxrtr rRÚdirnamerWÚgetcwdr r¼Z NoDefaultRootr0rkr1Ú idlelib.runrr@Ú__file__Z wm_iconbitmapZisAquaTkÚ TkVersionZ wm_iconphotorr}r€r<ZsetupApprer\Únewr=ÚdictrÚlowerrSrKÚenvironrZrTrrærrZtkVersionWarningrtZpreferTabsPreferenceWarningZ inversedictrYZdestroy)rŠr~rr€Z enable_shellZ enable_editrUÚcmdZscriptZstartupZoptsrDrÚoÚarÍZpathxr ÚdirZ edit_startrr‰ZsizesZ iconfilesZiconsr'ZtkversionwarningZprefer_tabs_preference_warningr")r‡rˆr#r¶ms                                      r¶F)NN)Pr£r|r¤rUÚ ImportErrorrìrðr"rSZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrlr“r0rkr1r‘rrmrr r*r>Zos.pathr rhrÆr¯Útextwrapr rÝrÂrr&Zidlelib.colorizerr Zidlelib.configr rþrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrÁr¨rr$r%r(Ú checkcacher1r2r€r…rZ RPCClientr˜rŸr rƒr}rr¶r"r"r"r#Ús                   ?0m?6