3 2au@sddlZy ddlTWn*ek r>edejdedYnXejdkry ddlZdZej dj eWnee e fk rYnXddl jZedkreatjdd lmZetejd d etd eddd 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;ejaddZ?e?ddej@fd d!ZAeAe_@Gd"d#d#e.ZBGd$d%d%e1ZCGd&d'd'e'ZDGd(d)d)e9ZEGd*d+d+e4jFZGGd,d-d-eZHGd.d/d/e3ZId0d1ZJd2ZKd3d4ZLeMd5krejNd5ejNd6<eLe?d7dS)9N)*zJ** IDLE can't import Tkinter. Your Python may not be configured for Tk. **)filewin32Zshcoreg!@) 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_formatwarningPseudoInputFilePseudoOutputFile) UndoDelegatorz 127.0.0.1cCsP|dkr t}y&|jt|||||d|jdWnttfk rJYnXdS)N)linez>>> )warning_streamwriterAttributeErrorOSError)messagecategoryfilenamelinenorrr!,/opt/alt/python36/lib64/python3.6/pyshell.pyidle_showwarningCsr#cCs0|rtdkr,tjatt_ntdk r,tt_dadS)N)_warnings_showwarningwarnings showwarningr#)Zcapturer!r!r"capture_warningsVsr'TcCs\tj}i}x:t|D].}|dd|dddkr|j|||<qW|||j|dS)Nrz<>) linecachecachelistpopupdate)rZorig_checkcacher*savekeyr!r!r"extended_linecache_checkcachees r0c@szeZdZddZd&d'd(d)d*d+gZd,ddZddZd-ddZd.ddZddZ ddZ ddZ d d!Z d"d#Z d$d%Zd S)/PyShellEditorWindowcGsg|_tj|f||jjd|j|jjd|j|jjd|jjt j j t j d|_|jj|fdd}|jj||jjr|j|jdS)Nz<>z<>z<>zbreakpoints.lstcSs|j|dS)N)restore_file_breaks)Zold_hookselfr!r!r"filename_changed_hooksz;PyShellEditorWindow.__init__..filename_changed_hook) breakpointsr__init__textbindset_breakpoint_hereclear_breakpoint_hereflist open_shellospathjoinr ZuserdirbreakpointPathioZfilename_change_hookZset_filename_change_hookrr2color_breakpoint_text)r3argsr4r!r!r"r6s   zPyShellEditorWindow.__init__Cut<>rmenu_check_cutCopy<>rmenu_check_copyPaste <>rmenu_check_pasteNSet Breakpoint<>Clear Breakpoint<>TcCsD|jdkrdS|r(tj}tj|d}n ddd}|jjd|dS)Nbreak) foreground backgroundBREAK)rAr CurrentTheme GetHighlightr7Z tag_config)r3ZcolorthemeZcfgr!r!r"rBs  z)PyShellEditorWindow.color_breakpoint_textcCs|j}|jj}|jdd|d|dy|jj|Wn tk rX|jj|YnXy|jj j j }|j ||Wn YnXdS)NrUz%d.0r) r7rArtag_addr5index ValueErrorappendr;pyshellinterpr r9)r3r r7rdebugr!r!r"set_breakpoints z"PyShellEditorWindow.set_breakpointcCs>|j}|jj}|s|jdStt|jd}|j|dS)Ninsert)r7rArbellintfloatrZr`)r3eventr7rr r!r!r"r9sz'PyShellEditorWindow.set_breakpoint_herecCs|j}|jj}|s|jdStt|jd}y|jj|Wn YnX|j dddy|j j j j }|j||Wn YnXdS)NrarUzinsert linestartzinsert lineend +1char)r7rArrbrcrdrZr5remove tag_remover;r]r^r r:)r3rer7rr r_r!r!r"r:s" z)PyShellEditorWindow.clear_breakpoint_herec Csd|jr`|j}|jj}|s$|jdSg|_|jddty|jjj j }|j |Wn YnXdS)NrUz1.0) r5r7rArrbrgZENDr;r]r^r clear_file_breaks)r3r7rr_r!r!r"rhs z%PyShellEditorWindow.clear_file_breakscCs|j}|jj}y$t|jd}|j}WdQRXWntk rJg}YnXynt|jdX}x$|D]}|j|dsb|j|qbW|j |j}|r|j|dt |dWdQRXWnVtk r}z8t |j ddsd|j _ tjdd t ||jd WYdd}~XnXdS) Nrw= breakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)titlerr)r5rAropenr@ readlinesr startswithrupdate_breakpointsstrgetattrrootrm tkMessageBox showerrorr7)r3ZbreaksrfplinesZnew_filererrr!r!r"store_file_breakss.  (z%PyShellEditorWindow.store_file_breaksc Cs|jj|jdkrdS|jj}|dkr,dStjj|jrt|jd}|j }WdQRXxJ|D]B}|j |dr`t |t |dd}x|D]}|j |qWq`WdS)Nrirkr)r7r-rArr=r>isfiler@rorprqevallenr`)r3rrxryrZbreakpoint_linenumbersZbreakpoint_linenumberr!r!r"r2 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}|jd}|j|}||_dS)NrU)r7Z tag_rangesranges_to_linenumbersr5)r3r7rangesZlinenumber_listr!r!r"rrs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|dD]L}tt||j}tt||dj}x||kr`|j||d7}qDWqW|S)Nrr)ranger~rcrdstringr\)r3rryrZr endr!r!r"r"s  z)PyShellEditorWindow.ranges_to_linenumberscCs|jtj|dS)N)rhr_close)r3r!r!r"r3szPyShellEditorWindow._close)rDrErF)rGrHrI)rJrKrL)NNN)rMrNN)rOrPN)T)N)N)__name__ __module__ __qualname__r6 rmenu_specsrBr`r9r:rhr{r2rrrrr!r!r!r"r1|s"  *r1c@seZdZeZdZdddZdS)PyShellFileListNcCs8|jr|jjjnt||_|jr2|jjs2dS|jS)N)r]topwakeupPyShellbegin)r3rer!r!r"r<Bs  zPyShellFileList.open_shell)N)rrrr1rr]r<r!r!r!r"r9src@s,eZdZddZddZddZddZd S) ModifiedColorDelegatorcCstj||jdS)N)r r6 LoadTagDefs)r3r!r!r"r6Ps zModifiedColorDelegator.__init__cCs*|jddd|jdddtj|dS)NZTODOz1.0iomarkZSYNC)rgrYr recolorize_main)r3r!r!r"rTsz&ModifiedColorDelegator.recolorize_maincCsJtj|tj}|jjdddtj|dtj|dtj|dddS)N)rTrSstdoutstderrconsole)stdinrrr)r rr rVtagdefsr-rW)r3rXr!r!r"rYs   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|j|ddqWdS)Nrr)rrg)r3tagr!r!r" removecolorscs z#ModifiedColorDelegator.removecolorsN)rrrr6rrrr!r!r!r"rMs rc@s eZdZdddZdddZdS)ModifiedUndoDelegatorNc CsLy"|jj|ddr |jjdSWntk r6YnXtj||||dS)NZ%dS)CModifiedInterpretercCsH||_tjdj}tj||dd|_d|_d|_t |_ |j j j |_dS)N__main__)localsF) tkconsolesysmodules__dict__rr6save_warnings_filters restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)r3rrr!r!r"r6s zModifiedInterpreter.__init__NcCs&|jdkr|j|_tj|j|_dS)N)rbuild_subprocess_arglist subprocessPopen rpcsubproc)r3r!r!r"spawn_subprocesss  z$ModifiedInterpreter.spawn_subprocesscCs^ddtjD}tjdddddd}td kr8d |f}n d |f}tjg|d |t|jgS) NcSsg|] }d|qS)z-Wr!).0sr!r!r" sz@ModifiedInterpreter.build_subprocess_arglist..mainGeneralzdelete-exitfuncFbool)defaulttypezidlelib.pyshellz&__import__('idlelib.run').run.main(%r)z__import__('run').main(%r)z-c)r warnoptionsr GetOptionr executablersr)r3rjZ del_exitfZcommandr!r!r"rs    z,ModifiedInterpreter.build_subprocess_arglistc CsZt|jf}xLtdD]4}tj|yt||_PWqtk rFYqXqW|jdS|jj j d|_t dkr|jj j t jt jd|j|jj jdy|jjWnt jk r|jdSX|jjd|j|jjd|jj|jjd|jj|jjd|jj|jjd |jj|jjd t|jjd ||jd d |j|jS)Nrr rrrrr;r)r^T)with_cwd)HOSTrrtimeZsleeprrpccltrdisplay_port_binding_errorlistening_sockZ getsocknamerZ setsockoptsocketZ SOL_SOCKETZ SO_REUSEADDRrZ settimeoutaccepttimeoutdisplay_no_subprocess_errorregisterrrrrr;r) transfer_pathpoll_subprocess)r3Zaddrir!r!r"start_subprocesss>       z$ModifiedInterpreter.start_subprocessFrRcCsT|jr |jSd|_|j}|rYnXy|jjWntk rbYnX|jd|j_ d|_dS)NF) _afteridrr7Z after_cancelrrrrrr)r3r!r!r"kill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|jjWntk r"dSXy|jjWntk rFdSXdS)N)rkillrwait)r3r!r!r"rsz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|jtjntj}|jd|fdS)NrRzRif 1: import sys as _sys _sys.path = %r del _sys )extendrr> runcommand)r3rr>r!r!r"r#s z!ModifiedInterpreter.transfer_pathcCs6|j}|dkrdSy|j|jdd}Wn2tttfk rX|jjrHdSd}|jYnX|r|jj d|_|\}}|jj }|dkr|dk rt t ||dnH|dkr|jj dr|jn*|dkrd}t ||tjdt |||dy|jjWntk rYnX|jjs2|jjj|jj|j|_dS) Ng?)rZOK)rZ EXCEPTIONz<>ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rZ pollresponse active_seqrrKeyboardInterruptrclosingr resetoutputrprintreprgetvarremote_stack_viewerr __stderr__ endexecutingrr7after pollintervalrr)r3ZcltresponseZhowZwhatrerrmsgr!r!r"r2s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r )r3r r!r!r" setdebuggerZszModifiedInterpreter.setdebuggercCs|jS)N)r )r3r!r!r"r]szModifiedInterpreter.getdebuggercCs|jjjd|jdS)Ni,)rr7rr)r3r!r!r"open_remote_stack_viewer`s z,ModifiedInterpreter.open_remote_stack_viewerc Csddlm}|jjddd i}|dkr6|jjjdS|j|j|}ddlm }m }t |jj}t j }t j|dd}|||dd } | jjd d d || jd|} | jdS)Nr) debugobj_rrZ stackviewerr;)ScrolledCanvasTreeNodeZnormalrT)bgZhighlightthicknessrZboth)expandfill)r;)idlelibrr remotequeuerrurbZStubObjectTreeItemZ idlelib.treerrZToplevelr rVrWframepackZcanvasr) r3rZoiditemrrrrXrTZscZnoder!r!r"rms   z'ModifiedInterpreter.remote_stack_viewerrcCs|j|}|j||dS)N) stuffsourceexecfile)r3sourcerr!r!r" execsources zModifiedInterpreter.execsourcecCs|dkrFtj|.}|j}trabspathr OverflowError SyntaxErrorrrrrrshowsyntaxerrorrruncode)r3rrrxcoder!r!r"rs &   zModifiedInterpreter.execfilec Csd|j|}d|_tjdd|_tjdtdztj|||S|jdk r^|jtjdd<d|_XdS)Nrerror)actionr) r Zmorer%filtersrfilterwarnings SyntaxWarningr runsource)r3rrr!r!r"rs   zModifiedInterpreter.runsourcecCs>d|j}|jd|_|jd}t|dd||ftj|<|S)Nz rrlr)gidsplitr~r)r*)r3rrryr!r!r"r s    zModifiedInterpreter.stuffsourcecCs|jd|fdS)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_syspathsz#ModifiedInterpreter.prepend_syspathc Cs|j}|j}|jdddtj\}}}t|ddp:|p:d}t|ddpJd}t|d dpZd } | d krl|d7}|dkrd | d} nd |d| df} |j|| |j|jd ||j dS)Nrz1.0rmsgrRzr roffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) rr7rgrexc_infortZcolorize_syntax_errorrrr) r3rrr7rvaluetbr#r r$posr!r!r"rs" z#ModifiedInterpreter.showsyntaxerrorcCs6|jj|jtj||jjdr2|jjdS)Nz<>)rrchecklinecacher showtracebackropen_stack_viewer)r3r!r!r"r*s    z!ModifiedInterpreter.showtracebackcCsBtj}x6t|jD]&}|dd|dddkr||=qWdS)Nrz<>r()r)r*r+keys)r3cr/r!r!r"r)sz"ModifiedInterpreter.checklinecachecCs@|jjr|jdS|jr0|jjdd|fin t||jdS)Nrrrr)rrdisplay_executing_dialogrr rr)r3rr!r!r"rs zModifiedInterpreter.runcommandcCst|jjr|jj|j|jdk r:|jtjdd<d|_|j}zyV|jj | rx|j dk rx|j j dd|fi|_ n |r|j ||jn t||jWntk r|jjstjddd|jjdr̂q|jnYnbtr td|jjd|j|jjn,|jjr0d |j_td |jjdn|jYnXWdtsny|jjWntk rlYnXXdS) NrrzExit?zDo you want to exit altogether?yes)rrz IDLE internal error in runcode())rFr)rrr^rr)rr%rr beginexecutingrZ asyncqueuerZrunrr SystemExitrrvZaskyesnor7r*rrrrcanceledr)r3rr r!r!r"rsP         zModifiedInterpreter.runcodecCs|jjj|S)N)rrr)r3rr!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)rvrwrr7)r3r!r!r"r/sz.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjddS)NzSubprocess Startup ErrorzIDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.)r)rvrwrr7)r3r!r!r"r:sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rvrwrr7)r3r!r!r"r.Bsz,ModifiedInterpreter.display_executing_dialog)FrR)F)N)N)&rrrr6rrrrrrrrrrrrrrr rrrrr rrrr r"rr*r)rrrrrr.r!r!r!r"rsF + - &    1 rcseZdZdedZeZeZdZd[d\d]d^d_gZ e j d`gZ ddl m Z daddZddZdZdZdZdZdZdZddZddZdbddZdd Zdcd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Z d/d0Z!d1d2Z"d3Z#d4d5Z$d6d7Z%d8d9Z&d:d;Z'dddd?Z)d@dAZ*dBdCZ+dDdEZ,dFdGZ-dedHdIZ.dfdJdKZ/dgdLdMZ0dNdOZ1dPdQZ2dRdSZ3ffdTdUZ4fdVdWZ5fdXdYZ6Z7S)hrzPython z Shellr_Fileedit_Editr__Debugoptions_Optionswindow_Windowhelp_HelpSqueeze<>r)HistoryNc Cstr&|j}|dddkr&|jddt||_|dkrVt}t||jt|}t j ||ddd|_ d|_ t tdrtjnd|_|jjd d|_|j|_|j}|jd d |jd |j|jd|j|jd|j|jd|j|jd|j|jd|j|jd|jtr8|jd|j|jd|jtj |_!tj"|_#tj$|_%ddl&m'}t(|d|j)|_$t*|d|j)|_ t*|d|j)|_"t*|d|j)|_+ts|j t_ |j"t_"|j$t_$yddl,}|j-|_.Wntj/t_"YnX|j0|j|_1d|_2dS)NrrshellShe_llTps1z>>> rlrchar)wrapz<>z<>z<>z<>z<>z<>z<>z<>z<>)iomenurrrr2)r@rAr()3r menu_specsrarr^Tkrwithdrawrrr6ZusetabsZ indentwidthhasattrrrCsys_ps1r!Zprompt_last_linepromptr7Z configurer8enter_callbacklinefeed_callbackcancel_callback eof_callbackr+toggle_debuggertoggle_jit_stack_viewerview_restart_mark restart_shellr save_stdoutr save_stderrr save_stdinrrFrencodingrrpydocZ plainpagerZpagerrr?historyr)r3r;msrur7rFrZr!r!r"r6ds`     zPyShell.__init__cCs tjddS)NT)Z shell_only)r Z GetExtensions)r3r!r!r"get_standard_extension_namessz$PyShell.get_standard_extension_namesFcCs|adS)N)r)r3streamr!r!r"set_warning_streamszPyShell.set_warning_streamcCstS)N)r)r3r!r!r"get_warning_streamszPyShell.get_warning_streamcCsH|jr$tjdd|jd|jdS|jj}|r<|jn|jdS)NzDon't debug nowz*You can only toggle the debugger when idle)rrQ) rrvrwr7set_debugger_indicatorr^rclose_debugger open_debugger)r3redbr!r!r"rRs   zPyShell.toggle_debuggercCs|jj}|jd| dS)Nz<>)r^rZsetvar)r3rdr!r!r"ras zPyShell.set_debugger_indicatorcCsdS)Nr!)r3rer!r!r"rSszPyShell.toggle_jit_stack_viewercCsh|jj}|r\|jjd|j|jjr8tj|jj|j|jj d|j |_ |j |j dS)Nz [DEBUG OFF] )r^rrrrrZclose_remote_debuggerrrrrLrMrra)r3rdr!r!r"rbs   zPyShell.close_debuggercCsX|jjrtj|jj|}n tj|}|jj||jd|j|_ |j |j dS)Nz [DEBUG ON] ) r^rrZstart_remote_debuggerr ZDebuggerrrrLrMrra)r3Zdbg_guir!r!r"rcs    zPyShell.open_debuggercCs|jd|_dS)Nr)rr)r3r!r!r"r0szPyShell.beginexecutingcCsd|_d|_|jdS)Nr)rr2r)r3r!r!r"rszPyShell.endexecutingcCsD|jr&tjddd|jd}|dkr&dS|jd|_d|_tj|S)NzKill?z7Your program is still running! Do you want to kill it?ok)rrFZcancelT) rrvZ askokcancelr7rr2rrr)r3rr!r!r"rs z PyShell.closecCsV|jtr|jj|jt_|jt_|j t_ d|_d|_ d|j _ d|_tj|dS)N)rbrr^rrVrrrWrrXrrr;r]r[rr)r3r!r!r"rs 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|jtr:d}|jj}|sF|jdSn d}tjt _|j d t j t j |j |f|jj|jd dl}d|_d S)NrrarRFz==== 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. )r7rrrr^rrr displayhookrrversionplatform COPYRIGHTZ focus_forcertkinterZ _default_root)r3ZnosubZclientrmr!r!r"rs$  z PyShell.begincCs|js dSd|_|jjdS)NT)reading_stop_readline_flagrquit)r3r!r!r"r+szPyShell.stop_readlinec Cs|j}zd|_|jjWd||_X|jr4d|_dS|jjdd}t|dkrRd}|j|jrnd|_t snt |j r~d|_ d}|S)NrFrRrzend-1crrl) rnrmainloopror7getr~rr2rr endoffile)r3r.rr!r!r"readline1s( zPyShell.readlinecCsdS)NTr!)r3r!r!r"isattyHszPyShell.isattyc Csy|jjdddrdSWn YnX|jp0|jsR|j|jjd|jdSd|_d|_ |jr|jj r|jj r|jj n |jj |jr|jjdS)Nz sel.firstz!=zsel.lastzKeyboardInterrupt rQrr)r7rrrnrr^rrrsr2rrrrrrp)r3rer!r!r"rPKs&      zPyShell.cancel_callbackcCsh|jr|j rdS|jjdddo0|jjddds6dS|jsN|j|jnd|_d|_|jj dS)Nrz==razend-1crrrQ) rrnr7rrrr2rsrrp)r3rer!r!r"rQas  zPyShell.eof_callbackcCs0|jr"|jjdd|jjdn |j|dS)NrarlrQ)rnr7raseenewline_and_indent_event)r3rer!r!r"rOps  zPyShell.linefeed_callbackc Cs<|jr|j rdSy6|jjdd}|rF|jjdddrF|j||dSWn YnX|jjdddrX|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 ddr>|j|jj|d d |n|j|jjdd |dS|jjdddrx|jjdd|jjdd}|r|j r|jj dd|jjdddr|j |dS|jjdd|jr|jj dd|jj dn |j ||jjd dd|jj|jr0|jjn|jdS)Nz sel.firstzsel.lastz<=rrQrarziomark linestartrrrzinsert lineendz>=rzinsert linestartzend-1czend-1c linestartrl)rrnr7rrrrecallZ tag_prevrangeZ tag_nextrangerstriprrwrarvrYZupdate_idletasksrrprunit)r3reselprevnextindicesrr!r!r"rNysX     zPyShell.enter_callbackc Cs<tjdd|}tjdd|}|jd}|jjz|jjddd|jjdd |jjd d}|jj d r|j ||jjd d}|jj d|d j t |d krtjd|d jd }tjd|jd }xJ|d dD]:}|j|r||t |d}|jj dd|jqWWd|jjd|jjXdS)Nz^\s*\nrRz\n\s*$rlr{z1.0rrazend-1czinsert linestart:rrz ^([ \t]*))resubr!r7Zundo_block_startrgrrrrstripendswithrwraryr~searchgrouprqrvZundo_block_stop)r3rreryprefixZorig_base_indentZnew_base_indentrr!r!r"rxs*     zPyShell.recallcCs|jjdd}t|}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr||ddkr|d}q^W|d|}|jj|dS)Nrzend-1crrz rl)r7rrr~r^r)r3rrr!r!r"rzs   z PyShell.runitc CsX|jjr|jjSy tjWntjdd|jddSddlm }||j |j dS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined))rr) StackBrowser) r^rrrlast_tracebackrvrwr7Zidlelib.stackviewerrrur;)r3rerr!r!r"r+s    zPyShell.open_stack_viewercCs|jjd|jjddS)Nrr)r7rv)r3rer!r!r"rTs zPyShell.view_restart_markcCs|jjdddS)NT)r)r^r)r3rer!r!r"rUszPyShell.restart_shellcCs:|j|jj|j|jjdd|j|jjdS)Nrazend-1c) rrrrMr7rset_line_and_columnrAZ reset_undo)r3r!r!r"rs zPyShell.showpromptcCsP|jjj}t|ddd}dj|j|}|jds:|d7}|jjj d|ddS)NrBT)rtabsize expand_tabsrlziomark linestartr) r^rrr r?rErZperZbottomra)r3r#rwrapperZ wrapped_msgr!r!r" show_warnings   zPyShell.show_warningcCsX|jjdd}|jr |jj||jjddkr>|jjdd|jjdd|jdS)Nrzend-1czend-2crl)r7rrr[storerarr)r3rr!r!r"rs zPyShell.resetoutputc Cst|trRt|rRt|dkrRxt|D]\}}|dkr(Pq(Wtd|||ddy0|jjddtj |||d}|jjddWnYnX|j rd|_ t st |S) Nu￿zUCS-2rz%Non-BMP character not supported in Tkrrightrr) isinstancersr~max enumerateUnicodeEncodeErrorr7rrrr2rr)r3rrrrDcountr!r!r"rs"z PyShell.writec s8y|jjdddrdSWntk r,dSXtjS)Nz sel.firstrrdisabled)r7rrsuperrF)r3) __class__r!r"rF&s zPyShell.rmenu_check_cutcs|jjdddrdStjS)Nrarrr)r7rrrL)r3)rr!r"rL.szPyShell.rmenu_check_paste)rr3)r4r5)r_r6)r7r8)r9r:)r;r<)r=r>)N)N)N)N)N)N)N)8rrrr rgrr rrrHrrZidlelib.historyr?r6r]rnrr2rsrror_r`rRrarSrbrcr0rrrrfrhrlrrrtrurPrQrOrNrxrzr+rTrUrrrrrFrL __classcell__r!r!)rr"rJsj  <      ?     rcCs6|jdkr2x&dD]}|j|dd|j|dqWdS)NZx11TextEntrySpinboxz <>z%catch {%W delete sel.first sel.last} )rrr)Z_windowingsystemZ bind_class)ruclsr!r!r" fix_x11_paste4s  ra 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}tddad}d}d}d}d}d} y|jtj ddd\} } WnD|j k r} z&t d | t ftj d tjd WYdd} ~ XnXx| D]\} }| d kr|}d}| d krd}d}| dkrd}| dkr tjjt tj| dkrd}| dkr6t dtj d da| dkrj|}tjj|rTnt d|tjd}| dkr|d} d}| dkr|t_d}qW| r| ddkrtjj}d}x0tttjD]}tjjtj|tj|<qW| r| ddkrdg| ddt_ n|r$d g| t_ n|r8|g| t_ n| rd}g}x | D]}|jtjj|qLWxX|D],}tjj|}|tjkrntjjd|qnWn"tj}|tjkrtjjd|tj ddddd}|p|}|p| }tr| rt!t"dda#t#j$dd l%m&}|t#tjj'tjjt(d!|d"krbtjj'd#}t#j)|d$nBt*d%krpd&nd'fd(d)d1D}d-d)|D}t#j+d2|t,t#t-t#t.t#a/|j0t#t/|r|p|sx0| ddD] }t/j1|dkr| j2|qW| st/j3|rPt/j4}|s2dS|j5rVt/j6rV|j7j8nt/j9}|rd|j:| rtj;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/jErFt#jFq2Wt#jGtddS)3Nr)system)testing)macosxTFrz c:deihnr:st:z Error: %s %s)rrz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t-rRrrzeditor-on-startupr)rZIdle)Z className)rZIconsZWindowszidle.ico)rg333333!@z.pngz.gifcs"g|]}tjjd|fqS)z idle_%d%s)r=r>r?)rsize)exticondirr!r"rszmain.. 0cSsg|]}tt|dqS))Zmasterr)Z PhotoImageru)riconfiler!r!r"rsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )rrr)T)Hgetoptrkrrrrr'rrargvrr usage_msgrexitrrr=r>r|rrgrrrr~rr\dirnameragetcwdr rZ NoDefaultRootrIrurJ idlelib.runrr?__file__Z wm_iconbitmap TkVersionZ wm_iconphotorrrr;ZsetupApprorfnewr<ZisAquaTkdictrlowerr]rcenvironrrr^rrrr"ZtkVersionWarningrZpreferTabsPreferenceWarningZ inversedictrqZdestroy)rrrrZ enable_shellZ enable_editr_cmdZscriptZstartupZoptsrCr#oarZpathxrdirZ edit_startrrZ iconfilesZiconsr@ZtkversionwarningZprefer_tabs_preference_warningr!)rrr"rus                                   rrr]F)NN)Orrm ImportErrorrrr1rkZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrvrrIrurJrrrwrrr)r=Zos.pathr rrrtextwrapr rrrr%Zidlelib.colorizerr Zidlelib.configr rr rZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrrrr#r$r' checkcacher0r1rrrZ RPCClientrrrrrrrrr!r!r!r"s                  >Hm?1