3 Ì·ßj€áã@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é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ÚPseudoInputFileÚPseudoOutputFile)Ú UndoDelegatorz 127.0.0.1cCsP|dkr t}y&|jt|||||d�ƒ|jdƒ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 ú4/opt/alt/python36/lib64/python3.6/idlelib/pyshell.pyÚidle_showwarningCsr"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_warningsVsr&TcCs\tj}i}x:t|ƒD].}|dd…|dd…dkr|j|ƒ||<qW||ƒ|j|ƒ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. Nrz<>éÿÿÿÿ)Ú linecacheÚcacheÚlistÚpopÚupdate)rZorig_checkcacher)ÚsaveÚkeyr r r!Úextended_linecache_checkcachees r/c@s~eZdZdZdd„Zd'd(d)d*d+d,gZd-dd„Zdd„Zd.dd„Zd/dd„Z dd„Z dd„Z dd „Z d!d"„Z d#d$„Zd%d&„Zd S)0ÚPyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGs”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_hookrr1Úcolor_breakpoint_text)r2Úargsr3r r r!r5s   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)z,Turn colorizing of breakpoint text on or offNÚbreakÚ)Ú foregroundÚ backgroundÚBREAK)r@r Ú CurrentThemeÚ GetHighlightr6Z tag_config)r2ZcolorÚthemeZcfgr r r!rA›s  z)PyShellEditorWindow.color_breakpoint_textcCsˆ|j}|jj}|jdd|d|dƒy|jj|ƒWn tk rX|jj|ƒYnXy|jj j j }|j ||ƒWn YnXdS)NrTz%d.0r) r6r@rÚtag_addr4ÚindexÚ ValueErrorÚappendr:ÚpyshellÚinterpr r8)r2rr6rÚdebugr r r!Úset_breakpoint§s z"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|jƒdStt|jdƒƒƒ}|j|ƒdS)NÚinsert)r6r@rÚbellÚintÚfloatrYr_)r2Úeventr6rrr r r!r8µ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)Nr`rTzinsert linestartzinsert lineend +1char)r6r@rrarbrcrYr4ÚremoveÚ tag_remover:r\r]r r9)r2rdr6rrr^r r r!r9¾s" z)PyShellEditorWindow.clear_breakpoint_herec Csd|jr`|j}|jj}|s$|jƒdSg|_|jddtƒy|jjj j }|j |ƒWn YnXdS)NrTz1.0) r4r6r@rrarfZENDr:r\r]r Úclear_file_breaks)r2r6rr^r r r!rgÑ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 _ tjd d t |ƒ|jd �WYdd}~XnXdS) z#Save breakpoints when file is savedÚrNÚwú=Ú Úbreakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)Útitlerr)r4r@rÚopenr?Ú readlinesrÚ startswithrÚupdate_breakpointsÚstrÚgetattrÚrootrlÚ tkMessageBoxÚ showerrorr6)r2ZbreaksrÚ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)Nrhrjr)r6r,r@rr<r=Úisfiler?rnrorpÚevalÚlenr_)r2rrwrxrZbreakpoint_linenumbersZbreakpoint_linenumberr r r!r1 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}|jdƒ}|j|ƒ}||_dS)z3Retrieves all the breakpoints in the current windowrTN)r6Z tag_rangesÚranges_to_linenumbersr4)r2r6ÚrangesZlinenumber_listr r r!rqs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|ƒdƒD]L}tt||jƒƒ}tt||djƒƒ}x||kr`|j|ƒ|d7}qDWqW|S)Nrér)Úranger}rbrcÚstringr[)r2rrxrYrÚendr r r!r~"s  z)PyShellEditorWindow.ranges_to_linenumberscCs|jƒtj|ƒdS)z7Extend base method - clear breaks when module is closedN)rgrÚ_close)r2r r r!r„3szPyShellEditorWindow._close)rCrDrE)rFrGrH)rIrJrK)NNN)rLrMN)rNrON)T)N)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r5Ú rmenu_specsrAr_r8r9rgrzr1rqr~r„r r r r!r0|s$  *r0c@s"eZdZdZeZdZddd„ZdS)ÚPyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jjjƒnt|ƒ|_|jr2|jjƒs2dS|jS)N)r\ÚtopÚwakeupÚPyShellÚbegin)r2rdr r r!r;Bs  zPyShellFileList.open_shell)N)r…r†r‡rˆr0rr\r;r r r r!rŠ9srŠc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCstj|ƒ|jƒdS)N)r r5Ú LoadTagDefs)r2r r r!r5Ps zModifiedColorDelegator.__init__cCs*|jdddƒ|jdddƒtj|ƒdS)NZTODOz1.0ÚiomarkZSYNC)rfrXr Úrecolorize_main)r2r r r!r’Tsz&ModifiedColorDelegator.recolorize_maincCsJtj|ƒtjƒ}|jjdddœtj|dƒtj|dƒtj|dƒdœƒdS)N)rSrRÚstdoutÚstderrÚconsole)Ústdinr“r”r•)r r�r rUÚtagdefsr,rV)r2rWr r r!r�Ys   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|ddƒqWdS)Nr‘rƒ)r—rf)r2Útagr r r!Ú removecolorscs z#ModifiedColorDelegator.removecolorsN)r…r†r‡rˆr5r’r�r™r r r r!r�Ms  r�c@s$eZdZdZddd„Zddd„ZdS) ÚModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNc 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__rr5Úsave_warnings_filtersÚ restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r2r¨r§r r r!r5‡s zModifiedInterpreter.__init__NcCs&|jdkr|jƒ|_tj|jƒ|_dS)N)r®Úbuild_subprocess_arglistÚ subprocessÚPopenÚ rpcsubproc)r2r 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…Ú executablerrr°)r2riZ 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)r2ZaddrÚir r r!Ústart_subprocess©s>       z$ModifiedInterpreter.start_subprocessFrQcCsT|jr |jSd|_|jƒ}|rYnXy|jjƒWntk rbYnX|jƒd|j_ d|_dS)NF) Ú_afteridr¨r6Z after_cancelrÊrÌrÚrrÛrÜ)r2r r r!Úkill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|jjƒWntk r"dSXy|jjƒWntk rFdSXdS)z"Make sure subprocess is terminatedN)r¸ÚkillrÚwait)r2r r r!rÛsz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtjƒntj}|jd|fƒdS)NrQzRif 1: import sys as _sys _sys.path = %r del _sys )Úextendr©r=Ú runcommand)r2rÇ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__Ú endexecutingrr6ÚafterÚ pollintervalrÓrë)r2ZcltÚresponseZhowZwhatr•Úerrmsgr r r!rÓ2s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r )r2r r r r!Ú setdebuggerZszModifiedInterpreter.setdebuggercCs|jS)N)r )r2r r r!rÙ]szModifiedInterpreter.getdebuggercCs|jjjd|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¨r6rürù)r2r 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ÚTreeNodeZnormalrS)ZbgZhighlightthicknessrZboth)ÚexpandZfill)r:)ÚidlelibrrÊÚ remotequeuer¨rtraZStubObjectTreeItemZ idlelib.treerrZToplevelr rUrVÚframeZpackZcanvasr) r2rZoidÚitemrrr‹rWrSZscZnoder r r!rùms   z'ModifiedInterpreter.remote_stack_viewerrcCs|j|ƒ}|j||ƒdS)z1Like runsource() but assumes complete exec sourceN)Ú stuffsourceÚexecfile)r2Úsourcerr r r!Ú execsource€s zModifiedInterpreter.execsourcecCs®|dkrFtj|ƒ�.}|jƒ}trd|j}|jd|_|jdƒ}t|ƒdd||ftj|<|S)z"Stuff source in the filename cachez rrkr)ÚgidÚsplitr}r(r))r2r rrxr r r!r ²s    zModifiedInterpreter.stuffsourcecCs|jd|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ð)r2rr 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)z§Override Interactive Interpreter method: Use Colorizing Color the offending position instead of printing it and pointing at it with a caret. rñz1.0rƒÚmsgrQzrrÚoffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s N) r¨r6rfr©Úexc_inforsZcolorize_syntax_errorrõrrâ) r2rr¨r6rÁÚvalueÚtbr rr!Úposr r r!rÆs" z#ModifiedInterpreter.showsyntaxerrorcCs6|jjƒ|jƒtj|ƒ|jjdƒr2|jjƒdS)z1Extend base class method to reset output properlyz<>N)r¨rõÚchecklinecacherÚ showtracebackrøÚopen_stack_viewer)r2r r r!r'às    z!ModifiedInterpreter.showtracebackcCsBtj}x6t|jƒƒD]&}|dd…|dd…dkr||=qWdS)Nrz<>r')r(r)r*Úkeys)r2Úcr.r r r!r&èsz"ModifiedInterpreter.checklinecachecCs@|jjr|jƒdS|jr0|jjdd|fiƒn t||jƒdS)z*Run the code without invoking the debuggerrrårr)r¨rÜÚdisplay_executing_dialogrÊrrår§)r2rr 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) zOverride base class methodNrå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ôruZaskyesnor6r'rrör”rûÚcanceledr)r2rr r r r!rúsP         zModifiedInterpreter.runcodecCs|jjj|ƒS)zOverride base class method)r¨r”r)r2r»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)rurvr¨r6)r2r 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)rurvr¨r6)r2r 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)rurvr¨r6)r2r r r!r+Bsz,ModifiedInterpreter.display_executing_dialog)FrQ)F)N)N)&r…r†r‡r5rërÊr¸r¹rµrÕrärèrêrìrÛrÒròrÓr rrÙrrùrr r rr rrr'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>>> rkrÚchar)Úwrapz<>z<>z<>z<>z<>z<>z<>z<>z<>)Úiomenur–r“r”r•é2)r=r>r')3rÚ menu_specsr`r¥r]ÚTkrÚwithdrawrŠrr5ZusetabsZ indentwidthÚhasattrr©r@Úsys_ps1rZprompt_last_lineÚpromptr6Z configurer7Úenter_callbackÚlinefeed_callbackÚcancel_callbackÚ eof_callbackr(Útoggle_debuggerÚtoggle_jit_stack_viewerÚview_restart_markÚ restart_shellr“Ú save_stdoutr”Ú save_stderrr–Ú save_stdinrrCrÚencodingrr•ÚpydocZ plainpagerZpagerrúr<Úhistoryrý)r2r:Zmsrtr6rCrWr r r!r5ds`     zPyShell.__init__cCs tjdd�S)NT)Z shell_only)r Z GetExtensions)r2r r r!Úget_standard_extension_names sz$PyShell.get_standard_extension_namesFcCs|adS)N)r)r2Ústreamr r r!Úset_warning_streamªszPyShell.set_warning_streamcCstS)N)r)r2r 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)rrP) rÜrurvr6Úset_debugger_indicatorr]rÙÚclose_debuggerÚ open_debugger)r2rdÚdbr r r!rO±s   zPyShell.toggle_debuggercCs|jjƒ}|jd| ƒdS)Nz<>)r]rÙZsetvar)r2r`r r r!r]¿s zPyShell.set_debugger_indicatorcCsdS)Nr )r2rdr r r!rPÃ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Êr Zclose_remote_debuggerrõr•rrIrJrâr])r2r`r r r!r^Æs   zPyShell.close_debuggercCsX|jjrtj|jj|ƒ}n tj|ƒ}|jj|ƒ|jƒd|j|_ |j ƒ|j ƒdS)Nz [DEBUG ON] ) r]rÊr Zstart_remote_debuggerr ZDebuggerrrãrIrJrâr])r2Zdbg_guir r r!r_Ós    zPyShell.open_debuggercCs|jƒd|_dS)zHelper for ModifiedInterpreterrN)rõrÜ)r2r r r!r-ßszPyShell.beginexecutingcCsd|_d|_|jƒdS)zHelper for ModifiedInterpreterrN)rÜr/râ)r2r r r!rûäszPyShell.endexecutingcCsD|jr&tjddd|jd�}|dkr&dS|jƒd|_d|_tj|ƒS)zExtend EditorWindow.close()zKill?z7Your program is still running! Do you want to kill it?Úok)rÀrFZcancelT) rÜruZ askokcancelr6rÝr/rôrrÚ)r2rþr r r!rÚês z PyShell.closecCsV|jƒtr|jjƒ|jt_|jt_|j t_ d|_d|_ d|j _ d|_tj|ƒdS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)r^rr]rìrSr©r“rTr”rUr–r•r:r\rXrr„)r2r r r!r„ùs zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr )r2rr r r!Úispythonsource szPyShell.ispythonsourcecCs|jS)N)Ú shell_title)r2r 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‘r`rQFz==== 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. )r6ràrõrr]rÕrÚrÚ displayhookr©rÚversionÚplatformÚ COPYRIGHTZ focus_forcerâÚtkinterZ _default_root)r2ZnosubZclientrir r r!rŽs$  z PyShell.begincCs|js dSd|_|jjƒdS)NT)ÚreadingÚ_stop_readline_flagr‹Úquit)r2r 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)NrFrQr‘zend-1crrk) rjr‹Úmainlooprkr6Úgetr}rõr/rróÚ endoffile)r2r-rr r r!Úreadline1s( zPyShell.readlinecCsdS)NTr )r2r 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 rPrr)r6r�rÜrjrõr]rrâror/rÊrÙrärêr‹rl)r2rdr r r!rMKs&      zPyShell.cancel_callbackcCsh|jr|j rdS|jjdddƒo0|jjdddƒs6dS|jsN|jƒ|jƒnd|_d|_|jj ƒdS)Nr‘z==r`zend-1crrrP) rÜrjr6r�rõrÚr/ror‹rl)r2rdr r r!rNas  zPyShell.eof_callbackcCs0|jr"|jjddƒ|jjdƒn |j|ƒdS)Nr`rkrP)rjr6r`ÚseeÚnewline_and_indent_event)r2rdr r r!rLps  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‘rPr`r›ziomark linestartr–rrzinsert lineendz>=r•zinsert linestartzend-1czend-1c linestartrk)rÜrjr6rnr�ÚrecallZ tag_prevrangeZ tag_nextrangeràÚstripr¡rsr`rrrXZupdate_idletasksr‹rlÚrunit)r2rdÚselÚprevÚnextÚindicesr»r r r!rKysX     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*\nrQz\n\s*$rkrwz1.0rƒr`zend-1czinsert linestartú:rrz ^([ \t]*))ÚreÚsubrr6Zundo_block_startrfràrnÚrstripÚendswithrsr`rur}ÚsearchÚgrouprprrZundo_block_stop)r2r»rdrxÚprefixZorig_base_indentZnew_base_indentrr r r!rt¸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 rk)r6rnr}r]r)r2rrÔr r r!rvÒ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_tracebackrurvr6Zidlelib.stackviewerrƒrtr:)r2rdrƒr r r!r(às    zPyShell.open_stack_viewercCs|jjdƒ|jjdƒdS)Nr‘r×)r6rr)r2rdr r r!rQîs zPyShell.view_restart_markcCs|jjdd�dS)z&Callback for Run/Restart Shell Cntl-F6T)rÇN)r]rä)r2rdr r r!rRòszPyShell.restart_shellcCs:|jƒ|jj|jƒ|jjddƒ|jƒ|jjƒdS)Nr`zend-1c) rõr•rrJr6ràÚset_line_and_columnr@Z reset_undo)r2r r r!râös zPyShell.showpromptcCsP|jjj}t|ddd�}dj|j|ƒƒ}|jdƒs:|d7}|jjj d|dƒdS)Nr?T)rÞÚtabsizeZ expand_tabsrkziomark linestartr”) r]r¨rÞr r>rBrZperZbottomr`)r2r rÞÚwrapperZ wrapped_msgr r r!Ú show_warningýs   zPyShell.show_warningcCsX|jjddƒ}|jr |jj|ƒ|jjdƒdkr>|jjddƒ|jjddƒ|jƒdS)Nr‘zend-1czend-2crk)r6rnrXZstorer`ràr…)r2r r 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) Ú isinstancerrr}ÚmaxÚ enumerateÚUnicodeEncodeErrorr6rárrr/rró)r2r»r rérAÚcountr r r!rs"z PyShell.writec s8y|jjdddƒrdSWntk r,dSXtƒjƒS)Nz sel.firstr›r‘Údisabled)r6r�ržÚsuperrE)r2)Ú __class__r r!rE&s zPyShell.rmenu_check_cutcs|jjdddƒrdStƒjƒS)Nr`r›r‘r�)r6r�r�rK)r2)r‘r r!rK.szPyShell.rmenu_check_paste)rr0)r1r2)r^r3)r4r5)r6r7)r8r9)r:r;)N)N)N)N)N)N)N)8r…r†r‡rrcr�r ršrrErr‰Zidlelib.historyr<r5rYrjrÜr/rorôrkr[r\rOr]rPr^r_r-rûrÚr„rbrdrhrŽrÝrprqrMrNrLrKrtrvr(rQrRrârˆrõrrErKÚ __classcell__r r )r‘r!r�Jsj  <      ?     r�cCs6|jdkr2x&dD]}|j|dd|j|dƒƒqWdS) z6Make paste replace selection on x11. See issue #5124.Zx11ÚTextÚEntryÚSpinboxz <>z%catch {%W delete sel.first sel.last} N)r“r”r•)Z_windowingsystemZ bind_class)rtÚ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ú-rQr½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 PhotoImagert)rºÚiconfiler r r!r¼ÛsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )rŸr r¡)T)HÚgetoptrgr˜rr™ršr&rr©ÚargvrröÚ usage_msgr”Úexitr“rr<r=r{r�rcr–rr�r}rr[Údirnamer`Úgetcwdr rÃZ NoDefaultRootrFrtrGÚ idlelib.runrr>Ú__file__Z wm_iconbitmapÚ TkVersionZ wm_iconphotorr—rŠr:ZsetupApprnreÚnewr;ZisAquaTkÚdictr‹Úlowerr\r_Úenvironrnr]r rðr rZtkVersionWarningrˆZpreferTabsPreferenceWarningZ inversedictrmZdestroy)r£r˜r™ršZ enable_shellZ enable_editr^ÚcmdZscriptZstartupZoptsrBr ÚoÚarÔZpathxrÚdirZ edit_startrr¢Z iconfilesZiconsr=ZtkversionwarningZprefer_tabs_preference_warningr )r�ržr!r½us                                   r½r¦r\F)NN)Or©riÚ ImportErrorrörúr.rgZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrur«rFrtrGr©rrvrrr(r<Zos.pathrr|rÍr¶Útextwrapr rçrÉrr$Zidlelib.colorizerr Zidlelib.configr rr r Zidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrÈr¯rr"r#r&Ú checkcacher/r0rŠr�ršZ RPCClientr¢r¥r�r—r¥r½r…rªr r r r!Úsœ                  >Hm?1