3 Õì2auáã@sÂddlZy ddlTWn*ek r>edejd�edƒ‚YnXejdkr†y ddlZdZej dƒj eƒWnee e fk r„YnXddl jZedkrÖeƒatjƒdd lmZetƒejd d etd �edƒ‚dd lmZddlZddlZddlZddlmZddlZddlZddlZddl m!Z!ddl"Z"ddl#Z#ddl$Z$ddl%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl*m,Z,ddl-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ddl*m4Z4ddlm5Z5m6Z6m7Z7ddl8m9Z9dZ:dZ;ejadd„Z?e?dƒdej@fd d!„ZAeAe_@Gd"d#„d#e.ƒZBGd$d%„d%e1ƒZCGd&d'„d'e'ƒZDGd(d)„d)e9ƒZEGd*d+„d+e4jFƒZGGd,d-„d-eƒZHGd.d/„d/e3ƒZId0d1„ZJd2ZKd3d4„ZLeMd5k�r¶ejNd5ejNd6<eLƒe?d7ƒdS)9éN)Ú*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ÚPseudoInputFileÚPseudoOutputFile)Ú UndoDelegatorz 127.0.0.1cCsP|dkr t}y&|jt|||||d�ƒ|jdƒWnttfk rJYnXdS)N)Úlinez>>> )Úwarning_streamÚwriterÚAttributeErrorÚOSError)ÚmessageÚcategoryÚfilenameÚlinenorr©r!ú,/opt/alt/python36/lib64/python3.6/pyshell.pyÚidle_showwarningCsr#cCs0|rtdkr,tjatt_ntdk r,tt_dadS)N)Ú_warnings_showwarningÚwarningsÚ showwarningr#)Zcapturer!r!r"Úcapture_warningsVsr'TcCs\tj}i}x:t|ƒD].}|dd…|dd…dkr|j|ƒ||<qW||ƒ|j|ƒdS)Nrz<>éÿÿÿÿ)Ú linecacheÚcacheÚlistÚpopÚupdate)rZorig_checkcacher*ÚsaveÚkeyr!r!r"Úextended_linecache_checkcachees r0c@szeZdZdd„Zd&d'd(d)d*d+gZd,dd„Zdd„Zd-dd„Zd.dd„Zdd„Z dd„Z dd„Z d d!„Z d"d#„Z d$d%„Zd S)/ÚPyShellEditorWindowcGs”g|_tj|f|žŽ|jjd|jƒ|jjd|jƒ|jjd|jjƒt j j t j dƒ|_|jj|fdd„}|jj|ƒ|jjrˆ|jƒ|jƒdS)Nz<>z<>z<>zbreakpoints.lstcSs|jƒ|ƒ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__ÚCutú<>Úrmenu_check_cutÚCopyú<>Úrmenu_check_copyÚPasteú <>Úrmenu_check_pasteNúSet Breakpointú<>úClear Breakpointú<>TcCsD|jdkrdS|r(tjƒ}tj|dƒ}n dddœ}|jjd|ƒdS)NÚbreakÚ)Ú foregroundÚ backgroundÚBREAK)rAr Ú CurrentThemeÚ GetHighlightr7Z tag_config)r3ZcolorÚthemeZcfgr!r!r"rB›s  z)PyShellEditorWindow.color_breakpoint_textcCsˆ|j}|jj}|jdd|d|dƒy|jj|ƒWn tk rX|jj|ƒYnXy|jj j j }|j ||ƒWn YnXdS)NrUz%d.0r) r7rArÚtag_addr5ÚindexÚ ValueErrorÚappendr;ÚpyshellÚinterpr r9)r3r r7rÚdebugr!r!r"Úset_breakpoint§s z"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|jƒdStt|jdƒƒƒ}|j|ƒdS)NÚinsert)r7rArÚbellÚintÚfloatrZr`)r3Úeventr7rr r!r!r"r9µsz'PyShellEditorWindow.set_breakpoint_herecCsŠ|j}|jj}|s|jƒdStt|jdƒƒƒ}y|jj|ƒWn YnX|j dddƒy|j j j j }|j||ƒWn YnXdS)NrarUzinsert linestartzinsert lineend +1char)r7rArrbrcrdrZr5ÚremoveÚ tag_remover;r]r^r r:)r3rer7rr r_r!r!r"r:¾s" z)PyShellEditorWindow.clear_breakpoint_herec Csd|jr`|j}|jj}|s$|jƒdSg|_|jddtƒy|jjj j }|j |ƒWn YnXdS)NrUz1.0) r5r7rArrbrgZENDr;r]r^r Úclear_file_breaks)r3r7rr_r!r!r"rhÑs z%PyShellEditorWindow.clear_file_breakscCs|j}|jj}y$t|jdƒ�}|jƒ}WdQRXWntk rJg}YnXynt|jdƒ�X}x$|D]}|j|dƒsb|j|ƒqbW|j ƒ|j}|r®|j|dt |ƒdƒWdQRXWnVtk �r}z8t |j ddƒ�sd|j _ tjdd t |ƒ|jd �WYdd}~XnXdS) NÚrÚwú=Ú Úbreakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)Útitlerr)r5rArÚopenr@Ú readlinesrÚ startswithrÚupdate_breakpointsÚstrÚgetattrÚrootrmÚ tkMessageBoxÚ showerrorr7)r3ZbreaksrÚfpÚlinesZnew_filerÚerrr!r!r"Ústore_file_breaksàs.  (z%PyShellEditorWindow.store_file_breaksc Csª|jjƒ|jdkrdS|jj}|dkr,dStjj|jƒr¦t|jdƒ�}|j ƒ}WdQRXxJ|D]B}|j |dƒr`t |t |ƒdd…ƒ}x|D]}|j |ƒq�Wq`WdS)Nrirkr)r7r-rArr=r>Úisfiler@rorprqÚevalÚlenr`)r3rrxryrZbreakpoint_linenumbersZbreakpoint_linenumberr!r!r"r2 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}|jdƒ}|j|ƒ}||_dS)NrU)r7Z tag_rangesÚranges_to_linenumbersr5)r3r7ÚrangesZlinenumber_listr!r!r"rrs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|ƒdƒD]L}tt||jƒƒ}tt||djƒƒ}x||kr`|j|ƒ|d7}qDWqW|S)Nrér)Úranger~rcrdÚstringr\)r3r€ryrZr Úendr!r!r"r"s  z)PyShellEditorWindow.ranges_to_linenumberscCs|jƒtj|ƒdS)N)rhrÚ_close)r3r!r!r"r…3szPyShellEditorWindow._close)rDrErF)rGrHrI)rJrKrL)NNN)rMrNN)rOrPN)T)N)N)Ú__name__Ú __module__Ú __qualname__r6Ú rmenu_specsrBr`r9r:rhr{r2rrrr…r!r!r!r"r1|s"  *r1c@seZdZeZdZddd„ZdS)ÚPyShellFileListNcCs8|jr|jjjƒnt|ƒ|_|jr2|jjƒs2dS|jS)N)r]ÚtopÚwakeupÚPyShellÚbegin)r3rer!r!r"r<Bs  zPyShellFileList.open_shell)N)r†r‡rˆr1rr]r<r!r!r!r"rŠ9srŠc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚModifiedColorDelegatorcCstj|ƒ|jƒdS)N)r r6Ú LoadTagDefs)r3r!r!r"r6Ps zModifiedColorDelegator.__init__cCs*|jdddƒ|jdddƒtj|ƒdS)NZTODOz1.0ÚiomarkZSYNC)rgrYr Úrecolorize_main)r3r!r!r"r’Tsz&ModifiedColorDelegator.recolorize_maincCsJtj|ƒtjƒ}|jjdddœtj|dƒtj|dƒtj|dƒdœƒdS)N)rTrSÚstdoutÚstderrÚconsole)Ústdinr“r”r•)r r�r rVÚtagdefsr-rW)r3rXr!r!r"r�Ys   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|ddƒqWdS)Nr‘r„)r—rg)r3Útagr!r!r"Ú removecolorscs z#ModifiedColorDelegator.removecolorsN)r†r‡rˆr6r’r�r™r!r!r!r"r�Ms r�c@s eZdZddd„Zddd„ZdS)ÚModifiedUndoDelegatorNc CsLy"|jj|ddƒr |jjƒdSWntk r6YnXtj||||ƒdS)Nú„Z%dS)CÚModifiedInterpretercCsH||_tjdj}tj||d�d|_d|_d|_t |_ |j j j |_dS)NÚ__main__)ÚlocalsF)Ú tkconsoleÚsysÚmodulesÚ__dict__rr6Úsave_warnings_filtersÚ restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r3r¨r§r!r!r"r6‡s zModifiedInterpreter.__init__NcCs&|jdkr|jƒ|_tj|jƒ|_dS)N)r®Úbuild_subprocess_arglistÚ subprocessÚPopenÚ rpcsubproc)r3r!r!r"Úspawn_subprocess•s  z$ModifiedInterpreter.spawn_subprocesscCs^dd„tjDƒ}tjdddddd�}td kr8d |f}n 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Útypezidlelib.pyshellz&__import__('idlelib.run').run.main(%r)z__import__('run').main(%r)z-c)r©Ú warnoptionsr Ú GetOptionr†Ú executablersr°)r3rjZ del_exitfZcommandr!r!r"rµšs    z,ModifiedInterpreter.build_subprocess_arglistc CsZt|jf}xLtdƒD]4}tj|ƒyt|ƒ|_PWqtk rFYqXqW|jƒdS|jj j ƒd|_t dkrˆ|jj j t jt jdƒ|jƒ|jj jdƒy|jjƒWnt jk rÊ|jƒdSX|jjd|jƒ|jjd|jjƒ|jjd|jjƒ|jjd|jjƒ|jjd |jjƒ|jjd tƒ|jjd |ƒ|jd d �|jƒ|jS)Nérré r•r–r“r”r;r)r^T)Úwith_cwd)ÚHOSTr°r‚Ú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_subprocessFrRcCsT|jr |jSd|_|jƒ}|rYnXy|jjƒWntk rbYnX|jƒd|j_ d|_dS)NF) Ú_afteridr¨r7Z after_cancelrÊrÌrÚrrÛrÜ)r3r!r!r"Úkill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|jjƒWntk r"dSXy|jjƒWntk rFdSXdS)N)r¸ÚkillrÚwait)r3r!r!r"rÛsz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtjƒntj}|jd|fƒdS)NrRzRif 1: import sys as _sys _sys.path = %r del _sys )Úextendr©r>Ú runcommand)r3rÇr>r!r!r"rÒ#s z!ModifiedInterpreter.transfer_pathcCs6|j}|dkrdSy|j|jdd�}Wn2tttfk rX|jjrHdSd}|jƒYnX|�r|jj ƒd|_|\}}|jj }|dkr¢|dk rêt t |ƒ|d�nH|dkrÀ|jj dƒrê|jƒn*|dkrêd}t ||tjd�t |||d�y|jjƒWntk �rYnX|jj�s2|jjj|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Ó2s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r )r3r r!r!r"Ú setdebuggerZszModifiedInterpreter.setdebuggercCs|jS)N)r )r3r!r!r"rÙ]szModifiedInterpreter.getdebuggercCs|jjjd|jƒdS)Ni,)r¨r7rürù)r3r!r!r"Úopen_remote_stack_viewer`s z,ModifiedInterpreter.open_remote_stack_viewerc Cs°ddlm}|jjddd iƒ}|dkr6|jjjƒdS|j|j|ƒ}ddlm }m }t |jjƒ}t j ƒ}t j|dƒd}|||dd �} | jjd d d �|| jd|ƒ} | jƒdS)Nr)Ú debugobj_rråZ stackviewerr;)ÚScrolledCanvasÚTreeNodeZnormalrT)ÚbgZhighlightthicknessrZboth)ÚexpandÚfill)r;)ÚidlelibrrÊÚ remotequeuer¨rurbZStubObjectTreeItemZ idlelib.treerrZToplevelr rVrWÚframeÚpackZcanvasr) r3rZoidÚitemrrr‹rXrTZscZnoder!r!r"rùms   z'ModifiedInterpreter.remote_stack_viewerrcCs|j|ƒ}|j||ƒdS)N)Ú stuffsourceÚexecfile)r3Úsourcerr!r!r"Ú execsource€s zModifiedInterpreter.execsourcecCs®|dkrFtj|ƒ�.}|jƒ}trÚabspathr±Ú OverflowErrorÚ SyntaxErrorr¨rõrör”rÚshowsyntaxerrorrâÚruncode)r3rrrxÚcoder!r!r"r…s &   zModifiedInterpreter.execfilec Csd|j|ƒ}d|_tjdd…|_tjdtd�ztj|||ƒS|jdk r^|jtjdd…<d|_XdS)NrÚerror)Úactionr) r Zmorer%Úfiltersr¬ÚfilterwarningsÚ SyntaxWarningrÚ runsource)r3rrr!r!r"r™s   zModifiedInterpreter.runsourcecCs>d|j}|jd|_|jdƒ}t|ƒdd||ftj|<|S)Nz rrlr)ÚgidÚsplitr~r)r*)r3rrryr!r!r"r ²s    zModifiedInterpreter.stuffsourcecCs|jd|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ð)r3rr!r!r"Úprepend_syspathºsz#ModifiedInterpreter.prepend_syspathc CsÄ|j}|j}|jdddƒtjƒ\}}}t|ddƒp:|p:d}t|ddƒpJd}t|d dƒpZd } | d krl|d7}|dkr‚d | d} nd |d| df} |j|| ƒ|jƒ|jd |ƒ|j ƒdS)Nrñz1.0r„ÚmsgrRzr rÚoffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) r¨r7rgr©Úexc_infortZcolorize_syntax_errorrõrrâ) r3rr¨r7rÁÚvalueÚtbr#r r$Úposr!r!r"rÆs" z#ModifiedInterpreter.showsyntaxerrorcCs6|jjƒ|jƒtj|ƒ|jjdƒr2|jjƒdS)Nz<>)r¨rõÚchecklinecacherÚ showtracebackrøÚopen_stack_viewer)r3r!r!r"r*às    z!ModifiedInterpreter.showtracebackcCsBtj}x6t|jƒƒD]&}|dd…|dd…dkr||=qWdS)Nrz<>r()r)r*r+Úkeys)r3Úcr/r!r!r"r)èsz"ModifiedInterpreter.checklinecachecCs@|jjr|jƒdS|jr0|jjdd|fiƒn t||jƒdS)Nrrårr)r¨rÜÚdisplay_executing_dialogrÊr rår§)r3rr!r!r"rðîs zModifiedInterpreter.runcommandcCst|jjr|jjƒ|jƒ|jdk r:|jtjdd…<d|_|j}�zþyV|jj ƒ| rx|j dk rx|j j dd|fiƒ|_ n |rŒ|j ||jƒn t||jƒWn¢tk rÜ|jjsÖtjddd|jjd�rÌ‚qØ|jƒn‚Ynbt�r td|jjd�|jƒ|jjƒn,|jj�r0d |j_td |jjd�n|jƒYnXWdt�sny|jjƒWntk �rlYnXXdS) NrårzExit?zDo you want to exit altogether?Úyes)rÀrz IDLE internal error in runcode())rFró)r¨rÜr^rär)r¬r%rr ÚbeginexecutingrÊZ asyncqueueròZrunr§råÚ SystemExitrôrvZaskyesnor7r*rrör”rûÚcanceledr)r3rr r!r!r"rúsP         zModifiedInterpreter.runcodecCs|jjj|ƒS)N)r¨r”r)r3r»r!r!r"r+szModifiedInterpreter.writecCstjdd|jjd�dS)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)rvrwr¨r7)r3r!r!r"rË/sz.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjd�dS)NzSubprocess Startup Errorz‰IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.)r)rvrwr¨r7)r3r!r!r"rÐ:sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjd�dS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rvrwr¨r7)r3r!r!r"r.Bsz,ModifiedInterpreter.display_executing_dialog)FrR)F)N)N)&r†r‡rˆr6rërÊr¸r¹rµrÕrärèrêrìrÛrÒròrÓr rrÙrrùr rrrr r"rr*r)rðrrrËrÐr.r!r!r!r"r¥…sF + - &    1 r¥cs”eZdZdeƒdZeZeZdZd[d\d]d^d_gZ e j d`gZ ddl m Z dadd„Zdd„ZdZdZdZdZdZdZdd„Zdd„Zdbdd„Zdd „Zdcd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Z d/d0„Z!d1d2„Z"d3Z#d4d5„Z$d6d7„Z%d8d9„Z&d:d;„Z'dddd?„Z)d@dA„Z*dBdC„Z+dDdE„Z,dFdG„Z-dedHdI„Z.dfdJdK„Z/dgdLdM„Z0dNdO„Z1dPdQ„Z2dRdS„Z3ffdTdU„Z4‡fdVdW„Z5‡fdXdY„Z6‡Z7S)hr�zPython z ShellrÚ_FileÚeditÚ_Editr_Ú_DebugÚoptionsÚ_OptionsÚwindowÚ_WindowÚhelpÚ_HelpÚSqueezeú<>r)ÚHistoryNc Csþtr&|j}|dddkr&|jddƒt|ƒ|_|dkrVtƒ}t|ƒ|jƒt|ƒ}t j ||ddƒd|_ d|_ t tdƒr‚tjnd|_|jjd ƒd|_|j|_|j}|jd d �|jd |jƒ|jd|jƒ|jd|jƒ|jd|jƒ|jd|jƒ|jd|jƒ|jd|jƒt�r8|jd|jƒ|jd|jƒtj |_!tj"|_#tj$|_%ddl&m'}t(|d|j)ƒ|_$t*|d|j)ƒ|_ t*|d|j)ƒ|_"t*|d|j)ƒ|_+t�sº|j t_ |j"t_"|j$t_$yddl,}|j-|_.Wntj/t_"‚YnX|j0|jƒ|_1d|_2dS)Nr�rÚshellÚShe_llTéÚps1z>>> rlrÚchar)Úwrapz<>z<>z<>z<>z<>z<>z<>z<>z<>)Úiomenur–r“r”r•é2)r@rAr()3rÚ menu_specsrar¥r^ÚTkrÚwithdrawrŠrr6ZusetabsZ indentwidthÚhasattrr©rCÚsys_ps1r!Zprompt_last_lineÚpromptr7Z configurer8Úenter_callbackÚlinefeed_callbackÚcancel_callbackÚ eof_callbackr+Útoggle_debuggerÚtoggle_jit_stack_viewerÚview_restart_markÚ restart_shellr“Ú save_stdoutr”Ú save_stderrr–Ú save_stdinrrFrÚencodingrr•ÚpydocZ plainpagerZpagerrúr?Úhistoryrý)r3r;Úmsrur7rFrZr!r!r"r6ds`     zPyShell.__init__cCs tjdd�S)NT)Z shell_only)r Z GetExtensions)r3r!r!r"Úget_standard_extension_names sz$PyShell.get_standard_extension_namesFcCs|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�|jƒdS|jjƒ}|r<|jƒn|jƒdS)NzDon't debug nowz*You can only toggle the debugger when idle)rrQ) rÜrvrwr7Úset_debugger_indicatorr^rÙÚclose_debuggerÚ open_debugger)r3reÚdbr!r!r"rR±s   zPyShell.toggle_debuggercCs|jjƒ}|jd| ƒdS)Nz<>)r^rÙZsetvar)r3rdr!r!r"ra¿s zPyShell.set_debugger_indicatorcCsdS)Nr!)r3rer!r!r"rSÃszPyShell.toggle_jit_stack_viewercCsh|jjƒ}|r\|jjdƒ|jƒ|jjr8tj|jjƒ|jƒ|jj dƒ|j |_ |j ƒ|j ƒdS)Nz [DEBUG OFF] )r^rÙrrÚrÊrZclose_remote_debuggerrõr•rrLrMrâra)r3rdr!r!r"rbÆs   zPyShell.close_debuggercCsX|jjrtj|jj|ƒ}n tj|ƒ}|jj|ƒ|jƒd|j|_ |j ƒ|j ƒdS)Nz [DEBUG ON] ) r^rÊrZstart_remote_debuggerr ZDebuggerrrãrLrMrâra)r3Zdbg_guir!r!r"rcÓs    zPyShell.open_debuggercCs|jƒd|_dS)Nr)rõrÜ)r3r!r!r"r0ßszPyShell.beginexecutingcCsd|_d|_|jƒdS)Nr)rÜr2râ)r3r!r!r"rûäszPyShell.endexecutingcCsD|jr&tjddd|jd�}|dkr&dS|jƒd|_d|_tj|ƒS)NzKill?z7Your program is still running! Do you want to kill it?Úok)rÀrFZcancelT) rÜrvZ askokcancelr7rÝr2rôrrÚ)r3rþr!r!r"rÚês z PyShell.closecCsV|jƒtr|jjƒ|jt_|jt_|j t_ d|_d|_ d|j _ d|_tj|ƒdS)N)rbrr^rìrVr©r“rWr”rXr–r•r;r]r[rr…)r3r!r!r"r…ùs zPyShell._closecCsdS)NTr!)r3rr!r!r"Úispythonsource szPyShell.ispythonsourcecCs|jS)N)Ú shell_title)r3r!r!r"Ú short_title szPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs†|jjddƒ|jƒtr:d}|jjƒ}|sF|jƒdSn d}tjt _|j d t j t j |j |fƒ|jjƒ|jƒd dl}d|_d S)Nr‘rarRFz==== No Subprocess ==== z9WARNING: Running IDLE without a Subprocess is deprecated z;and will be removed in a later version. See Help/IDLE Help zfor details. zPython %s on %s %s %srTzR==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated z�==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated and will be removed in a later version. See Help/IDLE Help z›==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated and will be removed in a later version. See Help/IDLE Help for details. )r7ràrõrr^rÕrÚrÚ displayhookr©rÚversionÚplatformÚ COPYRIGHTZ focus_forcerâÚtkinterZ _default_root)r3ZnosubZclientrmr!r!r"rŽs$  z PyShell.begincCs|js dSd|_|jjƒdS)NT)ÚreadingÚ_stop_readline_flagr‹Úquit)r3r!r!r"rÝ+szPyShell.stop_readlinec Cs‚|j}zd|_|jjƒWd||_X|jr4d|_dS|jjddƒ}t|ƒdkrRd}|jƒ|jrnd|_t snt ‚|j r~d|_ d}|S)NrFrRr‘zend-1crrl) rnr‹Úmainloopror7Úgetr~rõr2rróÚ endoffile)r3r.rr!r!r"Úreadline1s( zPyShell.readlinecCsdS)NTr!)r3r!r!r"ÚisattyHszPyShell.isattyc Cs y|jjdddƒrdSWn YnX|jp0|jsR|jƒ|jjdƒ|jƒdSd|_d|_ |jrŒ|jj rŒ|jj ƒr‚|jj ƒn |jj ƒ|jrœ|jjƒdS)Nz sel.firstz!=zsel.lastzKeyboardInterrupt rQrr)r7r�rÜrnrõr^rrârsr2rÊrÙrärêr‹rp)r3rer!r!r"rPKs&      zPyShell.cancel_callbackcCsh|jr|j rdS|jjdddƒo0|jjdddƒs6dS|jsN|jƒ|jƒnd|_d|_|jj ƒdS)Nr‘z==razend-1crrrQ) rÜrnr7r�rõrÚr2rsr‹rp)r3rer!r!r"rQas  zPyShell.eof_callbackcCs0|jr"|jjddƒ|jjdƒn |j|ƒdS)NrarlrQ)rnr7raÚseeÚnewline_and_indent_event)r3rer!r!r"rOps  zPyShell.linefeed_callbackc Cs<|jr|j rdSy6|jjddƒ}|rF|jjdddƒrF|j||ƒdSWn YnX|jjdddƒ�rX|jjd dƒ}|r°|jjdd|d ƒr°|j|jj|d |d ƒ|ƒdS|jjd dƒ}|rø|jjd d |d ƒrø|j|jj|d |d ƒ|ƒdS|jjddƒ}|�r>|jj|d ddƒ�r>|j|jj|d d ƒ|ƒn|j|jjdd ƒ|ƒdS|jjdddƒ�rx|jjddƒ|jjddƒ}|�r¦|j ƒ �r¦|jj ddƒ|jjdddƒ�rÆ|j |ƒdS|jjddƒ|j�rø|jj ddƒ|jj dƒn |j |ƒ|jjd ddƒ|jjƒ|j�r0|jjƒn|jƒdS)Nz sel.firstzsel.lastz<=r‘rQrar›ziomark linestartr–rrzinsert lineendz>=r•zinsert linestartzend-1czend-1c linestartrl)rÜrnr7rrr�ÚrecallZ tag_prevrangeZ tag_nextrangeràÚstripr¡rwrarvrYZupdate_idletasksr‹rpÚrunit)r3reÚselÚprevÚnextÚindicesr»r!r!r"rNysX     zPyShell.enter_callbackc Cs<tjdd|ƒ}tjdd|ƒ}|jdƒ}|jjƒzî|jjdddƒ|jjdd ƒ|jjd dƒ}|jƒj d ƒr„|j |ƒ|jjd dƒ}|jj d|d j ƒƒt |ƒd k�rtjd|d ƒjd ƒ}tjd|ƒjd ƒ}xJ|d d…D]:}|j|ƒ�r||t |ƒd…}|jj dd|jƒƒqÞWWd|jjdƒ|jjƒXdS)Nz^\s*\nrRz\n\s*$rlr{z1.0r„razend-1czinsert linestartú:rrz ^([ \t]*))ÚreÚsubr!r7Zundo_block_startrgràrrÚrstripÚendswithrwraryr~ÚsearchÚgrouprqrvZundo_block_stop)r3r»reryÚprefixZorig_base_indentZnew_base_indentrr!r!r"rx¸s*     zPyShell.recallcCsž|jjddƒ}t|ƒ}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr€||ddkr€|d}q^W|d|…}|jj|ƒdS)Nr‘zend-1crrz rl)r7rrr~r^r)r3rrÔr!r!r"rzÒs   z PyShell.runitc CsX|jjr|jjƒSy tjWntjdd|jd�dSddlm }||j |j ƒdS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined))rr)Ú StackBrowser) r^rÊrùr©Úlast_tracebackrvrwr7Zidlelib.stackviewerr‡rur;)r3rer‡r!r!r"r+às    zPyShell.open_stack_viewercCs|jjdƒ|jjdƒdS)Nr‘r×)r7rv)r3rer!r!r"rTîs zPyShell.view_restart_markcCs|jjdd�dS)NT)rÇ)r^rä)r3rer!r!r"rUòszPyShell.restart_shellcCs:|jƒ|jj|jƒ|jjddƒ|jƒ|jjƒdS)Nrazend-1c) rõr•rrMr7ràÚset_line_and_columnrAZ reset_undo)r3r!r!r"râös zPyShell.showpromptcCsP|jjj}t|ddd�}dj|j|ƒƒ}|jdƒs:|d7}|jjj d|dƒdS)NrBT)rÞÚtabsizeÚ expand_tabsrlziomark linestartr”) r^r¨rÞr r?rErƒZperZbottomra)r3r#rÞÚwrapperZ wrapped_msgr!r!r"Ú show_warningýs   zPyShell.show_warningcCsX|jjddƒ}|jr |jj|ƒ|jjdƒdkr>|jjddƒ|jjddƒ|jƒdS)Nr‘zend-1czend-2crl)r7rrr[Ústoreraràr‰)r3rr!r!r"rõs zPyShell.resetoutputc Csªt|tƒrRt|ƒrRt|ƒdkrRxt|ƒD]\}}|dkr(Pq(Wtd|||ddƒ‚y0|jjddƒtj |||dƒ}|jjddƒWn‚YnX|j r¦d|_ t s¦t ‚|S) Nuï¿¿zUCS-2rz%Non-BMP character not supported in Tkr‘ÚrightrØr) Ú isinstancersr~ÚmaxÚ enumerateÚUnicodeEncodeErrorr7rárrr2rró)r3r»r rérDÚcountr!r!r"rs"z PyShell.writec s8y|jjdddƒrdSWntk r,dSXtƒjƒS)Nz sel.firstr›r‘Údisabled)r7r�ržÚsuperrF)r3)Ú __class__r!r"rF&s zPyShell.rmenu_check_cutcs|jjdddƒrdStƒjƒS)Nrar›r‘r•)r7r�r–rL)r3)r—r!r"rL.szPyShell.rmenu_check_paste)rr3)r4r5)r_r6)r7r8)r9r:)r;r<)r=r>)N)N)N)N)N)N)N)8r†r‡rˆr rgr�r ršrrHrr‰Zidlelib.historyr?r6r]rnrÜr2rsrôror_r`rRrarSrbrcr0rûrÚr…rfrhrlrŽrÝrtrurPrQrOrNrxrzr+rTrUrâr�rõrrFrLÚ __classcell__r!r!)r—r"r�Jsj  <      ?     r�cCs6|jdkr2x&dD]}|j|dd|j|dƒƒqWdS)NZx11ÚTextÚEntryÚSpinboxz <>z%catch {%W delete sel.first sel.last} )r™ršr›)Z_windowingsystemZ bind_class)ruÚclsr!r!r"Ú fix_x11_paste4s  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]. cs\ddl}ddlm}ddlm}ddlm}tdƒdad}d}d}d}d}d} y|jtj dd…dƒ\} } WnD|j k r²} z&t d | t ftj d �tjd ƒWYdd} ~ XnXxÜ| D]Ô\} }| d krÒ|}d}| d krâd}d}| dkrîd}| dk�r tjjt ƒtjƒ| dk�rd}| dk�r6t dtj d �da| dk�rj|}tjj|ƒ�rTnt d|ƒtjƒd}| dk�r|d} d}| dkrº|t_d}qºW| �r´| ddk�r´tjjƒ}d}x0tttjƒƒD]}tjjtj|ƒtj|<�qÄW| �r| ddk�rdg| dd…t_ n²|�r$d g| t_ nž|�r8|g| t_ nŠ| �r d}g}x | D]}|jtjj|ƒƒ�qLWxX|D],}tjj|ƒ}|tjk�rntjjd|ƒ�qnWn"tjƒ}|tjk�rÂtjjd|ƒtj ddddd�}|�pÜ|}|�pè| }t�rþ| �rþt!ƒt"dd�a#t#j$ƒdd l%m&}|t#ƒtjj'tjjt(ƒd!ƒ‰|ƒd"k�rbtjj'ˆd#ƒ}t#j)|d$�nBt*d%k�rpd&nd'‰‡‡fd(d)„d1Dƒ}d-d)„|Dƒ}t#j+d2|žŽt,t#ƒt-t#ƒt.t#ƒa/|j0t#t/ƒ|�r|�pÖ|�sx0| dd…D] }t/j1|ƒdk�rè| j2|ƒ�qèW| �st/j3ƒ|�rPt/j4ƒ}|�s2dS|j5ƒ�rVt/j6�rV|j7j8ƒnt/j9}|�rd|j:ƒ| �r¤tj;j|ƒ|�s°|�rø|j=j?d0tj fƒ|�rØ|j=j@|ƒn|�r0|j=jA|ƒ|j=j>|ƒn8|�r0|jBt#ƒ}|�r|jC|ƒ|jDƒ}|�r0|jC|ƒxt/jE�rFt#jFƒ�q2Wt#jGƒtdƒdS)3Nr)Úsystem)Útesting)ÚmacosxTFrz c:deihnr:st:z Error: %s %s)rr�z-cz-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 className)rZIconsZWindowszidle.ico)rÀg333333!@z.pngz.gifcs"g|]}tjjˆd|ˆfƒ‘qS)z idle_%d%s)r=r>r?)rºÚsize)ÚextÚicondirr!r"r¼Ùszmain..éé é0cSsg|]}tt|d�‘qS))Zmasterr)Z PhotoImageru)rºÚiconfiler!r!r"r¼ÛsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )r¥r¦r§)T)HÚgetoptrkržrrŸr r'rr©ÚargvrröÚ usage_msgr”Úexitr“rr=r>r|r�rgr–rr‚r~rr\ÚdirnameraÚgetcwdr rÃZ NoDefaultRootrIrurJÚ idlelib.runrr?Ú__file__Z wm_iconbitmapÚ TkVersionZ wm_iconphotorr�rŠr;ZsetupApprorfÚnewr<ZisAquaTkÚdictr‹Úlowerr]rcÚenvironrrr^rrðrr"ZtkVersionWarningr�ZpreferTabsPreferenceWarningZ inversedictrqZdestroy)r©ržrŸr Z enable_shellZ enable_editr_ÚcmdZscriptZstartupZoptsrCr#ÚoÚarÔZpathxrÚdirZ edit_startrr¨Z iconfilesZiconsr@ZtkversionwarningZprefer_tabs_preference_warningr!)r£r¤r"r½us                                   r½r¦r]F)NN)Or©rmÚ ImportErrorrörúr1rkZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrvr±rIrurJr¯rrwrrr)r=Zos.pathr r€rÍr¶Útextwrapr rçrÉrr%Zidlelib.colorizerr Zidlelib.configr rr rZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrÈr¯rr#r$r'Ú checkcacher0r1rŠr�ršZ RPCClientr¢r¥r�r�r«r½r†rªr!r!r!r"Úsœ                  >Hm?1