a XC?háã @súddlZedkr ejdejd<z ddlTWn(eyTedejdedƒ‚Yn0ejdkršz ddl Z dZ e   d ¡  e ¡Wnee efy˜Yn0dd lmZed krìeƒat ¡dd lmZetƒejd detdedƒ‚ddlmZddlZddlZddlZddlmZddlZddlZddlZddl 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;zdZ_>> )Úwarning_streamÚwriterÚAttributeErrorÚOSError)ÚmessageÚcategoryÚfilenameÚlinenorr©r'ú4/opt/alt/python39/lib64/python3.9/idlelib/pyshell.pyÚidle_showwarningLs ÿr)cCs0|rtdur,tjatt_ntdur,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)Ú_warnings_showwarningÚwarningsÚ showwarningr))Zcapturer'r'r(Úcapture_warnings_sr-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_checkcacher1ÚsaveÚkeyr'r'r(Úextended_linecache_checkcachens  r7c@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(r@ˆsÿÿ  zPyShellEditorWindow.__init__))ZCutz<>Úrmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>Úrmenu_check_paste)NNN)zSet Breakpointr9N)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)rKrÚ CurrentThemeÚ GetHighlightrAZ tag_config)r=ZcolorÚthemeZcfgr'r'r(rL¥s  z)PyShellEditorWindow.color_breakpoint_textcCs†|j}|jj}| dd|d|d¡z|j |¡WntyV|j |¡Yn0z|jj j j }|  ||¡Wn Yn0dS)NrTz%d.0r) rArKr%Útag_addr?ÚindexÚ ValueErrorÚappendrEÚpyshellÚinterprrC)r=r&rAr%Údebugr'r'r(Úset_breakpoint±s  z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s| ¡dStt| d¡ƒƒ}| |¡dS)NÚinsert)rArKr%ÚbellÚintÚfloatrYr_)r=ÚeventrAr%r&r'r'r(rC¿sz'PyShellEditorWindow.set_breakpoint_herecCsŠ|j}|jj}|s| ¡dStt| d¡ƒƒ}z|j |¡Wn Yn0|  ddd¡z|j j j j }| ||¡Wn Yn0dS)Nr`rTúinsert linestartzinsert lineend +1char)rArKr%rarbrcrYr?ÚremoveÚ tag_removerEr\r]rrD)r=rdrAr%r&r^r'r'r(rDÈs$ÿ z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$| ¡dSg|_| ddt¡z|jjj j }|  |¡Wn Yn0dS)NrTú1.0) r?rArKr%rargZENDrEr\r]rÚclear_file_breaks)r=rAr%r^r'r'r(riÛ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?rKr%ÚopenrJÚ readlinesr"Ú startswithr Úupdate_breakpointsÚstrÚgetattrÚrootrnrÚ showerrorrA)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)Nrjrlr)rAr4rKr%rGrHÚisfilerJrprqrrÚevalÚlenr_)r=r%rxryrZbreakpoint_linenumbersZbreakpoint_linenumberr'r'r(r<s  &z'PyShellEditorWindow.restore_file_breakscCs$|j}| d¡}| |¡}||_dS)z3Retrieves all the breakpoints in the current windowrTN)rAZ tag_rangesÚranges_to_linenumbersr?)r=rAÚrangesZlinenumber_listr'r'r(rs%s  z&PyShellEditorWindow.update_breakpointscCsbg}tdt|ƒdƒD]H}tt||jƒƒ}tt||djƒƒ}||kr| |¡|d7}q@q|S)Nrér)Úranger~rbrcÚstringr[)r=r€ryrYr&Úendr'r'r(r,s  z)PyShellEditorWindow.ranges_to_linenumberscCs| ¡t |¡dS)z7Extend base method - clear breaks when module is closedN)rirÚ_close©r=r'r'r(r…=szPyShellEditorWindow._close)T)N)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r@Ú rmenu_specsrLr_rCrDrir{r<rsrr…r'r'r'r(r8…s  *r8c@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=rdr'r'r(rFLs  zPyShellFileList.open_shell)N)r‡rˆr‰rŠr8rr\rFr'r'r'r(rŒCsrŒc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst |¡| ¡dSr;)rr@Ú LoadTagDefsr†r'r'r(r@Zs zModifiedColorDelegator.__init__cCs*| ddd¡| ddd¡t |¡dS)NZTODOrhÚiomarkZSYNC)rgrXrÚrecolorize_mainr†r'r'r(r•^sz&ModifiedColorDelegator.recolorize_mainc CsJt |¡t ¡}|j dddœt |d¡t |d¡t |d¡dœ¡dS)N)rSrRÚstdoutÚstderrÚconsole)Ústdinr–r—r˜)rr“rrUÚtagdefsr4rV)r=rWr'r'r(r“cs    üz"ModifiedColorDelegator.LoadTagDefscCs|jD]}| |dd¡qdS)Nr”r„)ršrg)r=Útagr'r'r(Ú removecolorsms z#ModifiedColorDelegator.removecolorsN)r‡rˆr‰rŠr@r•r“rœr'r'r'r(r’Ws  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ú„Z%dS)CÚModifiedInterpretercCsB||_tjdj}tj||dd|_d|_t|_ |j j j |_ dS)Nr)ÚlocalsF)Ú tkconsoleÚsysÚmodulesÚ__dict__r r@Ú restartingÚsubprocess_arglistÚPORTÚportÚcompileÚcompilerÚflagsÚoriginal_compiler_flags)r=r°r¯r'r'r(r@žs zModifiedInterpreter.__init__NcCs&|jdur| ¡|_t |j¡|_dSr;)rµÚbuild_subprocess_arglistÚ subprocessÚPopenÚ rpcsubprocr†r'r'r(Úspawn_subprocess«s  z$ModifiedInterpreter.spawn_subprocesscCs\|jdksJdƒ‚dd„tjDƒ}tjddddd d }d |f}tjg|d |t|jƒgS) Nrz/Socket should have been assigned a port number.cSsg|] }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·r±Ú warnoptionsrÚ GetOptionÚ executablert)r=rkZ del_exitfZcommandr'r'r(r¼°s ÿ ÿ z,ModifiedInterpreter.build_subprocess_arglistc CsXt|jf}tdƒD]6}t |¡zt|ƒ|_WqVWqtyFYq0q| ¡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—rEr0r]T©Úwith_cwd)ÚHOSTr·r‚ÚtimeÚsleepr¦Ú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—rEr0Ú transfer_pathÚpoll_subprocess)r=ZaddrÚir'r'r(Ústart_subprocess¼s@       ÿ z$ModifiedInterpreter.start_subprocessFrQcCs0|jr |jSd|_| ¡}|r>ÚERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rÕZ pollresponseÚ active_seqr§r"ÚKeyboardInterruptr°ÚclosingríÚ resetoutputr˜ÚprintÚreprÚgetvarÚremote_stack_viewerr±Ú __stderr__Ú endexecutingr!rAÚafterÚ pollintervalrÞrô)r=ZcltÚresponseZhowZwhatr˜Úerrmsgr'r'r(rÞDsB     ÿz#ModifiedInterpreter.poll_subprocesscCs ||_dSr;r)r=rr'r'r(Ú setdebuggerlszModifiedInterpreter.setdebuggercCs|jSr;rr†r'r'r(räoszModifiedInterpreter.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°rArrr†r'r'r(Úopen_remote_stack_viewerrs 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)rE)ÚScrolledCanvasÚTreeNodeÚnormalrS)ZbgZhighlightthicknessrZboth)ÚexpandZfill)Úidlelibr rÕÚ remotequeuer°rvraZStubObjectTreeItemZ idlelib.treer rZToplevelrrUrVÚframeZpackZcanvasr) r=r ZoidÚitemr rrrWrSZscZnoder'r'r(rs   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}| ¡}trd|j}|jd|_| d¡}t|ƒdd||ftj|<|S)z"Stuff source in the filename cachez rrmr)ÚgidÚsplitr~r0r1)r=rr%ryr'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. rûrhr„ÚmsgrQzr&rÚoffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s N) r°rArgr±Úexc_inforuZcolorize_syntax_errorrÿr rë) r=r%r°rArÉÚvalueÚtbr)r&r*Úposr'r'r(r Ès$ÿ z#ModifiedInterpreter.showsyntaxerrorcCs6|j ¡| ¡t |¡|j d¡r2|j ¡dS)z1Extend base class method to reset output properlyrúN)r°rÿÚchecklinecacher Ú showtracebackrÚopen_stack_viewerr†r'r'r(r0âs    z!ModifiedInterpreter.showtracebackcCs>tj}t| ¡ƒD]&}|dd…|dd…dkr||=qdS)Nrr.r/)r0r1r2Úkeys)r=Úcr6r'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}z"zT|j ¡|sT|jdurT|j dd|fi¡|_n |rh|  ||j ¡n t ||j ƒWnžt y¶|jj s°tjddd|jjdr¦‚q²| ¡n‚Yn`trätd|jjd | ¡|j ¡n,|jjrd |j_td |jjd n| ¡Yn0Wtspz|j ¡Wnty@Yn0n,tsnz|j ¡WntylYn00dS) ú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ÚbeginexecutingrÕZ asyncqueuerüÚrunr¯rîÚ SystemExitrþrZaskyesnorAr0rrr—rÚcanceledr!)r=r"rr'r'r(r!üsZ  ÿ ü ÿ  üzModifiedInterpreter.runcodecCs|jj |¡S)r5)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 ©rrwr°rAr†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 r;r†r'r'r(rÛ9s ûz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.r r;r†r'r'r(r4As üz,ModifiedInterpreter.display_executing_dialog)FrQ)F)N)N)&r‡rˆr‰r@rôrÕr¿rÀr¼ràrírñrórõrærÝrürÞrr rär rr%rrr$rr(r r0r/rùr!r rÖrÛr4r'r'r'r(r®œsF  + , &     . r®cs’eZdZdeƒZeZeZgd¢Z e j dgZ dZ ddl mZdPdd „Zd d „ZdZdZdZdZdZdZd d „Zdd„ZdQdd„Zdd„ZdRdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z d d!„Z!d"d#„Z"d$d%„Z#d&d'„Z$d(Z%d)d*„Z&d+d,„Z'd-d.„Z(d/d0„Z)dSd1d2„Z*d3d4„Z+d5d6„Z,d7d8„Z-d9d:„Z.d;d<„Z/dTd=d>„Z0dUd?d@„Z1dVdAdB„Z2dCdD„Z3dEdF„Z4dGdH„Z5dWdJdK„Z6‡fdLdM„Z7‡fdNdO„Z8‡Z9S)Xrz IDLE Shell ))rZ_File)ZeditZ_Edit)r^Z_Debug)ZoptionsZ_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)NrrÚshell)r?ZShe_llTéÚps1rrmr.Úchar)Úwrapz<>z<>z<>z<>z<>ú<>rúz<>z<>r=)Úiomenur™r–r—Úbackslashreplacer˜é2)6rÚ menu_specsr`r®r]ÚTkrÚwithdrawrŒrr@ZusetabsZ indentwidthÚhasattrr±rAÚsys_ps1r&Zprompt_last_lineÚpromptrAZ configurerBÚenter_callbackÚlinefeed_callbackÚcancel_callbackÚ eof_callbackr1Útoggle_debuggerÚtoggle_jit_stack_viewerÚview_restart_markÚ restart_shellZSqueezerZsqueeze_current_text_eventr–Ú save_stdoutr—Ú save_stderrr™Ú save_stdinrrErÚencodingÚerrorsrr˜ÚpydocZ plainpagerZpagerrr>Úhistoryr)r=rEZmsrvrAZsqueezerrEr[r'r'r(r@esx    ÿ ÿÿÿÿ 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;r^r†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 rP) rçrrwrAÚset_debugger_indicatorr]räÚclose_debuggerÚ open_debugger)r=rdÚdbr'r'r(rR¹sþ  zPyShell.toggle_debuggercCs|j ¡}| d| ¡dS)NrD)r]räZsetvar©r=rer'r'r(rbÇs zPyShell.set_debugger_indicatorcCsdSr;r'r‘r'r'r(rSËszPyShell.toggle_jit_stack_viewercCsh|j ¡}|r\|j d¡| ¡|jjr8t |jj¡| ¡|j  d¡|j |_ |  ¡|  ¡dS)Nz [DEBUG OFF] )r]rär rårÕrZclose_remote_debuggerrÿr˜r rLrMrërbrfr'r'r(rcÎs   zPyShell.close_debuggercCsX|jjrt |jj|¡}n t |¡}|j |¡| ¡d|j|_ |  ¡|  ¡dS)Nz [DEBUG ON] ) r]rÕrZstart_remote_debuggerrZDebuggerr rìrLrMrërb)r=Zdbg_guir'r'r(rdÛs ÿ   zPyShell.open_debuggercCs |jr dnd}| dd|¡dS)NÚdisabledrr^z *tack*iewer)rçZupdate_menu_state)r=Ústater'r'r(Údebug_menu_postcommandçszPyShell.debug_menu_postcommandcCs| ¡d|_dS)úHelper for ModifiedInterpreterTN)rÿrçr†r'r'r(r7ëszPyShell.beginexecutingcCsd|_d|_| ¡dS)rjFN)rçr:rë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?Úokr6FZcancelT) rçrZ askokcancelrArèr:rþrrå)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)rcrr]rõrVr±r–rWr—rXr™r˜rEr\r\rr…r†r'r'r(r…s zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr'r'r'r'r(ÚispythonsourceszPyShell.ispythonsourcecCs|jSr;)Ú shell_titler†r'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|_d|_dS) Nr”r`rQFz›==== 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)rArérÿrr]ràrårÚ displayhookr±r ÚversionÚplatformÚ COPYRIGHTZ focus_forcerëÚtkinterZ_support_default_rootZ _default_root)r=ZnosubZclientrsr'r'r(rs& ÿ z PyShell.begincCs|js dSd|_|j ¡dS©NT)ÚreadingÚ_stop_readline_flagrÚquitr†r'r'r(rè9szPyShell.stop_readlinecCsˆ|j}zd|_|j ¡W||_n||_0|jr:d|_dS|j dd¡}t|ƒdkrXd}| ¡|jrtd|_t stt ‚|j r„d|_ d}|S)NTFrQr”rárrm) rurÚmainlooprvrAÚgetr~rÿr:rrýÚ endoffile)r=r5rr'r'r(Úreadline?s(  zPyShell.readlinecCsdSrtr'r†r'r'r(ÚisattyVszPyShell.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 rPFT)rAr¡rçrurÿr]r rërzr:rÕrärírórrwr‘r'r'r(rPYs&       zPyShell.cancel_callbackcCsf|jr|jsdS|j ddd¡r0|j ddd¡s4dS|jsL| ¡| ¡nd|_d|_|j  ¡dS)Nr”z==r`ráFTrP) rçrurAr¡rÿrår:rzrrwr‘r'r'r(rQos ÿ  zPyShell.eof_callbackcCs0|jr"|j dd¡|j d¡n | |¡dS)Nr`rmrP)rurAr`ÚseeÚnewline_and_indent_eventr‘r'r'r(rO~s  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”rPr`rŸúiomark linestartr™rrzinsert lineendz>=r˜rerázend-1c linestartrm)rçrurAryr¡ÚrecallZ tag_prevrangeZ tag_nextrangeréÚstripr¥r€r`rrXZupdate_idletasksrrwÚrunit)r=rdÚselÚprevÚnextÚindicesrÂr'r'r(rN‡sZ   ÿ    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*\nrQz\n\s*$rmr…rhr„r`ráreú:rrz ^([ \t]*))ÚreÚsubr&rAZundo_block_startrgréryÚrstripÚendswithr€r`rƒr~ÚsearchÚgrouprrrZundo_block_stop)r=rÂrdryÚ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 rm)rAryr~r]r$)r=rrßr'r'r(r„às   z PyShell.runitcCs\|jjr|j ¡Sz tjWn tjdd|jdYdS0ddlm }||j |j ƒdS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined)r r)Ú StackBrowser) r]rÕrr±Úlast_tracebackrrwrAZidlelib.stackviewerr‘rvrE)r=rdr‘r'r'r(r1îs  ý zPyShell.open_stack_viewercCs|j d¡|j d¡dS)Nr”râ)rArr‘r'r'r(rTüs zPyShell.view_restart_markcCs|jjdddS)z&Callback for Run/Restart Shell Cntl-F6TrÐN)r]rír‘r'r'r(rUszPyShell.restart_shellcCs:| ¡|j |j¡|j dd¡| ¡|j ¡dS)Nr`rá) rÿr˜r rMrAréÚset_line_and_columnrKZ reset_undor†r'r'r(rës zPyShell.showpromptcCsP|jjj}t|ddd}d | |¡¡}| d¡s:|d7}|jj  d|d¡dS)Nr@T)r«ÚtabsizeZ expand_tabsrmrr—) r]r°r«rrIrCrZperZbottomr`)r=r)r«Ú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-2crm) rAryr\Zstorer`rér“ZctipZremove_calltip_window)r=rr'r'r(rÿs zPyShell.resetoutputr'cCsXz0|j dd¡t |||d¡}|j dd¡Wn‚Yn0|jrTd|_tsTt‚|S)Nr”ÚrightrãF)rArêrr r:rrý)r=rÂr¤Úcountr'r'r(r sz PyShell.writecs:z|j ddd¡rWdSWnty.YdS0tƒ ¡S)Nr}rŸr”rg)rAr¡r¢ÚsuperrNr†©Ú __class__r'r(rN+s   zPyShell.rmenu_check_cutcs|j ddd¡rdStƒ ¡S)Nr`rŸr”rg)rAr¡r™rOr†ršr'r(rO3szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r'):r‡rˆr‰r rmr’rrrrHrr‹Zallow_line_numbersZidlelib.historyr>r@r]rurçr:rzrþrvr`rarRrbrSrcrdrir7rrår…rlrnrrrrèr{r|rPrQrOrNr‚r„r1rTrUrër–rÿr rNrOÚ __classcell__r'r'ršr(rIsh  ÿ  C    ÿ  ?     rc Cs2|jdkr.dD]}| |dd| |d¡¡qdS)z6Make paste replace selection on x11. See issue #5124.Zx11)ÚTextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} N)Z_windowingsystemZ bind_class)rvÚclsr'r'r(Ú fix_x11_paste9s  ÿý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= @|¡n|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 %srrrÊz-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 classNamerZIconsZWindowszidle.ico)rÈg333333!@z.png)éé é0éz.gif)r¤r¥r¦cs"g|]}tj ˆd|ˆf¡‘qS)z idle_%d%s)rGrHrI)rÁÚsize©ZextZicondirr'r(rÃãsÿzmain..cSsg|]}tt|d‘qS))Zmasterr)Z PhotoImagerv)rÁÚiconfiler'r'r(rÃåsÿZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )HÚgetoptrqr rr¡r¢r-rr±ÚargvÚerrorrÚ usage_msgr—Úexitr–r rGrHr|rrmr™rr‚r~rr[Údirnamer`ÚgetcwdrrÌZ NoDefaultRootrIrvrJÚ idlelib.runr rIÚ__file__Z wm_iconbitmapZisAquaTkÚ TkVersionZ wm_iconphotorrŸrŒrEZsetupApprprfÚnewrFÚdictrÚlowerr\rdÚenvironryr]rrùrr(ZtkVersionWarningr–ZpreferTabsPreferenceWarningZ inversedictrxZdestroy)r«r r¡r¢Z enable_shellZ enable_editr^ÚcmdZscriptZstartupZoptsrMr)ÚoÚarßZpathxr%ÚdirZ edit_startr rªZsizesZ iconfilesZiconsr?ZtkversionwarningZprefer_tabs_preference_warningr'r©r(rÅzs$         ÿ       ÿ         ÿÿ    ÿ  ü     rÅF)NN)Rr±r‡r²rsÚ ImportErrorrrr9rqZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr!r"rr´rIrvrJr²r rwr"r r0rGZos.pathr rŠrØr½ÚtextwraprrðrÓrr+Zidlelib.colorizerrZidlelib.configrrrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrÒr¶Úeofr¯rwÚ NameErrorrr)r*r-Ú checkcacher7r8rŒr’rZ RPCClientr¦r­r®rrŸr®rÅr'r'r'r(Ús´  ÿ   þ            ÿ  ÿ ?0s 66