• File: pyshell.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/pyshell.cpython-37.opt-1.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 41.26 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Nj
@sddlZedkr ejdejd<yddlTWn*ek
rVedejdedYnXejdkry ddl	Z	dZ
e	d	e
Wnee
efk
rYnXddlmZed
kreatddlmZetejdd
etdedddlmZddlZddlZddlZddlmZddlZddl Z ddl!Z!ddl"m#Z#ddl$Z$ddl%Z%ddl&Z&ddl'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl,m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl,m6Z6ddlm7Z7m8Z8m9Z9ddl:m;Z;dZ<dZ=eja>d:ddZ?da@dd ZAeAd!dejBfd"d#ZCeCe_BGd$d%d%e0ZDGd&d'd'e3ZEGd(d)d)e)ZFGd*d+d+e;ZGGd,d-d-e6jHZId.d/ZJGd0d1d1eZKGd2d3d3e5ZLd4d5ZMd6ZNd7d8ZOedkreOeAd9dS);N__main__zidlelib.pyshell)*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **)fileZwin32Zshcoreg!@)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_formatwarningStdInputFile
StdOutputFile)
UndoDelegatorz	127.0.0.1c	CsP|dkrt}y&|t|||||d|dWnttfk
rJYnXdS)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)messagecategoryfilenamelinenorrr!4/opt/alt/python37/lib64/python3.7/idlelib/pyshell.pyidle_showwarningEsr#cCs0|rtdkr,tjatt_ntdk	r,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)_warnings_showwarningwarningsshowwarningr#)Zcapturer!r!r"capture_warningsXsr'TcCs\tj}i}x:t|D].}|dd|dddkr||||<qW||||dS)aoExtend linecache.checkcache to preserve the <pyshell#...> entries

    Rather than repeating the linecache code, patch it to save the
    <pyshell#...> 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.
    Nrz<>)	linecachecachelistpopupdate)rZorig_checkcacher*savekeyr!r!r"extended_linecache_checkcachegsr0c@s~eZdZdZddZdddddd	gZd ddZd
dZd!ddZd"ddZ	ddZ
ddZddZddZ
ddZddZdS)#PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGsg|_tj|f||jd|j|jd|j|jd|jjt	j
tj
d|_|jj|fdd}|j||jjr||dS)Nz<<set-breakpoint-here>>z<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs||dS)N)restore_file_breaks)Zold_hookselfr!r!r"filename_changed_hooksz;PyShellEditorWindow.__init__.<locals>.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__)ZCutz<<cut>>rmenu_check_cut)ZCopyz<<copy>>Zrmenu_check_copy)ZPastez	<<paste>>rmenu_check_paste)NNN)zSet Breakpointz<<set-breakpoint-here>>N)zClear Breakpointz<<clear-breakpoint-here>>NTcCsD|jdkrdS|r(t}t|d}n
ddd}|jd|dS)z,Turn colorizing of breakpoint text on or offNbreak)
foreground
backgroundBREAK)rArCurrentThemeGetHighlightr7Z
tag_config)r3ZcolorthemeZcfgr!r!r"rBs

z)PyShellEditorWindow.color_breakpoint_textcCs|j}|jj}|dd|d|dy|j|Wn tk
rX|j|YnXy|jj	j
j}|||WnYnXdS)NrJz%d.0r)
r7rArtag_addr5index
ValueErrorappendr;pyshellinterpr
r9)r3r r7rdebugr!r!r"set_breakpointsz"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s|dStt|d}||dS)Ninsert)r7rArbellintfloatrOrU)r3eventr7rr r!r!r"r9sz'PyShellEditorWindow.set_breakpoint_herecCs|j}|jj}|s|dStt|d}y|j|WnYnX|	dddy|j
jjj
}|||WnYnXdS)NrVrJzinsert linestartzinsert lineend +1char)r7rArrWrXrYrOr5remove
tag_remover;rRrSr
r:)r3rZr7rr rTr!r!r"r:s"z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$|dSg|_|ddty|jjj	j
}||WnYnXdS)NrJz1.0)r5r7rArrWr\ZENDr;rRrSr
clear_file_breaks)r3r7rrTr!r!r"r]sz%PyShellEditorWindow.clear_file_breaksc
Cs|j}|jj}y$t|jd}|}WdQRXWntk
rJg}YnXynt|jdX}x$|D]}||dsb||qbW|	|j}|r||dt
|dWdQRXWnTtk
r}z4t|jddsd|j_
tjd	d
t
||jdWdd}~XYnXdS)z#Save breakpoints when file is savedrNw=
breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)titlerr)r5rAropenr@	readlinesr
startswithrupdate_breakpointsstrgetattrrootrbtkMessageBox	showerrorr7)r3ZbreaksrfplinesZnew_filererrr!r!r"store_file_breakss.

