a  ze @sddlZedkr ejdejd<z ddlTWn(eyTedejdedYn0ejdkrz ddl Z dZ e d  e Wnee efyYn0dd lmZed kreatdd lmZetejd detdedddlmZddlZddlZddlZddlmZddlZddlZddlZddl 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_streamwriterAttributeErrorOSError)messagecategoryfilenamelinenorrr(C/opt/bitninja-python-dojo/embedded/lib/python3.9/idlelib/pyshell.pyidle_showwarningLs r*cCs0|rtdur,tjatt_ntdur,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)_warnings_showwarningwarnings showwarningr*)capturer(r(r)capture_warnings_sr/TcCsXtj}i}t|D].}|dd|dddkr||||<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<>) linecachecachelistpopupdate)r&Zorig_checkcacher3savekeyr(r(r)extended_linecache_checkcachens  r9c@sveZdZdZddZgdZdddZdd Zdd d Zdd dZ ddZ ddZ ddZ ddZ ddZddZd S)PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGsg|_tj|g|R|jd|j|jd|j|jd|jjt j t j d|_|jj|fdd}|j||jjr||dS)N<><>z<>zbreakpoints.lstcSs||dSN)restore_file_breaks)Zold_hookselfr(r(r)filename_changed_hooksz;PyShellEditorWindow.__init__..filename_changed_hook) breakpointsr__init__textbindset_breakpoint_hereclear_breakpoint_hereflist open_shellospathjoinrZuserdirbreakpointPathioZfilename_change_hookZset_filename_change_hookr&r>color_breakpoint_text)r?argsr@r(r(r)rBs  zPyShellEditorWindow.__init__))ZCutz<>rmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>rmenu_check_paste)NNN)zSet Breakpointr;N)zClear Breakpointr<NTcCsD|jdurdS|r(t}t|d}n ddd}|jd|dS)z,Turn colorizing of breakpoint text on or offNbreak) foreground backgroundBREAK)rMr CurrentTheme GetHighlightrCZ tag_config)r?ZcolorthemeZcfgr(r(r)rNs  z)PyShellEditorWindow.color_breakpoint_textcCs|j}|jj}|dd|d|dz|j|WntyV|j|Yn0z|jj j j }| ||Wn Yn0dS)NrVz%d.0r) rCrMr&tag_addrAindex ValueErrorappendrGpyshellinterprrE)r?r'rCr&debugr(r(r)set_breakpoints  z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s|dStt|d}||dS)Ninsert)rCrMr&bellintfloatr[ra)r?eventrCr&r'r(r(r)rEsz'PyShellEditorWindow.set_breakpoint_herecCs|j}|jj}|s|dStt|d}z|j|Wn Yn0| dddz|j j j j }|||Wn Yn0dS)NrbrVinsert linestartzinsert lineend +1char)rCrMr&rcrdrer[rAremove tag_removerGr^r_rrF)r?rfrCr&r'r`r(r(r)rFs$ z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$|dSg|_|ddtz|jjj j }| |Wn Yn0dS)NrV1.0) rArCrMr&rcriZENDrGr^r_rclear_file_breaks)r?rCr&r`r(r(r)rks z%PyShellEditorWindow.clear_file_breaksc Cs:|j}|jj}z8t|jd}|}Wdn1s:0YWnty\g}Yn0z~t|jd^}|D]}||dsr||qr| |j}|r||dt |dWdn1s0YWnXty4}z>t |j dds d|j _ tjd d t ||jd WYd}~n d}~00dS) z#Save breakpoints when file is savedrNw= breakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)titler$r )rArMr&openrL readlinesr# startswithr!update_breakpointsstrgetattrrootrpr showerrorrC)r?Zbreaksr&fplinesZnew_filererrr(r(r)store_file_breakss2*   <z%PyShellEditorWindow.store_file_breakscCs|j|jdurdS|jj}|dur,dStj|jrt|jd}| }Wdn1sd0Y|D]>}| |drrt |t |dd}|D]}| |qqrdS)Nrlrnr)rCr6rMr&rIrJisfilerLrrrsrtevallenra)r?r&rzr{rZbreakpoint_linenumbersZbreakpoint_linenumberr(r(r)r>s  &z'PyShellEditorWindow.restore_file_breakscCs$|j}|d}||}||_dS)z3Retrieves all the breakpoints in the current windowrVN)rCZ tag_rangesranges_to_linenumbersrA)r?rCrangesZlinenumber_listr(r(r)ru%s  z&PyShellEditorWindow.update_breakpointscCsbg}tdt|dD]H}tt||j}tt||dj}||kr|||d7}q@q|S)Nrr)rangerrdrestringr])r?rr{r[r'endr(r(r)r,s  z)PyShellEditorWindow.ranges_to_linenumberscCs|t|dS)z7Extend base method - clear breaks when module is closedN)rkr_closer?r(r(r)r=szPyShellEditorWindow._close)T)N)N)__name__ __module__ __qualname____doc__rB rmenu_specsrNrarErFrkr}r>rurrr(r(r(r)r:s  *r:c@s"eZdZdZeZdZdddZdS)PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jjnt||_|jr2|js2dS|jSr=)r^topwakeupPyShellbeginr?rfr(r(r)rHLs  zPyShellFileList.open_shell)N)rrrrr:rr^rHr(r(r(r)rCsrc@s0eZdZdZddZddZddZdd Zd S) ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst||dSr=)rrB LoadTagDefsrr(r(r)rBZs zModifiedColorDelegator.__init__cCs*|ddd|dddt|dS)NZTODOrjiomarkZSYNC)rirZrrecolorize_mainrr(r(r)r^sz&ModifiedColorDelegator.recolorize_mainc CsJt|t}|jdddt|dt|dt|dddS)N)rUrTstdoutstderrconsole)stdinrrr)rrrrWtagdefsr6rX)r?rYr(r(r)rcs    z"ModifiedColorDelegator.LoadTagDefscCs|jD]}||ddqdS)Nrr)rri)r?tagr(r(r) removecolorsms z#ModifiedColorDelegator.removecolorsN)rrrrrBrrrr(r(r(r)rWs  rc@s$eZdZdZdddZdddZdS) ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNcCsLz$|j|ddr"|jWdSWnty6Yn0t||||dSNZ%dS)CModifiedInterpretercCsB||_tjdj}tj||dd|_d|_t|_ |j j j |_ dS)Nr)localsF) tkconsolesysmodules__dict__r rB restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)r?rrr(r(r)rBs zModifiedInterpreter.__init__NcCs&|jdur||_t|j|_dSr=)rbuild_subprocess_arglist subprocessPopen rpcsubprocrr(r(r)spawn_subprocesss  z$ModifiedInterpreter.spawn_subprocesscCs\|jdksJdddtjD}tjddddd d }d |f}tjg|d |t|jgS) Nrz/Socket should have been assigned a port number.cSsg|] }d|qS)z-Wr().0sr(r(r) z@ModifiedInterpreter.build_subprocess_arglist..mainGeneralzdelete-exitfuncFbool)defaulttypez&__import__('idlelib.run').run.main(%r)-c)rr warnoptionsr GetOption executablerv)r?rmZ del_exitfZcommandr(r(r)rs   z,ModifiedInterpreter.build_subprocess_arglistc CsXt|jf}tdD]6}t|zt||_WqVWqtyFYq0q|dS|jj d|_t dkr|jj t jt jd||jj dz|jWnt jy|YdS0|jd|j|jd|jj|jd|jj|jd|jj|jd |jj|jd t|jd ||jd d ||jS)Nrr rrrrrGr2r_Twith_cwd)HOSTrrtimesleeprrpccltr#display_port_binding_errorlistening_sock getsocknamer setsockoptsocket SOL_SOCKET SO_REUSEADDRr settimeoutaccepttimeoutdisplay_no_subprocess_errorregisterrrrrrGr2 transfer_pathpoll_subprocess)r?addrir(r(r)start_subprocesss@        z$ModifiedInterpreter.start_subprocessFrScCs0|jr |jSd|_|}|r>ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )rZ pollresponse active_seqrr#KeyboardInterruptrclosingr resetoutputrprintreprgetvarremote_stack_viewerr __stderr__ endexecutingr"rCafter pollintervalrr)r?ZcltresponsehowZwhatrerrmsgr(r(r)rDsB     z#ModifiedInterpreter.poll_subprocesscCs ||_dSr=r)r?rr(r(r) setdebuggerlszModifiedInterpreter.setdebuggercCs|jSr=rrr(r(r)roszModifiedInterpreter.getdebuggercCs|jjd|jdS)aInitiate 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)rrCrr rr(r(r)open_remote_stack_viewerrs z,ModifiedInterpreter.open_remote_stack_viewerc Csddlm}|jdddi}|dur6|jjdS||j|}ddlm }m }t |jj}t }t |dd}|||dd } | jjd d d || jd|} | dS) Nr) debugobj_rrZ stackviewer)rG)ScrolledCanvasTreeNodenormalrU)bgZhighlightthicknessrZboth)expandfill)idlelibrr remotequeuerrxrcZStubObjectTreeItemZ idlelib.treerrZToplevelrrWrXframepackZcanvasr) r?rZoiditemrrrrYrUZscZnoder(r(r)r s   z'ModifiedInterpreter.remote_stack_viewerrcCs||}|||dS)z1Like runsource() but assumes complete exec sourceN) stuffsourceexecfiler?sourcer&r(r(r) execsources zModifiedInterpreter.execsourcec Cs|durZt|8}|}trd|j}|jd|_|d}t|dd||ftj|<|S)z"Stuff source in the filename cachez rror)gidsplitrr2r3)r?r&r&r{r(r(r)r#s    zModifiedInterpreter.stuffsourcecCs|d|fdS)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)rr?r&r(r(r)prepend_syspathsz#ModifiedInterpreter.prepend_syspathc Cs|j}|j}|dddt\}}}t|ddp:|p:d}t|ddpJd}t|d dpZd } | d krl|d7}|dkrd | d} nd |d| df} ||| ||d || dS)zOverride Interactive Interpreter method: Use Colorizing Color the offending position instead of printing it and pointing at it with a caret. rrjrmsgrSzr'roffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s N) rrCrirexc_inforwZcolorize_syntax_errorr r!r) r?r&rrCrvaluetbr7r'r8posr(r(r)r.s$ z#ModifiedInterpreter.showsyntaxerrorcCs6|j|t||jdr2|jdS)z1Extend base class method to reset output properlyrN)rr checklinecacher showtracebackr open_stack_viewerrr(r(r)r>s    z!ModifiedInterpreter.showtracebackcCs>tj}t|D]&}|dd|dddkr||=qdS)Nrr0r1)r2r3r4keys)r?cr8r(r(r)r=sz"ModifiedInterpreter.checklinecachecCs@|jjr|dS|jr0|jdd|fin t||jdS)z*Run the code without invoking the debuggerrrr/r)rrdisplay_executing_dialogrrrr)r?r0r(r(r)rs zModifiedInterpreter.runcommandcCst|jjr|||j}z"zT|j|sT|jdurT|jdd|fi|_n |rh| ||j n t ||j Wnt y|jj stjddd|jjdrq|nYn`trtd|jjd ||jn,|jjrd |j_td |jjd n|Yn0Wtspz|jWnty@Yn0n,tsnz|jWntylYn00dS) Override base class methodNrr/zExit?zDo you want to exit altogether?Zyesrr z IDLE internal error in runcode()rFr)rrrr=rbeginexecutingrZ asyncqueuerrunrr SystemExitrrZaskyesnorCr>r*r rrcanceledr")r?r0rr(r(r)r/sZ      zModifiedInterpreter.runcodecCs|jj|S)rC)rrr!)r?rr(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 rryrrCrr(r(r)r.s z.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjddS)NzSubprocess Connection ErrorzIDLE'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 rIrr(r(r)r9s z/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.r rIrr(r(r)rBAs z,ModifiedInterpreter.display_executing_dialog)FrS)F)N)N)&rrrrBrrrrrrrrrrrrrrrrrrr r3r'r$r2r#r6r.r>r=rr/r!rrrBr(r(r(r)rsF  + , &     . rcseZdZdeZeZeZgdZ e j dgZ dZ ddl mZdPdd Zd d ZdZdZdZdZdZdZd d ZddZdQddZddZdRddZddZddZddZddZddZ d d!Z!d"d#Z"d$d%Z#d&d'Z$d(Z%d)d*Z&d+d,Z'd-d.Z(d/d0Z)dSd1d2Z*d3d4Z+d5d6Z,d7d8Z-d9d:Z.d;d<Z/dTd=d>Z0dUd?d@Z1dVdAdBZ2dCdDZ3dEdFZ4dGdHZ5dWdJdKZ6fdLdMZ7fdNdOZ8Z9S)Xrz IDLE Shell ))rZ_File)ZeditZ_Edit)r`Z_Debug)optionsZ_Options)ZwindowZ_Window)helpZ_Help)ZSqueeze<>Fr)HistoryNcCs$tr&|j}|dddkr&|ddt||_|durVt}t||t|}t ||ddd|_ d|_ t tdrtjnd|_|jd d |_|j|_|j}|jd d |d |j|d|j|d|j|d|j|d|j|d|j|d|jtr8|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)Nrrshell)rNZShe_llTps1rror0char)wrapz<>z<>z<>z<>z<><>rz<>z<>rL)iomenurrrbackslashreplacer2)6r* menu_specsrbrr_TkrwithdrawrrrBZusetabsZ indentwidthhasattrrrPsys_ps1r4Zprompt_last_linepromptrCZ configurerDenter_callbacklinefeed_callbackcancel_callback eof_callbackr?toggle_debuggertoggle_jit_stack_viewerview_restart_mark restart_shellZSqueezerZsqueeze_current_text_eventr save_stdoutr save_stderrr save_stdinrrTrencodingerrorsrrpydocZ plainpagerZpagerrrMhistoryr)r?rGmsrxrCZsqueezerrTrjr(r(r)rBesx      zPyShell.__init__cCs tjddS)NT)Z shell_only)rZ GetExtensionsrr(r(r)get_standard_extension_namessz$PyShell.get_standard_extension_namescCs|adSr=r )r?streamr(r(r)set_warning_streamszPyShell.set_warning_streamcCstSr=rnrr(r(r)get_warning_streamszPyShell.get_warning_streamcCsH|jr$tjdd|jd|dS|j}|r<|n|dS)NzDon't debug nowz*You can only toggle the debugger when idler rR) rrryrCset_debugger_indicatorr_rclose_debugger open_debugger)r?rfdbr(r(r)ras  zPyShell.toggle_debuggercCs|j}|d| dS)NrS)r_rZsetvarr?rur(r(r)rrs zPyShell.set_debugger_indicatorcCsdSr=r(rr(r(r)rbszPyShell.toggle_jit_stack_viewercCsh|j}|r\|jd||jjr8t|jj||j d|j |_ | | dS)Nz [DEBUG OFF] )r_rrrrrZclose_remote_debuggerr rr!r[r\rrrrvr(r(r)rss   zPyShell.close_debuggercCsX|jjrt|jj|}n t|}|j||d|j|_ | | dS)Nz [DEBUG ON] ) r_rrZstart_remote_debuggerrZDebuggerrrr[r\rrr)r?Zdbg_guir(r(r)rts    zPyShell.open_debuggercCs |jr dnd}|dd|dS)Ndisabledrr`z *tack*iewer)rZupdate_menu_state)r?stater(r(r)debug_menu_postcommandszPyShell.debug_menu_postcommandcCs|d|_dS)Helper for ModifiedInterpreterTN)r rrr(r(r)rEszPyShell.beginexecutingcCsd|_d|_|dS)rzFN)rrHrrr(r(r)rszPyShell.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?okrDFcancelT) rrZ askokcancelrCrrHrrr)r?rr(r(r)rsz PyShell.closecCsV|tr|j|jt_|jt_|j t_ d|_d|_ d|j _ d|_t|dS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)rsr*r_rrerrrfrrgrrrGr^rkrrrr(r(r)rs zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr(r5r(r(r)ispythonsourceszPyShell.ispythonsourcecCs|jSr=) shell_titlerr(r(r) short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs|jdd|tr:d}|j}|sF|dSn d}tjt _| dt j t j |j |f|j|ddl}d|_d|_dS) NrrbrSFz==== 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)rCrr r*r_rrr displayhookrr!versionplatform COPYRIGHTZ focus_forcertkinterZ_support_default_rootZ _default_root)r?Znosubclientrr(r(r)rs&  z PyShell.begincCs|js dSd|_|jdSNT)reading_stop_readline_flagrquitrr(r(r)r9szPyShell.stop_readlinecCs|j}zd|_|jW||_n||_0|jr:d|_dS|jdd}t|dkrXd}||jrtd|_t stt |j rd|_ d}|S)NTFrSrrrro) rrmainlooprrCgetrr rHr*r endoffile)r?r7rr(r(r)readline?s(  zPyShell.readlinecCsdSrr(rr(r(r)isattyVszPyShell.isattycCsz|jdddrWdSWn Yn0|jsT|jsT||jd|dSd|_d|_ |jr|jj r|j r|j n |j |jr|jdS)N sel.firstz!=sel.lastzKeyboardInterrupt rRFT)rCrrrr r_r!rrrHrrrrrrrr(r(r)r_Ys&       zPyShell.cancel_callbackcCsf|jr|jsdS|jdddr0|jddds4dS|jsL||nd|_d|_|j dS)Nrz==rbrFTrR) rrrCrr rrHrrrrr(r(r)r`os   zPyShell.eof_callbackcCs0|jr"|jdd|jdn ||dS)NrbrorR)rrCrbseenewline_and_indent_eventrr(r(r)r^~s  zPyShell.linefeed_callbackcCs:|jr|jsdSz8|jdd}|rF|jdddrF|||WdSWn Yn0|jdddrX|jd d}|r|jdd|d r||j|d |d |dS|jd d}|r|jd d |d r||j|d |d |dS|jdd}|r>|j|d ddr>||j|d d |n||jdd |dS|jdddrx|jdd|jdd}|r| s|j dd|jdddr| |dS|jdd|jr|j dd|j dn | ||jd dd|j|jr.|jn|dS)Nrrz<=rrRrbriomark linestartrrrzinsert lineendz>=rrgrzend-1c linestartro)rrrCrrrecallZ tag_prevrangeZ tag_nextrangerstriprrrbrrZZupdate_idletasksrrrunit)r?rfselprevnextindicesrr(r(r)r]sZ       zPyShell.enter_callbackc CsLtdd|}tdd|}|d}|jz|jddd|jdd |jd d}| d r| ||jd d}|j d|d  t |d krtd|d d }td|d }|d dD]8}||r||t |d}|j dd|qW|jd|jn|jd|j0dS)Nz^\s*\nrSz\n\s*$rorrjrrbrrg:rrz ^([ \t]*))resubr4rCZundo_block_startrirrrstripendswithrrbrrsearchgrouprtrZundo_block_stop)r?rrfr{prefixZorig_base_indentZnew_base_indentrr(r(r)rs.      zPyShell.recallcCs|jdd}t|}|dkr8||ddvr8|d}q|dkrX||ddkrX|d}|dkrz||ddvrz|d}qX|d|}|j|dS)Nrrrrz ro)rCrrr_r2)r?rrr(r(r)rs   z PyShell.runitcCs\|jjr|jSz 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_rr rlast_tracebackrryrCZidlelib.stackviewerrrxrG)r?rfrr(r(r)r?s   zPyShell.open_stack_viewercCs|jd|jddS)Nrr)rCrrr(r(r)rcs zPyShell.view_restart_markcCs|jjdddS)z&Callback for Run/Restart Shell Cntl-F6TrN)r_rrr(r(r)rdszPyShell.restart_shellcCs:||j|j|jdd||jdS)Nrbr) r rr!r\rCrset_line_and_columnrMZ reset_undorr(r(r)rs zPyShell.showpromptcCsP|jjj}t|ddd}d||}|ds:|d7}|jj d|ddS)NrOT)rtabsizeZ expand_tabsrorr) r_rrrrKrRrZperZbottomrb)r?r7rwrapperZ wrapped_msgr(r(r) show_warning s   zPyShell.show_warningcCsb|jdd}|jr |j||jddkr>|jdd|jdd||jdS)Nrrzend-2cro) rCrrkstorerbrrZctipZremove_calltip_window)r?r&r(r(r)r s zPyShell.resetoutputr(cCsXz0|jddt|||d}|jddWnYn0|jrTd|_tsTt|S)NrrightrF)rCrrr!rHr*r)r?rrcountr(r(r)r!sz PyShell.writecs:z|jdddrWdSWnty.YdS0tS)Nrrrrw)rCrrsuperrPr __class__r(r)rP+s   zPyShell.rmenu_check_cutcs|jdddrdStS)Nrbrrrw)rCrrrQrrr(r)rQ3szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r():rrrrr~rrrrrWrrZallow_line_numbersZidlelib.historyrMrBrmrrrHrrrrprqrarrrbrsrtryrErrrr}rrrrrrr_r`r^r]rrr?rcrdrrr r!rPrQ __classcell__r(r(rr)rIsh    C      ?     rc Cs2|jdkr.dD]}||dd||dqdS)z6Make paste replace selection on x11. See issue #5124.Zx11)TextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} N)Z_windowingsystemZ bind_class)rxclsr(r(r) fix_x11_paste9s  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]. c s\ddl}ddlm}ddlm}ddlm}tddad}d}d}d}d}d} z|tj ddd\} } WnF|j y} z,t d | t ftj d td WYd} ~ n d} ~ 00| D]\} }| d kr|}d}| d krd}d}| dkrd}| dkr tjt t| dkrd}| dkr6t dtj d da| dkrj|}tj|rTnt d|td}| dkr|d} d}| dkr|t_d}q| r| ddkrtj}d}tttjD]}tjtj|tj|<q| r | ddkr dg| ddt_ n|rd g| t_ n|r2|g| t_ n| rd}g}| D]}|tj|qD|D],}tj|}|tjvrbtjd|qbn"t}|tjvrtjd|tj ddddd}|p|}|p| }tr|st!t"dda#t#$dd l%m&}|t#tj'tjt(d!|d"krRtj'd#}t#j)|d$nZ|*st+d%krpd&d'}nd(d)}fd*d+|D}d,d+|D}t#j,dg|Rt-t#t.t#t/t#a0|1t#t0|r|s|s| ddD] }t02|dur| 3|q| st04|rTt05}|s6dS|*rZt0j6rZ|j78nt0j9}|rh|:| rtj;||s|r|j=?d/tj f|r|j=@|n|r4|j=A||j=>|n8|r4|Bt#}|r|C||D}|r4|C|t0jErHt#Fq4t#GtddS)0Nr)system)testing)macosxTFrz c:deihnr:st:z Error: %s %srrrz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t-rSrrzeditor-on-startupr)rZIdle)Z classNamer ZIconsZWindowszidle.ico)rg333333!@z.png) 0z.gif)rrrcs"g|]}tjd|fqS)z idle_%d%s)rIrJrK)rsizeextZicondirr(r)rszmain..cSsg|]}tt|dqS))Zmasterr)Z PhotoImagerx)riconfiler(r(r)rsZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )Hgetoptrrrrrr/r*rargverrorr  usage_msgrexitrr!rIrJr~rr~rr)rrr+r]dirnamerbgetcwdrrZ NoDefaultRootrXrxrY idlelib.runr rK__file__Z wm_iconbitmapZisAquaTk TkVersionZ wm_iconphotorrrrGZsetupApprrrhnewrHdictrlowerr^rtenvironrr_r$rr'r6ZtkVersionWarningrZpreferTabsPreferenceWarningZ inversedictrZdestroy)rrrrZ enable_shellZ enable_editr`cmdZscriptZstartupZoptsrOr7oarZpathxr&dirZ edit_startr rZsizesZ iconfilesZiconsrNZtkversionwarningZprefer_tabs_preference_warningr(rr)rzs$                                    rF)NN)Rrrrr ImportErrorr rrGrZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr"r#rrrXrxrYrr ryr0r r2rIZos.pathrrrrtextwraprrrr(r,Zidlelib.colorizerrZidlelib.configrrrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrreofrr NameErrorr r*r+r/ checkcacher9r:rrrZ RPCClientrrrrrrrr(r(r(r)s                    ?0s 66