==ٸddlZedk(rejdejd< ddlejdk(r dd l m Z e dd lm Z dd l m Z ddlZddlZddlZddlZdd lmZddlZddlZddlZdd lmZddlZddlZddlZddlZddlmZddlmZddl m!Z!ddl"m#Z#ddl"m$Z$ddl%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl"m,Z,ddl"m-Z-ddl.m/Z/m0Z0m1Z1ddl2m3Z3da4dZ5dZ6 dZ7e7e8_7e7e9_7ej a; d5dZe>ddej~fd Z@e@e_?Gd!d"e&ZAGd#d$e)ZBGd%d&eZCGd'd(e3ZDGd)d*e!ZEGd+d,e-jZGd-ZHGd.d/e ZIGd0d1e+ZJd2ZKd3ZLd4ZMedk(reMe>dy#e$redej edwxYw#e:$rYwxYw)6N__main__zidlelib.pyshell)*zJ** IDLE can't import Tkinter. Your Python may not be configured for Tk. **filewin32) fix_win_hidpi) messagebox)InteractiveInterpreter)python_version) TextWrapper)ColorDelegator)idleConf) Delegatordebugger) debugger_r) EditorWindow fixwordbreaks)FileList) OutputWindow)replace)rpc)idle_formatwarning StdInputFile StdOutputFile) UndoDelegatorFz 127.0.0.1zCtrl-D (end-of-file)c |t} |jt||||||jdy#ttf$rYywxYw)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_streamwriterAttributeErrorOSError)messagecategoryfilenamelinenorrs 6/opt/alt/python312/lib64/python3.12/idlelib/pyshell.pyidle_showwarningr)CsW |  %8V$@ A 6 G $   s0;A  A c|r't tjatt_yyttt_dayy)z>Replace warning.showwarning with idle_showwarning, or reverse.N)_warnings_showwarningwarnings showwarningr))captures r(capture_warningsr/VsA ($,$8$8 !#3H  ) ! ,#8H $( ! -Tctj}i}t|D]%}|dd|ddzdk(s|j|||<'|||j |y)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&orig_checkcacher5savekeys r(extended_linecache_checkcacher<es` OOE DE{ r7SX  % #DIH LLr0c`eZdZdZdZgdZddZdZddZddZ d Z d Z d Z d Z d ZdZy)PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscrg|_tj|g||jj d|j |jj d|j |jj d|jjtjjtjd|_|jj |fd}|jj#||jj$r|j'|j)y)N<><>z<>zbreakpoints.lstc2|j|yN)restore_file_breaks)old_hookselfs r(filename_changed_hookz;PyShellEditorWindow.__init__..filename_changed_hooks  $ $ & Jr0) breakpointsr__init__textbindset_breakpoint_eventclear_breakpoint_eventflist open_shellospathjoinruserdirbreakpointPathiofilename_change_hookset_filename_change_hookr&rDcolor_breakpoint_text)rFargsrGs r(rIzPyShellEditorWindow.__init__sd*T* +T-F-FG -t/J/JK . 0E0EF!ggll  "35,077+G+G'+  (()>? 77    $ $ & ""$r0))Cutz<>rmenu_check_cut)Copyz<>rmenu_check_copy)Pastez <>rmenu_check_paste)NNN)zSet Breakpointr@N)zClear BreakpointrANc|jy|r+tj}tj|d}nddd}|jj d|y)z,Turn colorizing of breakpoint text on or offNbreak) foreground backgroundBREAK)rUr CurrentTheme GetHighlightrJ tag_config)rFcolorthemecfgs r(rXz)PyShellEditorWindow.color_breakpoint_textsO 77?  ))+E''w7C!#26C Wc*r0c|j}|jj}|jdd|zd|dzz |jj | |jjjj}|j||y#t $r|jj|YdwxYw#YyxYw)Nrez%d.0r) rJrUr&tag_addrHindex ValueErrorappendrNpyshellinterprset_breakpoint)rFr'rJr&debugs r(rsz"PyShellEditorWindow.set_breakpointsyy77## Wfvov/BC ,    " "6 * JJ&&--66E  6 2  ,    # #F + ,   sB: t,"'')))NN8c>CK#?$#FG0/ +* E 0/ &499&BEJ7; 4$$<Cc(#99&&K &sfC-C! C-D )C>AC>D !C*&C-- C;:C;>DD D E8AE33E8c|jj|jy|jj}|ytj j |jr}t|j5}|j}dddD]I}|j|dzst|t|dzd}|D]}|j|Kyy#1swYYxYw)Nrr)rJr8rUr&rPrQisfilerTrrrevallenrs)rFr&rrrbreakpoint_linenumbersbreakpoint_linenumbers r(rDz'PyShellEditorWindow.restore_file_breaks s  77? 77##    77>>$-- .d))*b +??8c>2-1$s8}Q7G2H-I*1G-++,AB2H /**s ?C((C1cn|j}|jd}|j|}||_y)z3Retrieves all the breakpoints in the current windowreN)rJ tag_rangesranges_to_linenumbersrH)rFrJrangeslinenumber_lists r(rz&PyShellEditorWindow.update_breakpointss1yy)44V<*r0cg}tdt|dD]i}tt||j}tt||dzj}||ksN|j ||dz }||krk|S)Nrr)rangerrxrystringrp)rFrrrnr'ends r(rz)PyShellEditorWindow.ranges_to_linenumbers#s1c&k1-Eve}3345FeF57O2234C3, V$! 3,.  r0cN|jtj|y)z7Extend base method - clear breaks when module is closedN)rr_closerFs r(rzPyShellEditorWindow._close4s  D!r0)TrC)__name__ __module__ __qualname____doc__rI rmenu_specsrXrsrLrMrrrDrrrr0r(r>r>|sE<%(K + $& (&TC"+""r0r>c eZdZdZeZdZddZy)PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNc|jr0|jjj|jSt||_|jr|jj sy|jSrC)rqtopwakeupPyShellbeginrFrzs r(rOzPyShellFileList.open_shellCs\ << LL   # # % || #4=DL||||))+||r0rC)rrrrr>rrqrOrr0r(rr:s>'LGr0rceZdZdZdZdZy)ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcz|jddd|jdddtj|y)NTODOriomarkSYNC)r~rmrrecolorize_mainrs r(rz&ModifiedColorDelegator.recolorize_mainPs0 x0 VUH-&&t,r0cL|jD]}|j|ddy)Nrr)tagdefsr~)rFtags r( removecolorsz#ModifiedColorDelegator.removecolorsUs <- 2r0rc2eZdZdZddZddZfdZxZS)ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markc |jj|ddr|jjy t j ||||y#t$rY$wxYwNz2ModifiedUndoDelegator.undo_event..vsUE7!Cr0)rrvsuper undo_event)rFrzr __class__s @r(rz ModifiedUndoDelegator.undo_eventosN mm** C  / G u %#.DMM ;DMM s AA"rC)rrrrrvrr __classcell__rs@r(rr[sA73 / /r0rceZdZdZddZy)UserInputTaggingDelegatorz.Delegator used to tag user input with "stdin".NcF|d}|jj|||yr)rrvrs r(rvz UserInputTaggingDelegator.inserts" <D UE40r0rC)rrrrrvrr0r(rr}s 81r0rceZdZdZy) MyRPCClientct)z0Override the base class - just re-raise EOFError)EOFErrorrs r( handle_EOFzMyRPCClient.handle_EOFsr0N)rrrrrr0r(rrsr0rcd|xsdd}|t|k\r,t|t|z d\}}||zdz||dzS|ddS)zReturn width long restart line formatted with filename. Fill line with balanced '='s, with any extras and at least one at the beginning. Do not end with a trailing space. z = RESTART: Shellz =rrN)rdivmod)widthr&rdivmods r( restart_linersf +G,B /C C5#c(?Q/Ss7C-c#gY//3Bxr0ceZdZdZdZdZdZdZdZdZ d dZ dZ dZ d Z d Zd!d ZdZd ZdZd ZdZdZdZdZdZd"dZdZdZdZd"dZdZdZdZ dZ!dZ"dZ#dZ$dZ%y)#ModifiedInterpreterc||_tjdj}t j ||d|_d|_t|_ |jjj|_ y)Nr)localsF) tkconsolesysmodules__dict__r rI restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)rFrrs r(rIzModifiedInterpreter.__init__s["Z(11''V<"& '+||'<'<'B'B$r0Nc|j|j|_tj|j|_yrC)rbuild_subprocess_arglist subprocessPopen rpcsubprocrs r(spawn_subprocessz$ModifiedInterpreter.spawn_subprocesss7  " " *&*&C&C&ED #$**4+B+BCr0c|jdk7sJdtjDcgc]}d|z }}tjddddd }d |d }tj g|zd |t |jgzScc}w) Nrz/Socket should have been assigned a port number.z-WmainGeneralzdelete-exitfuncFbool)defaulttypez#__import__('idlelib.run').run.main()-c)rr warnoptionsr GetOption executabler)rFsr del_exitfcommands r(rz,ModifiedInterpreter.build_subprocess_arglists 1  ? = ? " /!TAX /&&vy:K/46C 7 }AF!#tWc$))n&EEE 0s BcDt|jf}tdD])}tj| t ||_n|jy|j jjd|_tdk7rC|j jjtjtjd|j!|j jj#d |j j%|j j+d|j,|j j+d|j,j.|j j+d|j,j0|j j+d|j,j2|j j+d |j,j4|j j+d t6|j j+d ||j9d |j;|j S#t$rYawxYw#t&$r|j)YywxYw)Nrr consolerstdoutstderrrNr4rrTwith_cwd)HOSTrrtimesleeprrpccltr#display_port_binding_errorlistening_sock getsocknamer setsockoptsocket SOL_SOCKET SO_REUSEADDRr settimeoutaccept TimeoutErrordisplay_no_subprocess_errorregisterrrrrrNr4 transfer_pathpoll_subprocess)rFaddris r(start_subprocessz$ModifiedInterpreter.start_subprocesssdii qA JJqM )$/    + + -KK..::+> C  ""--b1  KK    Y7 Wdnn&:&:; Xt~~'<'<= Xt~~'<'<= Wdnn&:&:; [)4 Xt, D) {{C  *   , , . s#I3 J3 J?JJJc(|jr |jSd|_|j}|r tj|j|jj |j |j}|j}d|_|j |jj|j||j|jj!dd|j#d|j#t%|j&||jj)dd|jj+dd|s|j-|r/tj.|j|j1|j2|j4j6_d|_|jS#YxYw#t$r|jYywxYw) NTFrrend-1crrestartleft)rr getdebuggerrclose_subprocess_debuggercloseterminate_subprocessr executingrr'r(r)r+ stop_readlinerJrr!rrmark_set mark_gravity showpromptrestart_subprocess_debuggerload_breakpointsrrrr)rFrr&rtr was_executings r(restart_subprocessz&ModifiedInterpreter.restart_subprocesss ??;;   "  44T[[A  !!#..)) !   KK    H- Hh/ d l7==(;< i2 !!)V4      2 24;; ?  " " $&*&B&B #{{A    , , . sG-,G5-G25HHc@|jjdddiy)Nexecinterrupt_the_serverr)r remotecallrs r(__request_interruptz'ModifiedInterpreter.__request_interrupts v'=r2Fr0c`tj|jjy)N)target) threadingThread'_ModifiedInterpreter__request_interruptstartrs r(interrupt_subprocessz(ModifiedInterpreter.interrupt_subprocesss 8 89??Ar0c|j/|jjj|j |jj j  |jj |jd|j_ d|_y#t$rYOwxYw#t$rYCwxYw)NF) _afteridrrJ after_cancelrr r6r"r7r8rs r(kill_subprocessz#ModifiedInterpreter.kill_subprocesss == $ NN   , ,T]] ;  KK & & , , .  KK    !!##(        s#$B%"B4% B10B14 C?Cc |jj |jjy#t$rYywxYw#t$rYywxYw)z"Make sure subprocess is terminatedN)rkillwaitr#rs r(r7z(ModifiedInterpreter.terminate_subprocess%sQ  OO "  $$&      s A8 AA AAc|r#dg}|jtjntj}|jdj |y)NrbzTif 1: import sys as _sys _sys.path = {!r} del _sys )extendrrQ runcommandformat)rFrrQs r(r+z!ModifiedInterpreter.transfer_path2sA 4D KK !88D fTl  r0cx|j}|y |j|jd}|r|j jd|_|\}}|j j}|dk(r|ytt||nb|dk(r,|j jdrB|jn1|dk(r,d}t||tj t||| |j j#|j jsJ|j j&j)|j j*|j,|_yy#ttt f$r.|j jrYyd}|jY{wxYw#t$$rYwxYw) Ng?)rSOKr EXCEPTION<>ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )r pollresponse active_seqrr#KeyboardInterruptrclosingr@ resetoutputrprintreprgetvarremote_stack_viewerr __stderr__ endexecutingr"rJafter pollintervalr,rN)rFcltresponsehowwhatrerrmsgs r(r,z#ModifiedInterpreter.poll_subprocessAsykk ;  &''d'CH  NN & & ("DO ICnn,,Gd{#$t*73 #>>(()FG,,.Kfd8fd1 ++-~~%% NN//55++T-A-ACDM&9'#45 &~~%%H  # # %  &2"  s)E(-F-(*F*F*)F*- F98F9c||_yrCr)rFrs r( setdebuggerzModifiedInterpreter.setdebuggeris   r0c|jSrCrrs r(r4zModifiedInterpreter.getdebuggerls }}r0cd|jjjd|jy)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)rrJrhrers r(open_remote_stack_viewerz,ModifiedInterpreter.open_remote_stack_vieweros' !!#t'?'?@r0cddlm}|jjdddi}|%|jj j y|j|j|}ddlm }m }t|jj }tj}tj|dd}|||d } | jj!d d || j"d|} | j%y) Nr) debugobj_rrB stackviewer)rN)ScrolledCanvasTreeNodenormalrd)bghighlightthicknessrboth)expandfill)idlelibrur remotequeuerrrwStubObjectTreeItem idlelib.treerwrxToplevelrrfrgframepackcanvasr}) rFruoiditemrwrxrrjrdscnodes r(rez'ModifiedInterpreter.remote_stack_viewer|s&kk%%fmZL ; NN   $ $ & ,,T[[#>9t~~**+%%'**5(;LI CJ1 E  QV , 4. r0rcJ|j|}|j||y)z1Like runsource() but assumes complete exec sourceN) stuffsourceexecfilerFsourcer&s r( execsourcezModifiedInterpreter.execsources ##F+ h'r0c|]tj|5}|j}tr)dtj j |d|zdz}ddd t||d}|j|y#1swY)xYw#ttf$rn|jjtd|jjtj |||jj#YywxYw)zExecute an existing fileNz__file__ = r'''z''' z del __file__rBzB*** Error in script or command! Traceback (most recent call last):r)tokenizerreaduse_subprocessrPrQabspathrruncode OverflowError SyntaxErrorrrarbrr showsyntaxerrorr<)rFr&rrcodes r(rzModifiedInterpreter.execfiles >x(B! /0I/J%P &')9:F) 68V4D LL )({+ ( NN & & ( 6~~,, . # 2 24 B NN % % '  (sAB! B B  A:D D cv|j|}t|tsJtj|||S)zBExtend base class method: Stuff the source in the line cache first)r isinstancerr runsourcers r(rzModifiedInterpreter.runsources9##F+&#&&&&//fhGGr0cd|jz}|jdz|_|jd}t|dzd||ftj|<|S)z"Stuff source in the filename cachez rrr)gidsplitrr4r5)rFrr&rs r(rzModifiedInterpreter.stuffsourcesQ!DHH,88a< T"$'KM1eX$E !r0cD|jdj|y)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)rVrWrFr&s r(prepend_syspathz#ModifiedInterpreter.prepend_syspaths &" $r0c |j}|j}|jdddtj\}}}t |ddxs|xsd}t |ddxsd} t |d dxsd } | d k(r| dz } | dk(r d | dz z} n d | dz | dz fz} |j || |j|jd |z|jy)zOverride Interactive Interpreter method: Use Colorizing Color the offending position instead of printing it and pointing at it with a caret. r\rrmsgrbzr'roffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s N) rrJr~rexc_inforcolorize_syntax_errorrar!r<) rFr&kwargsrrJr valuetbrr'rposs r(rz#ModifiedInterpreter.showsyntaxerrorsNN ~~ .,,.eReUB'K5K4K"-2"-2 Q; aKF Q;%2C:!8VAX&'C''c2 &,-r0c|jj|jtj||jj dr|jj yy)z1Extend base class method to reset output properlyr[N)rrachecklinecacher showtracebackrdopen_stack_viewerrs r(rz!ModifiedInterpreter.showtracebacksU ""$ ,,T2 >> !> ? NN , , . @r0chtj}t|D]}|dd|ddzdk7s||=y)z%Remove keys other than ''.Nrr2r3)r4r5r6)rFr5r;s r(rz"ModifiedInterpreter.checklinecaches9;C2AwRS!T)#Jr0c|jjr|jy|jr |jj dd|fiyt ||j y)z*Run the code without invoking the debuggerrrBrr)rr8display_executing_dialogrrrBr)rFrs r(rVzModifiedInterpreter.runcommandsY >> # #  ) ) + ;; KK # #FIw C t{{ #r0c|jjr|j|j|j} |jj |s1|j %|j jdd|fi|_n6|r|j||jnt||jt$s |jj+yy#t$rY|jjs?tjddd|jj r|j#nYt$rLt'd|jj( |j#|jj+nY|jj,r3d |j_t'd |jj( n|j#Y3xYw#t.$rYywxYw#t$s+ |jj+w#t.$rYwwxYwwxYw) Override base class methodNrBrzExit?zDo you want to exit altogether?yesr rz IDLE internal error in runcode()rFr_)rr8r@rrbeginexecutingr asyncqueuer^runrrB SystemExitr`r askyesnorJrrrbrrgcanceledr")rFrrs r(rzModifiedInterpreter.runcodes >> # #  # # % ==&  NN ) ) + 7"&++"8"89=#E T4;;/T4;;'4"NN//1"3 >>))&&5!>>.. 0 &&() )8>>002""$++->>**.3DNN+-DNN4I4IJ&&( &"NN//1%"s]BC*G=*AG: H B,G:7H = H H  H?H/.H?/ H;8H?:H;;H?cL|jjj|S)r)rrr!)rFrs r(r!zModifiedInterpreter.write(s~~$$**1--r0c\tjdd|jjy)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.rr rrrJrs r(rz.ModifiedInterpreter.display_port_binding_error,s'  / >>&& (r0c\tjdd|jjy)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-failurerrrs r(r)z/ModifiedInterpreter.display_no_subprocess_error7s( ) J>>&&  (r0c\tjdd|jjy)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rrrs r(rz,ModifiedInterpreter.display_executing_dialog?s%  0>>&&  (r0)Frb)FrC)&rrrrIrNrrrrr/r@rJrLrPr7r+r^r,rrpr4rsrerrrrrrrrrrVrr!rr)rrr0r(rrsCH FJD F)V*XGB   J$CLH! " C( (H $4/ ,\. (((r0rc PeZdZddlmZdezZeZe Z gdZ e jdgzZ deeej"de zZe j'ed[d Zd Zdd lmZdd lmZd9d ZfdZfdZdZdZdZd9dZ d Z!d Z"d Z#d Z$d Z%d Z&dZ'dZ(d9dZ)dZ*d9dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2d Z3d!Z4d"Z5d#Z6d$Z7d%Z8d&Z9d9d'Z:d(Z;d)Ze?jd,ZAd-ZBd9d.ZCd9d/ZDd9d0ZEd1ZFd2ZGd3ZHd:d4ZIfd5ZJfd6ZKd9d7ZLd8ZMxZNS);rr)Squeezerz IDLE Shell ))r_File)edit_Edit)rt_Debug)options_Options)window_Window)help_Help)Squeeze<>rc|ddk7S)Nrr\r) rmenu_items r(rzPyShell._s :a=F2r0)zCopy with prompts<>r]Fr)History) ShellSidebarctr)|j}|dddk7r|jddt||_|0t }t ||jt|}d|_ tj||ddd|_ d|_ ttdrtj nd|_|j"j%d d |_|j"|_|j*}|j-d |j/d |j0|j/d|j2|j/d|j4|j/d|j6|j/d|j8|j/d|j:|j/d|j<|j/d|j>tr8|j/d|j@|j/d|jB|jE||_#|j/d|jHtjJ|_&tjN|_(tjR|_*ddl+m,}t[|d|j\|j^|_)ta|d|j\|j^|_%ta|d|j\d|_'ta|d|j\|j^|_1ts?|jJt_%|jNt_'|jRt_) ddl2}|jf|_4|jm|j*|_7d|_8|js||_ |jtjvj|j*_|jtjyt{y#tjjt_'xYw)Nrrshell)rShe_llFps1z>>> rr2char)wrapz<>z<>z<>z<>z<><>r[rz<>z<>r)iomenurrrbackslashreplacer2)>r menu_specsrvrrrTkrwithdrawr shell_sidebarrrIusetabs indentwidthhasattrrrsys_ps1rprompt_last_linepromptrJ configurerKenter_callbacklinefeed_callbackcancel_callback eof_callbackrtoggle_debuggertoggle_jit_stack_viewercopy_with_prompts_callbackview_restart_mark restart_shellrsqueezersqueeze_current_text_eventr save_stdoutr save_stderrr save_stdinrrrencodingerrorsrrpydoc plainpagerpagerrfrhistoryrirperr insertfilterr)rFrNmsrrJrrs r(rIzPyShell.__init__ms* B!uQx7" !01)$/ =4D $  MMO#D)E!dE46 ")#u"5sww7 $ 2 24 8 <ll yy F# *D,?,?@ 0$2H2HI +T-A-AB #T%6%67 )4+A+AB ')=)=> /1M1MN )4+J+JK  II($*@*@ A II)4+=+= > d+  ,11 3::::))"!$"(//6==B #D($*OOV]]D #D($*OO5GI $T9%+__fmmE CJCJ CI  **EK ||DII. !..t4  88<<..  79: CJ s P**Qcpt||j|jjyyrC)r ResetFontr update_fontrFrs r(rzPyShell.ResetFonts1     )    * * , *r0ct|tj}dddtj|dtj|dtj|dd}|j D]"\}}|j j|fi|$|j|jjyy)N)rdrcrrry)rrrr) rResetColorizerrrfrgitemsrJ tag_configurer update_colors)rFrj tag_colorsrtag_colors_configrs r(r zPyShell.ResetColorizers  %%'"&d;))%:))%:**5(;  '1&6&6&8 "C" #DII # #C =+< ='9    )    , , . *r0cFtj|jdy)Nr) insert_tagsra)rrJrs r( replace_eventzPyShell.replace_events w7r0c.tjdS)NT) shell_only)r GetExtensionsrs r(get_standard_extension_namesz$PyShell.get_standard_extension_namess%%66r0cn|jj||}ttt |tt |}|Dcgc]'}|j j j|)}}djdt||jDdzScc}w)z6Return text between first and last with prompts added.rc38K|]\}}||n|d|yw)N r).0rrs r( z*PyShell.get_prompt_text..s0 ? ND6(!D6(: : ?s) rJgetrrxryr line_promptsrRzip splitlines)rFfirstlastrJ lineno_ranger'promptss r(get_prompt_textzPyShell.get_prompt_textsyy}}UD) e  d  ' &    + + / / 7&  yy #GT__-> ?      s,B2c|j}|jd}|y|jd}|ddk7r|jd}|j|j||}|j |y)aCopy selected lines to the clipboard, with prompts. This makes the copied text useful for doc-tests and interactive shell code examples. This always copies entire lines, even if only part of the first and/or last lines is selected. zsel.first linestartNsel.lastr20zsel.last+1line linestart)rJrnclipboard_clearr#clipboard_append)rFrzrJselfirstsellast prompt_texts r(rz"PyShell.copy_with_prompts_callbackszyy::34   **Z( 2;# jj!;>  !2<yy "  ' ' )((*B##%""$r0c`|jj}|jd| y)Nr)rrr4setvarrFr6s r(r3zPyShell.set_debugger_indicators' [[ $ $ & )2v:6r0cyrCrrs r(rzPyShell.toggle_jit_stack_viewers r0c|jj}|r|jjd|j|jjr)t j |jj|j|jjd|j|_ |j|jy)Nz [DEBUG OFF] )rrr4rpr6rrclose_remote_debuggerrarr!rrr<r3r9s r(r4zPyShell.close_debugger s [[ $ $ & KK # #D ) HHJ{{!!001C1CD     LL   /,,DK OO  ##%r0cn|jjr+tj|jj|}nt j |}|jj ||jd|jz|_ |j|jy)Nz [DEBUG ON] ) rrrrstart_remote_debuggerrDebuggerrpr>rrr<r3)rFdbg_guis r(r5zPyShell.open_debugger-s ;;   66t{{7I7I;?AG''-G (  "$t||3   ##%r0cJ|jrdnd}|jdd|y)Ndisabledryrtz *tack*iewer)r8update_menu_state)rFstates r(debug_menu_postcommandzPyShell.debug_menu_postcommand9s!"nn ( w u=r0c2|jd|_y)Helper for ModifiedInterpreterTN)rar8rs r(rzPyShell.beginexecuting=s r0c@d|_d|_|jy)rGFN)r8rr<rs r(rgzPyShell.endexecutingBs  r0c|jr(tjddd|j}|dury|j d|_d|_tj|S)zExtend EditorWindow.close()zKill?z7Your program is still running! Do you want to kill it?okrFcancelT) r8r askokcancelrJr9rr`rr6)rFrks r(r6z PyShell.closeHsa >>!--Jyy "H 5    !!$''r0cX|jtr|jj|jt _|jt _|jt _ d|_d|_ d|j_ d|_tj |y)zEExtend EditorWindow._close(), shut down debugger and execution serverN)r4rrrrPrrrrrrrrrNrqrrrrs r(rzPyShell._closeWsu   KK ' ' )%% %% OO   !  D!r0cy)z8Override EditorWindow method: never remove the colorizerTrrs r(ispythonsourcezPyShell.ispythonsourcegsr0c|jSrC) shell_titlers r( short_titlezPyShell.short_titleksr0z>Enter "help" below or click "Help" above for more information.c |jjdd|jtr/d}|jj }|s,|j yd}tjt_|jdtjdtjd|jd||jj|jd dl}d |_d|_y ) NrrvrbFz==== 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 z on rrT)rJr:rarrrr/r6r displayhookrr!versionplatform SPLASHLINE focus_forcer<tkinter_support_default_root _default_root)rFnosubclientrYs r(rz PyShell.beginps 8X.  E[[113F 'E"ooCO KKtG H  (,% $r0c`|jsyd|_|jjyNT)reading_stop_readline_flagrquitrs r(r9zPyShell.stop_readlines!|| #'   r0c|j} d|_|jj||_|jrd|_y|jj dd}t |dk(rd}|j|jrd|_tst|jr d|_ d}|S#||_wxYw)NTFrbrr1rr) r`rmainlooprarJrrrarrr_ endoffile)rFr:rs r(readlinezPyShell.readlines|| DL HH   DL  # #',D $yy}}Xx0 t9>D  ==!DM!'' >>"DND  DLs !B<< Ccyr_rrs r(isattyzPyShell.isattysr0cD |jjdddry |jsH|js<|j |j j d|jyd|_d|_ |jre|j jrO|j jr|j jn|j j|jr|jjy#YxYw)N sel.firstz!=r%zKeyboardInterrupt raFT)rJrr8r`rarrr!r<rerrr4r@rLrrbrs r(rzPyShell.cancel_callbacks yy  dJ?@$,,     KK  3 4 OO  NNt{{11{{&&( ..0 002 << HHMMO!  s DDcV|jr |jsy|jjdddr|jjdddsy|js!|j |j yd|_d|_|jjy)Nrz==rvr1FTra) r8r`rJrrar6rrerrbrs r(rzPyShell.eof_callbacks >>$,,  !!(D(; !!(D(; ~~     JJL "DM!DN HHMMOr0c|jr8|jjdd|jjdy|j |y)Nrvrra)r`rJrvseenewline_and_indent_eventrs r(rzPyShell.linefeed_callbacksE << II  Xt , IIMM( #  ) )% 0r0cr |jr |jsy |jjdd}|r0|jj dddr|j ||y|jj dddr|jj d d}|r#|jj dd|d rd |jjdvr|jj d d}|r-|jj |d d |d r |d |d f}|jjd d}|rI|jj |d d|d r&|d |jj|d dzf}|j |jj|d |d |y|jjd d}|r|jj dd |d r|jjd d}|rI|jj |d d|d r&|d |jj|d dzf}|j |jj|d |d |y|jjd d}|rP|jj |d ddr0|j |jj|d d|y|j |jjdd|y|jj dddr|jjdd|jjdd}|r,|js|jjdd|jj dddr|j|y|jjdd|jr8|jjdd|jjdn|j||jj!|jr|j"j%y|j'y#YMxYw)Nrjr%z<=rrarvriomark linestartrrrz>=rz+1czinsert lineendr|r1zend-1c linestartr)r8r`rJrrrecall tag_prevrange tag_names tag_nextrangernr:striprrnrvrmupdate_idletasksrrbrunit) rFrzselprev prev_cons next_consnextindicesrs r(rzPyShell.enter_callbacks >>$,,  ))-- Z8C99$$Zx@KKU+" 99  Xs,> ? 99**7H=DII%%hT!W=TYY%8%8%BB II33IxH !2!29Q<tAw!O%aL$q'2D II33IxH !2!29Q<d1g!N GTYY__Yq\E5I%JKD DIIMM$q'47;UC99**7H=D ))*:D$q'J II33I?OP !2!29Q<d1g!N GTYY__Yq\E5I%JKD DIIMM$q'47;UCii--i9KLGyy  T3EF DIIMM'!*6FGO DIIMM*<>NOQVW 99  XsH 5 II  x 2 IIMM(H - QWWY II  Xx 0 99  Xs,> ?  ) )% 0 8X. << II  Xt , IIMM( #  ) )% 0 ""$ << HHMMO JJLE  s A R11R6ctjdd|}tjdd|}|jd}|jj  |jj ddd|jj dd |jjd d}|jjd r-|j||jjd d}|jjd|d j|jt|d kDrtjd|d j!d }tjd|j!d }|d dD]\}|j#|r||t|dz}|jjdd|jz|j^|jj%d|jj'y#|jj%d|jj'wxYw)Nz^\s*\nrbz\n\s*$rrxrrrvr1r|:rrz ^([ \t]*))resubrrJundo_block_startr~r:rrstripendswithrnrvruuser_input_insert_tagsrsearchgrouprrmundo_block_stop)rFrrzrprefixorig_base_indentnew_base_indentrs r(rqzPyShell.recall's FF9b! $ FF9b! $  ""$ ( II u 5 II  x 2YY]]#5x@F}}'',--e4'98D II  XuQx~~'7!88 :5zA~#%99\58#D#J#J1#M #%99\6#B#H#H#K!!"ID'78.c:J6K6L1MMII$$Xtdkkm/C%)%@%@B & IIMM( # II % % ' IIMM( # II % % 's FH))7I z[ \t]*(\n[ \t]*)?\Zc|jjd}|jjdd}|jj d|}|j j |}|s_|jj|dk(r&|jj|j||jjyy)Nend-2crr1rbr) rJrnr_last_newline_rerrrrr~rrupdate_sidebar)rF index_beforerinput_is_completes r(rwz PyShell.runitDsyyx0 yy}}Xx0$$((T2 KK11$7 yy}}\*d2 $$T%@%@,O    - - /!r0c|jjr|jjSddlm} ||j t j|jy#tjdd|jYyxYw)Nr) StackBrowserzNo stack tracez:There is no stack trace yet. (sys.last_exc is not defined)r) rrrreidlelib.stackviewerrrrlast_excrNr rrJ)rFrzrs r(rzPyShell.open_stack_viewerPsp ;;  ;;224 44 " CLL$** =   "  !10yy "s ,A%%$B cp|jjd|jjdy)Nrr2)rJrmrs r(rzPyShell.view_restart_mark^s" h i r0c<|jjdy)z&Callback for Run/Restart Shell Cntl-F6TrN)rrr@rs r(rzPyShell.restart_shellbs &&&5r0c|j|j}|jr4|j|jr|dt |j }|j j dd|jj||jj|j jdd|j|jjy)Nrz iomark-1crvr1)rarrrrrJrmrr!rrr:set_line_and_columnrU reset_undo)rFrs r(r<zPyShell.showpromptfs  <  ("  RJ4 ., M^(8"rzz"89 0 !6 J* )+ ,,r0rc ~|jdk(r.dD](}|j|dd|j|dz*yy)z6Make paste replace selection on x11. See issue #5124.x11)TextEntrySpinboxz <>z%catch {%W delete sel.first sel.last} N)_windowingsystem bind_class)rclss r( fix_x11_pastersG %-C OO8[9: ;.&r0a 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 ddl}ddlm}ddlm}ddlm}t ddad}d}d}d}d}d} |jtjddd\} }  D]\} }| d k(r|}d}| dk(rd}d}| dk(rd}| dk(r7tjj!ttj| dk(rd}| dk(rtdtj da| dk(rD|}t"j$j'|rn td|tjd}| dk(rd} d}| dk(s|t(_d} r(| ddk(r tj,j/}d}t1t3tj$D]C}t"j$j5tj$|tj$|<E| r| ddk(rdg| ddzt_ n|rd g| zt_ n|r|g| zt_ n| rd}g}| D]0}|j7t"j$j9|2|D]T}t"j$j5|}|tj$vs5tj$j;d|VnFt#j<}|tj$vr tj$j;d|t?j@dddd}|xs|}|xs| }tr |s tCtEd a#tFjIdd!l%m&}|tFt"j$jOt"j$j9tPd"}|d#k(r7t"j$jO|d$}tFjS|%n|jUsxtVd&k\rd'}d(}nd)}d*}|Dcgc]'}t"j$jO|d+||fz)}}|Dcgc]}tYtF|,}}tGjZdg|t]tFt_tFtatFa1|jetFtb|rK|sI|sG| ddD])}tbjg|| ji|+| stbjk|rRtbjm}|sy|jUr;tbjnr+|jpjsntbjt}|r|jw| r|t"jxj{d-xst"jxj{d.}|r:t"j$j'|r|j|j||s|r|j|jd/jtj|r|j|j|n^|r\|j|j||j|j|n%|r#|j}|r|j|tbjr%tFjtbjr%tFjt dy#|j$rE} td | d ttj tjd Yd} ~ d} ~ wwxYwcc}wcc}w)0Nr)system)testing)macosxTFrz c:deihnr:st:zError: rrrr z-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t-rbrrzeditor-on-startupr)r Idle) className) fix_scalingIconsWindowszidle.ico)r g333333!@z.png) 0z.gif)rrrz idle_%d%s)masterr IDLESTARTUP PYTHONSTARTUPzdif 1: import sys as _sys _sys.argv = {!r} del _sys )IgetoptrVrrrrr/rrargverrorrb usage_msgrexitrr!rPrQrrrQrrrrrrpdirnamervgetcwdrr NoDefaultRootrrr idlelib.runrrR__file__ wm_iconbitmapisAquaTk TkVersion PhotoImage wm_iconphotorrrrNsetupApprr}newrOdictrlowerrqr5environrrrrrVrWrrpreferTabsPreferenceWarningr inversedictrddestroy)rrrr enable_shell enable_editrtcmdscriptstartupoptsrYroar.pathxr&dir edit_startricondiriconfileextsizessize iconfilesiconsrprefer_tabs_preference_warnings r(rrsTNLK E C FG]]388AB<@ d1 9CL 9EL 9K 9 JJ  Y ' HHJ 9L 9 Nzz #"N 9Fww~~f%(&1 L 9GL 9"#G L?@ Q3iinn 3sxx= !ggoochhqk2 " Q34$qr(? 6D= 8d?  H LL2 3C''//#&C#((?3' iik chh  HHOOAs ###FI$7fFJ+K2{?Lg  DMMO'ggll277??84g>G x977<<4 8, __   C%EC E!&(!&WW\\';$+DE!& ("+,!*X4h7!* , $''$$ D !E OOD% v G::h'/KK)$   "  ??  IIOO    ::>>-03::>>/2  x0 LL ! !( + f !&"  $  LL # #C (  LL ( ( 0 LL ! !& ) *0)K)K)M& )   = >       LLNUy << uByk*<  n(,s#&[;,]6];] :]  ])NN)NrrrrY ImportErrorrbrfrrV idlelib.utilr r rr rr4rPos.pathr rr#rtextwrapr rHrrr,idlelib.colorizerridlelib.configridlelib.delegatorrrrridlelib.editorrridlelib.filelistridlelib.outwinrrrrrrr idlelib.undorrrreofrrb NameErrorr r)r+r/ checkcacher<r>rrrr RPCClientrrrrrrrrr0r(r s  z%([[%B " )+/2;2F2F(5 {",{"|h( 2^ 2/M/D1 1#-- k(0k(\ _ ,l_ ,D;4  lnb zFk4  9?B~~O Q-b  sF(!G ("G  GG