(z%PyShellEditorWindow.store_file_breaksc	Cs|j|jdkrdS|jj}|dkr,dStj|jrt|jd}|	}WdQRXxJ|D]B}|
|dr`t|t|dd}x|D]}|
|qWq`WdS)Nr^r`r)r7r-rArr=r>isfiler@rdrerfevallenrU)r3rrmrnrZbreakpoint_linenumbersZbreakpoint_linenumberr!r!r"r2
s



z'PyShellEditorWindow.restore_file_breakscCs$|j}|d}||}||_dS)z3Retrieves all the breakpoints in the current windowrJN)r7Z
tag_rangesranges_to_linenumbersr5)r3r7rangesZlinenumber_listr!r!r"rgs

z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|dD]L}tt||j}tt||dj}x||kr`|||d7}qDWqW|S)Nrr)rangersrXrYstringrQ)r3rurnrOr endr!r!r"rt%s

z)PyShellEditorWindow.ranges_to_linenumberscCs|t|dS)z7Extend base method - clear breaks when module is closedN)r]r_close)r3r!r!r"rz6szPyShellEditorWindow._close)T)N)N)__name__
__module____qualname____doc__r6rmenu_specsrBrUr9r:r]rpr2rgrtrzr!r!r!r"r1~s$

	
*r1c@s"eZdZdZeZdZdddZdS)PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jjnt||_|jr2|js2dS|jS)N)rRtopwakeupPyShellbegin)r3rZr!r!r"r<Es

zPyShellFileList.open_shell)N)r{r|r}r~r1rrRr<r!r!r!r"r<src@s0eZdZdZddZddZddZdd	Zd
S)ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst||dS)N)rr6LoadTagDefs)r3r!r!r"r6Ss
zModifiedColorDelegator.__init__cCs*|ddd|dddt|dS)NZTODOz1.0iomarkZSYNC)r\rNrrecolorize_main)r3r!r!r"rWsz&ModifiedColorDelegator.recolorize_mainc	CsJt|t}|jdddt|dt|dt|dddS)N)rIrHstdoutstderrconsole)stdinrrr)rrrrKtagdefsr-rL)r3rMr!r!r"r\s


z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}||ddqWdS)Nrry)rr\)r3tagr!r!r"removecolorsfsz#ModifiedColorDelegator.removecolorsN)r{r|r}r~r6rrrr!r!r!r"rPs

rc@s$eZdZdZdddZdddZdS)	ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNcCsLy"|j|ddr |jdSWntk
r6YnXt||||dS)N<r)delegatecomparerWTclErrorrrV)r3rOcharstagsr!r!r"rVns
zModifiedUndoDelegator.insertcCsJy"|j|ddr |jdSWntk
r6YnXt|||dS)Nrr)rrrWrrdelete)r3Zindex1Zindex2r!r!r"rws
zModifiedUndoDelegator.delete)N)N)r{r|r}r~rVrr!r!r!r"rks
	rc@seZdZddZdS)MyRPCClientcCstdS)z0Override the base class - just re-raise EOFErrorN)EOFError)r3r!r!r"
handle_EOFszMyRPCClient.handle_EOFN)r{r|r}rr!r!r!r"rsrcCs^d|pdd}|t|krNt|t|d\}}||d||dS|ddSdS)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: ZShellz =rvr`N)rsdivmod)widthrrZdivmodr!r!r"restart_lines
rc@seZdZddZdZdZdZddZddZdd	Z	d?dd
Z
ddZddZddZ
ddZd@ddZdZddZdZddZddZddZd d!Zd"Zd#d$ZdAd%d&Zd'd(Zd)d*Zd+d,ZdBd-d.Zd/d0Zd1d2Zd3d4Z d5d6Z!d7d8Z"d9d:Z#d;d<Z$d=d>Z%dS)CModifiedInterpretercCsB||_tjdj}tj||dd|_d|_t|_	|j
jj|_
dS)Nr)localsF)	tkconsolesysmodules__dict__rr6
restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)r3rrr!r!r"r6szModifiedInterpreter.__init__NcCs&|jdkr||_t|j|_dS)N)rbuild_subprocess_arglist
subprocessPopen
rpcsubproc)r3r!r!r"spawn_subprocesss

