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_dadSN)_warnings_showwarningwarnings showwarningr*)capturer(r(r)capture_warnings_sr0TcCsXtj}i}t|D].}|dd|dddkr||||<q||||dSNrz<>) linecachecachelistpopupdate)r&Zorig_checkcacher4savekeyr(r(r)extended_linecache_checkcachens  r:c@sreZdZddZgdZdddZddZdd d Zdd d ZddZ ddZ ddZ ddZ ddZ ddZd S)PyShellEditorWindowcGsg|_tj|g|R|jd|j|jd|j|jd|jjt j t j d|_|jj|fdd}|j||jjr||dS)N<><>z<>zbreakpoints.lstcSs||dSr+)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)Nbreak) 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 _ tjdd t ||jd WYd}~n d}~00dS) Nrw= 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)rCr7rMr&rIrJisfilerLrrrsrtevallenra)r?r&rzr{rZbreakpoint_linenumbersZbreakpoint_linenumberr(r(r)r>s  &z'PyShellEditorWindow.restore_file_breakscCs$|j}|d}||}||_dS)NrV)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|dSr+)rkr_closer?r(r(r)r=szPyShellEditorWindow._close)T)N)N)__name__ __module__ __qualname__rB rmenu_specsrNrarErFrkr}r>rurrr(r(r(r)r;s  *r;c@seZdZeZdZdddZdS)PyShellFileListNcCs8|jr|jjnt||_|jr2|js2dS|jSr+)r^topwakeupPyShellbeginr?rfr(r(r)rHLs  zPyShellFileList.open_shell)N)rrrr;rr^rHr(r(r(r)rCsrc@s,eZdZddZddZddZddZd S) ModifiedColorDelegatorcCst||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)rrrrWtagdefsr7rX)r?rYr(r(r)rcs    z"ModifiedColorDelegator.LoadTagDefscCs|jD]}||ddqdS)Nrr)rri)r?tagr(r(r) removecolorsms z#ModifiedColorDelegator.removecolorsN)rrrrBrrrr(r(r(r)rWs rc@s eZdZdddZdddZdS)ModifiedUndoDelegatorNcCsLz$|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_subprocesscCsJddtjD}tjdddddd}d |f}tjg|d |t|jgS) NcSsg|] }d|qS)z-Wr().0sr(r(r) z@ModifiedInterpreter.build_subprocess_arglist..mainGeneralzdelete-exitfuncFbool)defaulttypez&__import__('idlelib.run').run.main(%r)-c)r warnoptionsr GetOption executablervr)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 rrrrrGr3r_Twith_cwd)HOSTrrtimesleeprrpccltr#display_port_binding_errorlistening_sock getsocknamer setsockoptsocket SOL_SOCKET SO_REUSEADDRr settimeoutaccepttimeoutdisplay_no_subprocess_errorregisterrrrrrGr3 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)Ni,)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||}|||dSr+) stuffsourceexecfiler?sourcer&r(r(r) execsources zModifiedInterpreter.execsourcec Cs|durZt|8}|}trd|j}|jd|_|d}t|dd||ftj|<|S)Nz rror)gidsplitrr3r4)r?r&r&r{r(r(r)r#s    zModifiedInterpreter.stuffsourcecCs|d|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 )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)NrrjrmsgrSzr'roffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) rrCrirexc_inforwZcolorize_syntax_errorr r!r) r?r&rrCrvaluetbr6r'r7posr(r(r)r.s$ z#ModifiedInterpreter.showsyntaxerrorcCs6|j|t||jdr2|jdS)Nr)rr checklinecacher showtracebackr open_stack_viewerrr(r(r)r=s    z!ModifiedInterpreter.showtracebackcCs>tj}t|D]&}|dd|dddkr||=qdSr1)r3r4r5keys)r?cr9r(r(r)r<sz"ModifiedInterpreter.checklinecachecCs@|jjr|dS|jr0|jdd|fin t||jdS)Nrrr/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 |jjdn|Yn0Wtspz|jWnty@Yn0n,tsnz|jWntylYn00dS) Nrr/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|Sr+)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 rGrr(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 rGrr(r(r)rAAs z,ModifiedInterpreter.display_executing_dialog)FrS)F)N)N)&rrrrBrrrrrrrrrrrrrrrrrrr r2r'r$r1r#r5r.r=r<rr/r!rrrAr(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)rLZShe_llTps1rror2char)wrapz<>z<>z<>z<>z<><>rz<>z<>rJ)iomenurrrbackslashreplacer2)6r* menu_specsrbrr_TkrwithdrawrrrBZusetabsZ indentwidthhasattrrrNsys_ps1r3Zprompt_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_stdinrrRrencodingerrorsrrpydocZ plainpagerZpagerrrKhistoryr)r?rGmsrxrCZsqueezerrRrhr(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+rlrr(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)r_s  zPyShell.toggle_debuggercCs|j}|d| dS)NrQ)r_rZsetvarr?rsr(r(r)rps zPyShell.set_debugger_indicatorcCsdSr+r(rr(r(r)r`szPyShell.toggle_jit_stack_viewercCsh|j}|r\|jd||jjr8t|jj||j d|j |_ | | dS)Nz [DEBUG OFF] )r_rrrrrZclose_remote_debuggerr rr!rYrZrrprtr(r(r)rqs   zPyShell.close_debuggercCsX|jjrt|jj|}n t|}|j||d|j|_ | | dS)Nz [DEBUG ON] ) r_rrZstart_remote_debuggerrZDebuggerrrrYrZrrp)r?Zdbg_guir(r(r)rrs    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|_dSNT)r rrr(r(r)rCszPyShell.beginexecutingcCsd|_d|_|dSr)rrFrrr(r(r)rszPyShell.endexecutingcCsD|jr&tjddd|jd}|dur&dS|d|_d|_t|S)NzKill?z7Your program is still running! Do you want to kill it?okrBFcancelT) rrZ askokcancelrCrrFrrr)r?rr(r(r)rsz PyShell.closecCsV|tr|j|jt_|jt_|j t_ d|_d|_ d|j _ d|_t|dSr+)rqr*r_rrcrrrdrrerrrGr^rirrrr(r(r)rs zPyShell._closecCsdSrxr(r4r(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|_|jdSrx)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 rFr*r endoffile)r?r8rr(r(r)readline?s(  zPyShell.readlinecCsdSrxr(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!rrrFrrrrrrrr(r(r)r]Ys&       zPyShell.cancel_callbackcCsf|jr|jsdS|jdddr0|jddds4dS|jsL||nd|_d|_|j dS)Nrz==rbrFTrR) rrrCrr rrFrrrrr(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]*))resubr3rCZundo_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_r1)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)ras zPyShell.view_restart_markcCs|jjdddS)NTr)r_rrr(r(r)rbszPyShell.restart_shellcCs:||j|j|jdd||jdS)Nrbr) r rr!rZrCrset_line_and_columnrMZ reset_undorr(r(r)rs zPyShell.showpromptcCsP|jjj}t|ddd}d||}|ds:|d7}|jj d|ddS)NrMT)rtabsizeZ expand_tabsrorr) r_rrrrKrPrZperZbottomrb)r?r6rwrapperZ wrapped_msgr(r(r) show_warning s   zPyShell.show_warningcCsb|jdd}|jr |j||jddkr>|jdd|jdd||jdS)Nrrzend-2cro) rCrristorerbrrZctipZremove_calltip_window)r?r&r(r(r)r s zPyShell.resetoutputr(cCsXz0|jddt|||d}|jddWnYn0|jrTd|_tsTt|S)NrrightrF)rCrrr!rFr*r)r?rrcountr(r(r)r!sz PyShell.writecs:z|jdddrWdSWnty.YdS0tS)Nrrrru)rCrrsuperrPr __class__r(r)rP+s   zPyShell.rmenu_check_cutcs|jdddrdStS)Nrbrrru)rCrrrQrrr(r)rQ3szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r():rrrrr|rrrrrUrrZallow_line_numbersZidlelib.historyrKrBrkrrrFrrrrnror_rpr`rqrrrwrCrrrr{r}rrrrrr]r^r\r[rrr>rarbrrr r!rPrQ __classcell__r(r(rr)rIsh    C      ?     rc Cs2|jdkr.dD]}||dd||dqdS)NZx11)TextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} )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 )Hgetoptrrrrrr0r*rargverrorr  usage_msgrexitrr!rIrJr~rr|rr)rrr+r]dirnamerbgetcwdrrZ NoDefaultRootrVrxrW idlelib.runr rK__file__Z wm_iconbitmapZisAquaTk TkVersionZ wm_iconphotorrrrGZsetupApprrrhnewrHdictrlowerr^rrenvironrr_r$rr'r5ZtkVersionWarningrZpreferTabsPreferenceWarningZ inversedictrZdestroy)rrrrZ enable_shellZ enable_editr`cmdZscriptZstartupZoptsrOr6oarZpathxr&dirZ edit_startr rZsizesZ iconfilesZiconsrLZtkversionwarningZprefer_tabs_preference_warningr(rr)rzs$                                    rF)NN)Rrrrr ImportErrorr rrErZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr"r#rrrVrxrWrr ryr0r r3rIZos.pathrrrrtextwraprrrr(r-Zidlelib.colorizerrZidlelib.configrrrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorrreofrr NameErrorr r*r,r0 checkcacher:r;rrrZ RPCClientrrrrrrrr(r(r(r)s                    ?0s 66