z$ModifiedInterpreter.spawn_subprocesscCsJddtjD}tjdddddd}d	|f}tjg|d
|t|jgS)NcSsg|]}d|qS)z-Wr!).0sr!r!r"
<listcomp>sz@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>mainGeneralzdelete-exitfuncFbool)defaulttypez&__import__('idlelib.run').run.main(%r)z-c)rwarnoptionsr	GetOption
executablerhr)r3r_Z	del_exitfZcommandr!r!r"rs



z,ModifiedInterpreter.build_subprocess_arglistc	CsZt|jf}xLtdD]4}t|yt||_PWqtk
rFYqXqW|dS|jj	
d|_tdkr|jj	t
jt
jd||jj	dy|jWnt
jk
r|dSX|jd|j|jd|jj|jd|jj|jd|jj|jd	|jj|jd
t|jd||jdd
||jS)Nrr
rrrrr;r)rST)with_cwd)HOSTrrwtimeZsleeprrpccltrdisplay_port_binding_errorlistening_sockZgetsocknamerZ
setsockoptsocketZ
SOL_SOCKETZSO_REUSEADDRrZ
settimeoutaccepttimeoutdisplay_no_subprocess_errorregisterrrrrr;r)
transfer_pathpoll_subprocess)r3Zaddrir!r!r"start_subprocesss>




z$ModifiedInterpreter.start_subprocessFrGcCs0|jr|jSd|_|}|r<yt|jWnYnX|j||j}|j}d|_|	y|j
Wntjk
r|
dSX|j|d||jdd|d|t|j||jdd|jdd|s||rt|j||j|jj_d|_|jS)	NTF)rrzend-1crarestartleft)rrgetdebuggerrZclose_subprocess_debuggercloseterminate_subprocessr	executingrrrrrr
stop_readliner7rrrrmark_setmark_gravity
showpromptZrestart_subprocess_debuggerload_breakpointsrrrr)r3rrrTrZ
was_executingr!r!r"restart_subprocesssF

z&ModifiedInterpreter.restart_subprocesscCs|jdddidS)NexecZinterrupt_the_serverr!)rZ
remotecall)r3r!r!r"Z__request_interruptsz'ModifiedInterpreter.__request_interruptcCstj|jddS)N)target)	threadingZThread'_ModifiedInterpreter__request_interruptstart)r3r!r!r"interrupt_subprocesssz(ModifiedInterpreter.interrupt_subprocesscCs~|jdk	r|jj|jy|jjWntk
r>YnXy|jWntk
rbYnX|d|j_	d|_dS)NF)
_afteridrr7Zafter_cancelrrrrrr)r3r!r!r"kill_subprocesss
z#ModifiedInterpreter.kill_subprocesscCsLy|jWntk
r"dSXy|jWntk
rFdSXdS)z"Make sure subprocess is terminatedN)rkillrwait)r3r!r!r"r!sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|tjntj}|d|fdS)NrGzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)extendrr>
runcommand)r3rr>r!r!r"r.sz!ModifiedInterpreter.transfer_pathc
Cs6|j}|dkrdSy|j|jdd}Wn2tttfk
rX|jjrHdSd}|YnX|r|j	d|_|\}}|jj
}|dkr|dk	rtt||dnH|dkr|j
dr|n*|dkrd}t||tjdt|||dy|jWntk
rYnX|jjs2|jj|jj|j|_dS)	Ng?)rZOK)rZ	EXCEPTIONz<<toggle-jit-stack-viewer>>ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR:
)rZpollresponse
active_seqrrKeyboardInterruptrclosingrresetoutputrprintreprgetvarremote_stack_viewerr
__stderr__endexecutingrr7afterpollintervalrr)r3ZcltresponseZhowZwhatrerrmsgr!r!r"r=s@


z#ModifiedInterpreter.poll_subprocesscCs
||_dS)N)r
)r3r
r!r!r"setdebuggereszModifiedInterpreter.setdebuggercCs|jS)N)r
)r3r!r!r"rhszModifiedInterpreter.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)rr7rr)r3r!r!r"open_remote_stack_viewerks
z,ModifiedInterpreter.open_remote_stack_viewercCsddlm}|jdddi}|dkr6|jjdS||j|}ddlm	}m
}t|jj}t
}t|dd}|||dd	}	|	jjd
dd||	jd|}
|
dS)
Nr)
debugobj_rrZstackviewer)r;)ScrolledCanvasTreeNodeZnormalrI)ZbgZhighlightthicknessrZboth)expandZfill)idlelibrrremotequeuerrjrWZStubObjectTreeItemZidlelib.treerrZToplevelrrKrLframeZpackZcanvasr)r3rZoiditemrrrrMrIZscZnoder!r!r"rxsz'ModifiedInterpreter.remote_stack_viewerrcCs||}|||dS)z1Like runsource() but assumes complete exec sourceN)stuffsourceexecfile)r3sourcerr!r!r"
execsources
zModifiedInterpreter.execsourcec	Cs|dkrFt|.}|}tr<dtj|d|d}WdQRXyt||d}WnHtt	fk
r|j
td|j
j
dt|||j
YnX||dS)zExecute an existing fileNz__file__ = r'''z'''
z
del __file__rzB*** Error in script or command!
Traceback (most recent call last):)r)tokenizerdreaduse_subprocessr=r>abspathr
OverflowErrorSyntaxErrorrrrrrshowsyntaxerrorrruncode)r3rrrmcoder!r!r"rs&
zModifiedInterpreter.execfilecCs||}t|||S)zBExtend base class method: Stuff the source in the line cache first)rr	runsource)r3rrr!r!r"r
s
zModifiedInterpreter.runsourcecCs>d|j}|jd|_|d}t|dd||ftj|<|S)z"Stuff source in the filename cachez<pyshell#%d>rrar)gidsplitrsr)r*)r3rrrnr!r!r"rs


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)r)r3rr!r!r"prepend_syspathsz#ModifiedInterpreter.prepend_syspathcCs|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.

        rz1.0rymsgrGz<no detail available>r roffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
rr7r\rexc_inforiZcolorize_syntax_errorrrr)r3rrr7rvaluetbrr rposr!r!r"r
s"z#ModifiedInterpreter.showsyntaxerrorcCs6|j|t||jdr2|jdS)z1Extend base class method to reset output properlyz<<toggle-jit-stack-viewer>>N)rrchecklinecacher
showtracebackropen_stack_viewer)r3r!r!r"rs


z!ModifiedInterpreter.showtracebackcCsBtj}x6t|D]&}|dd|dddkr||=qWdS)Nrr(z<>)r)r*r+keys)r3cr/r!r!r"rsz"ModifiedInterpreter.checklinecachecCs@|jjr|dS|jr0|jdd|fint||jdS)z*Run the code without invoking the debuggerrrrr)rrdisplay_executing_dialogrrrr)r3rr!r!r"rszModifiedInterpreter.runcommandcCsN|jjr|j||j}zyT|j|sT|jdk	rT|jdd|fi|_	n |rh|
||jnt||jWnt
k
r|jjstjddd|jjdrq|nYn`trtd|jjd	||jn,|jjr
d
|j_td|jjd	n|YnXWdtsHy|jWntk
rFYnXXdS)zOverride base class methodNrrzExit?zDo you want to exit altogether?Zyes)rrz IDLE internal error in runcode())rFr)rrrSrrr
beginexecutingrZ
asyncqueuerrunrr
SystemExitrrkZaskyesnor7rrrrrcanceledr)r3rr
r!r!r"rsJ




zModifiedInterpreter.runcodecCs|jj|S)zOverride base class method)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)rkrlrr7)r3r!r!r"r'sz.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-failure)r)rkrlrr7)r3r!r!r"r2sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjddS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rkrlrr7)r3r!r!r"r:sz,ModifiedInterpreter.display_executing_dialog)FrG)F)N)N)&r{r|r}r6rrrrrrrrrrrrrrr
rrrrrrrr
rrr
rrrrrrrrr!r!r!r"rsF	+
,

&

	
.rcseZdZdedZeZeZddddddgZ	e
jd	gZd
Zddl
mZdTddZddZd
Zd
Zd
Zd
Zd
Zd
ZddZddZdUddZddZdVddZddZddZd d!Zd"d#Zd$d%Z d&d'Z!d(d)Z"d*d+Z#d,Z$d-d.Z%d/d0Z&d1d2Z'd3d4Z(dWd5d6Z)d7d8Z*d9d:Z+d;d<Z,d=d>Z-d?d@Z.dXdAdBZ/dYdCdDZ0dZdEdFZ1dGdHZ2dIdJZ3dKdLZ4d[dNdOZ5fdPdQZ6fdRdSZ7Z8S)\rzPython z Shell)rZ_File)ZeditZ_Edit)rTZ_Debug)ZoptionsZ_Options)ZwindowZ_Window)helpZ_Help)ZSqueezez<<squeeze-current-text>>Fr)HistoryNcCs$tr&|j}|dddkr&|ddt||_|dkrVt}t||t|}t	
||ddd|_d|_t
tdrtjnd|_|jd	d
|_|j|_|j}|jdd|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_&yddl/}|j0|_1Wntj2t_$YnX|3|j|_4d|_5dS)Nrvrshell)r#ZShe_llTps1z>>> rar(char)wrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>z<<toggle-debugger>>z<<toggle-jit-stack-viewer>>z<<view-restart>>z<<restart-shell>>z<<squeeze-current-text>>)iomenurrrbackslashreplacer2)6r
menu_specsrVrrSTkrwithdrawrrr6ZusetabsZindentwidthhasattrrr%sys_ps1rZprompt_last_linepromptr7Z	configurer8enter_callbacklinefeed_callbackcancel_callbackeof_callbackrtoggle_debuggertoggle_jit_stack_viewerview_restart_mark
restart_shellZSqueezerZsqueeze_current_text_eventrsave_stdoutrsave_stderrr
save_stdinrr(rencodingerrorsrrpydocZ
plainpagerZpagerrr"historyr)r3r;Zmsrjr7Zsqueezerr(r>r!r!r"r6^sn

zPyShell.__init__cCstjddS)NT)Z
shell_only)rZ
GetExtensions)r3r!r!r"get_standard_extension_namessz$PyShell.get_standard_extension_namescCs|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|dS|j}|r<|n|dS)NzDon't debug nowz*You can only toggle the debugger when idle)rrF)	rrkrlr7set_debugger_indicatorrSrclose_debugger
open_debugger)r3rZdbr!r!r"r5s


zPyShell.toggle_debuggercCs|j}|d|dS)Nz<<toggle-debugger>>)rSrZsetvar)r3rGr!r!r"rDs
zPyShell.set_debugger_indicatorcCsdS)Nr!)r3rZr!r!r"r6szPyShell.toggle_jit_stack_viewercCsh|j}|r\|jd||jjr8t|jj||j	d|j
|_||
dS)Nz[DEBUG OFF]
)rSrrrrrZclose_remote_debuggerrrrr/r0rrD)r3rGr!r!r"rEs
zPyShell.close_debuggercCsX|jjrt|jj|}n
t|}|j||d|j|_	|
|dS)Nz[DEBUG ON]
)rSrrZstart_remote_debuggerr
ZDebuggerrrr/r0rrD)r3Zdbg_guir!r!r"rFs

zPyShell.open_debuggercCs|d|_dS)zHelper for ModifiedInterpreterTN)rr)r3r!r!r"rszPyShell.beginexecutingcCsd|_d|_|dS)zHelper for ModifiedInterpreterFN)rr r)r3r!r!r"rszPyShell.endexecutingcCsD|jr&tjddd|jd}|dkr&dS|d|_d|_t|S)zExtend EditorWindow.close()zKill?z7Your program is still running!
 Do you want to kill it?ok)rrFZcancelT)	rrkZaskokcancelr7rr rrr)r3rr!r!r"rs
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)rErrSrr9rrr:rr;rrr;rRr?rrz)r3r!r!r"rzs
zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr!)r3rr!r!r"ispythonsource
szPyShell.ispythonsourcecCs|jS)N)shell_title)r3r!r!r"short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs|jdd|tr:d}|j}|sF|dSnd}tjt	_|
dt	jt	j|j
|f|j|ddl}d|_dS)	NrrVrGFz==== 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)r7rrrrSrrrdisplayhookrrversionplatform	COPYRIGHTZfocus_forcertkinterZ
_default_root)r3ZnosubZclientrPr!r!r"rs"

z
PyShell.begincCs|js
dSd|_|jdS)NT)reading_stop_readline_flagrquit)r3r!r!r"r,szPyShell.stop_readlinecCs|j}zd|_|jWd||_X|jr4d|_dS|jdd}t|dkrRd}||jrnd|_t	snt
|jr~d|_d}|S)NTFrGrzend-1crra)rQrmainlooprRr7getrsrr rr	endoffile)r3r.rr!r!r"readline2s(zPyShell.readlinecCsdS)NTr!)r3r!r!r"isattyIszPyShell.isattycCsy|jdddrdSWnYnX|jsR|jsR||jd|dSd|_d|_	|jr|jj
r|jr|jn
|j
|jr|jdS)Nz	sel.firstz!=zsel.lastzKeyboardInterrupt
rFFT)r7rrrQrrSrrrVr rrrrrrS)r3rZr!r!r"r3Ls&


zPyShell.cancel_callbackcCsf|jr|jsdS|jdddr0|jddds4dS|jsL||nd|_d|_|j	dS)Nrz==rVzend-1cFTrF)
rrQr7rrrr rVrrS)r3rZr!r!r"r4bs

zPyShell.eof_callbackcCs0|jr"|jdd|jdn
||dS)NrVrarF)rQr7rVseenewline_and_indent_event)r3rZr!r!r"r2qs

zPyShell.linefeed_callbackcCs8|jr|jsdSy6|jdd}|rD|jdddrD|||dSWnYnX|jdddrV|jd	d}|r|jdd|d
r||j|d|d
|dS|jd	d}|r|jdd
|dr||j|d|d
|dS|jdd}|r<|j|dddr<||j|d
d|n||jdd|dS|jdddrv|jdd|jdd}|r|	s|j
dd|jdddr||dS|jdd|jr|jdd|j
dn
|||jd	dd|j|jr,|jn|dS)Nz	sel.firstzsel.lastz<=rrFrVrziomark linestartrrrzinsert lineendz>=rzinsert linestartzend-1czend-1c linestartra)rrQr7rUrrecallZ
tag_prevrangeZ
tag_nextrangerstriprrZrVrYrNZupdate_idletasksrrSrunit)r3rZselprevnextindicesrr!r!r"r1zsX


zPyShell.enter_callbackc	Cs<tdd|}tdd|}|d}|jz|jddd|jdd	|jd
d}|	dr|
||jd
d}|jd|dt
|d
krtd|dd}td|d}xJ|d
dD]:}||r||t
|d}|jdd|qWWd|jd|jXdS)Nz^\s*\nrGz\n\s*$rar^z1.0ryrVzend-1czinsert linestart:rrz	^([ \t]*))resubrr7Zundo_block_startr\rrUrstripendswithrZrVr\rssearchgrouprfrYZundo_block_stop)r3rrZrnprefixZorig_base_indentZnew_base_indentrr!r!r"r[s*


zPyShell.recallcCs|jdd}t|}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr||ddkr|d}q^W|d|}|j|dS)Nrzend-1crrz 	ra)r7rUrsrSr
)r3rrr!r!r"r]sz
PyShell.runitcCsX|jjr|jSy
tjWntjdd|jddSddlm	}||j
|jdS)NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined))rr)StackBrowser)rSrrrlast_tracebackrkrlr7Zidlelib.stackviewerrjrjr;)r3rZrjr!r!r"rs


zPyShell.open_stack_viewercCs|jd|jddS)Nrr)r7rY)r3rZr!r!r"r7szPyShell.view_restart_markcCs|jjdddS)z&Callback for Run/Restart Shell Cntl-F6T)rN)rSr)r3rZr!r!r"r8szPyShell.restart_shellcCs:||j|j|jdd||jdS)NrVzend-1c)	rrrr0r7rset_line_and_columnrAZ
reset_undo)r3r!r!r"rs
zPyShell.showpromptcCsP|jjj}t|ddd}d||}|ds:|d7}|jj	d|ddS)Nr$T)rtabsizeZexpand_tabsraziomark linestartr)
rSrrr
r?r'rfZperZbottomrV)r3rrwrapperZwrapped_msgr!r!r"show_warnings

zPyShell.show_warningcCsb|jdd}|jr |j||jddkr>|jdd|jdd||jdS)Nrzend-1czend-2cra)	r7rUr?ZstorerVrrlZctipZremove_calltip_window)r3rr!r!r"rszPyShell.resetoutputr!cCsXy0|jddt|||d}|jddWnYnX|jrTd|_tsTt|S)NrrightrF)r7rrrr rr)r3rrcountr!r!r"rsz
PyShell.writecs8y|jdddrdSWntk
r,dSXtS)Nz	sel.firstrrdisabled)r7rrsuperrD)r3)	__class__r!r"rDszPyShell.rmenu_check_cutcs|jdddrdStS)NrVrrrr)r7rrsrE)r3)rtr!r"rE&szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r!)9r{r|r}r	rJrrrrr+rrZallow_line_numbersZidlelib.historyr"r6r@rQrr rVrrRrBrCr5rDr6rErFrrrrzrIrKrOrrrWrXr3r4r2r1r[r]rr7r8rrorrrDrE
__classcell__r!r!)rtr"rBsl
C



	?




rc
Cs6|jdkr2x&dD]}||dd||dqWdS)z6Make paste replace selection on x11.  See issue #5124.Zx11)ZTextZEntryZSpinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
N)Z_windowingsystemZ
bind_class)rjclsr!r!r"
fix_x11_paste,s

rwa
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
snddl}ddlm}ddlm}ddlm}tddad}d}d}d}d}d}	y|tj	ddd\}
}WnD|j
k
r}z$td	|tftj
d
tdWdd}~XYnXx|
D]\}
}|
dkr|}d}|
d
krd}d}|
dkrd}|
dkrtjtt|
dkrd}|
dkr6tdtj
d
da|
dkrj|}tj|rTntd|td}|
dkr|d}	d}|
dkr|t_d}qW|r|ddkrtj}d}x0tttjD]}tjtj|tj|<qW|r|ddkrdg|ddt_	n|r$dg|t_	n|r8|g|t_	n|rd}g}x |D]}|tj|qLWxX|D],}tj|}|tjkrntjd|qnWn"t}|tjkrtjd|tj ddddd}|p|}|p|}tr|st!t"dda#t#$dd l%m&}|t#tj'tjt(d!|d"kr`tj'd#}t#j)|d$nV|*st+d%kr~d&d'}nd(d)}fd*d+|D}d,d+|D}t#j,d0|t-t#t.t#t/t#a0|1t#t0|r,|s,|s,x0|ddD] }t02|dkr|3|qW|s,t04|rbt05}|sDdS|*rht0j6rh|j78nt0j9}|rv|:|	rtj;<d-ptj;<d.}|rtj|r|j=>||s|r
|j=?d/tj	f|r|j=@|n|rB|j=A||j=>|n8|rB|Bt#}|r*|C||D}|rB|C|xt0jErXt#FqDWt#GtddS)1Nr)system)testing)macosxTFrzc:deihnr:st:zError: %s
%s)rrvz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t-rGrrzeditor-on-startupr)rZIdle)Z	className)rZIconsZWindowszidle.ico)rg333333!@z.png) 0z.gif)r|r}r~cs"g|]}tjd|fqS)z	idle_%d%s)r=r>r?)rsize)exticondirr!r"rszmain.<locals>.<listcomp>cSsg|]}tt|dqS))Zmasterr)Z
PhotoImagerj)riconfiler!r!r"rsZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)T)HgetoptrNrxrryrzr'rrargverrorr	usage_msgrexitrrr=r>rqrrJrrrwrsrrQdirnamerVgetcwdrrZ
NoDefaultRootr,rjr-idlelib.runrr?__file__Z
wm_iconbitmapZisAquaTk	TkVersionZwm_iconphotorrwrr;ZsetupApprdr[newr<dictrlowerrRrFenvironrUrSrrrrZtkVersionWarningroZpreferTabsPreferenceWarningZinversedictrTZdestroy)rrxryrzZenable_shellZenable_editrTcmdZscriptZstartupZoptsrCroarZpathxrdirZ
edit_startrrZsizesZ	iconfilesZiconsr#ZtkversionwarningZprefer_tabs_preference_warningr!)rrr"rms


















rF)NN)Prr{rrPImportErrorrrrrNZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ
messageboxrkrr,rjr-rrrlrrr)r=Zos.pathr	rcrrtextwrapr
rrrr%Zidlelib.colorizerrZidlelib.configrrr
rZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZidlelib.undorrrrr#r$r'
checkcacher0r1rrrZ	RPCClientrrrrrwrrr!r!r!r"<module>s



?0m?6