File "PyShell.cpython-34.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python34/lib64/python3.4/idlelib/__pycache__/PyShell.cpython-34.pyc
File size: 47.08 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit


e fR@sVddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZyddlTWn2ek
reddejejdYnXddljZddlmZmZdd	lmZdd
lmZddl m!Z!ddl"m#Z#dd
l$m%Z%ddl&m'Z'ddl&m(Z(ddl&m)Z)ddl&m*Z*dZ+dZ,eja-ddl.Z.dddZ/ddddZ0da1ddZ2e2ddej3ddZ4e4e_3GdddeZ5GdddeZ6Gd d!d!eZ7Gd"d#d#e!Z8Gd$d%d%e'j9Z:Gd&d'd'e
Z;Gd(d)d)e#Z<Gd*d+d+e
j=Z>Gd,d-d-e>Z?Gd.d/d/e>Z@d0ZAd1d2ZBeCd3krHejDd3ejDd)<eBne2d4dS)5N)InteractiveInterpreter)python_versionsystem)*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **file)EditorWindow
fixwordbreaks)FileList)ColorDelegator)
UndoDelegator)OutputWindow)idleConf)rpc)Debugger)RemoteDebugger)
macosxSupportz	127.0.0.1cCsyd}|d||f7}|dkr;tj||}n|j}|r^|d|7}n|d|j|f7}|S)zFormat warnings the IDLE way.z!
Warning (from warnings module):
z  File "%s", line %s
Nz    %s
z%s: %s
)	linecachegetlinestrip__name__)messagecategoryfilenamelinenolinesr4/opt/alt/python34/lib64/python3.4/idlelib/PyShell.pyidle_formatwarning0srcCsg|dkrt}ny3|jt||||d||jdWnttfk
rbYnXdS)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.
    Nrz>>> )warning_streamwriterAttributeErrorOSError)rrrrrrrrridle_showwarning=s		r$cCsL|r*tdkrHtjatt_qHntdk	rHtt_dandS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)_warnings_showwarningwarningsshowwarningr$)Zcapturerrrcapture_warningsPs		r(TcCs{tj}i}xNt|D]@}|dd|dddkr|j|||<qqW|||j|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<>)rcachelistpopupdate)rZorig_checkcacher*savekeyrrrextended_linecache_checkcache_s	$
r0c@seZdZdZddZd'd(d)d*d+d,gZdddZddZd
ddZd
ddZ	ddZ
ddZdd Zd!d"Z
d#d$Zd%d&Zd
S)-PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGsg|_tj|||jjd|j|jjd|j|jjd|jjt	j
jtj
d|_|jj|dd}|jj||jjr|jn|jdS)Nz<<set-breakpoint-here>>z<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs|j|dS)N)restore_file_breaks)Zold_hookselfrrrfilename_changed_hooks
z;PyShellEditorWindow.__init__.<locals>.filename_changed_hook)breakpointsr__init__textbindset_breakpoint_hereclear_breakpoint_hereflist
open_shellospathjoinrZ
GetUserCfgDirbreakpointPathioZfilename_change_hookZset_filename_change_hookrr2color_breakpoint_text)r3argsr4rrrr6ys		
zPyShellEditorWindow.__init__Cut<<cut>>rmenu_check_cutCopy<<copy>>rmenu_check_copyPaste	<<paste>>rmenu_check_pasteNSet Breakpoint<<set-breakpoint-here>>Clear Breakpoint<<clear-breakpoint-here>>TcCse|jdkrdS|r:tj}tj|d}nidd6dd6}|jjd|dS)z,Turn colorizing of breakpoint text on or offNbreak
foreground
backgroundBREAK)rArCurrentThemeGetHighlightr7Z
tag_config)r3ZcolorthemeZcfgrrrrBsz)PyShellEditorWindow.color_breakpoint_textcCs|j}|jj}|jdd|d|dy|jj|Wn"tk
rl|jj|YnXy&|jj	j
j}|j||WnYnXdS)NrUz%d.0r)
r7rArtag_addr5index
ValueErrorappendr;pyshellinterpdebuggerr9)r3rr7rdebugrrrset_breakpoints	
z"PyShellEditorWindow.set_breakpointcCsU|j}|jj}|s)|jdStt|jd}|j|dS)Ninsert)r7rArbellintfloatrZra)r3eventr7rrrrrr9s	
z'PyShellEditorWindow.set_breakpoint_herecCs|j}|jj}|s)|jdStt|jd}y|jj|WnYnX|j	dddy&|j
jjj
}|j||WnYnXdS)NrbrUzinsert linestartzinsert lineend +1char)r7rArrcrdrerZr5remove
tag_remover;r]r^r_r:)r3rfr7rrr`rrrr:s"	
z)PyShellEditorWindow.clear_breakpoint_herec	Cs|jr|j}|jj}|s2|jdSg|_|jddty#|jjj	j
}|j|WqYqXndS)NrUz1.0)r5r7rArrcrhZENDr;r]r^r_clear_file_breaks)r3r7rr`rrrris		
	z%PyShellEditorWindow.clear_file_breakscCsb|j}|jj}y+t|jd}|j}WdQXWntk
rZg}YnXyt|jdv}x1|D])}|j|dsz|j|qzqzW|j	|j}|r|j|dt
|dnWdQXWnrtk
r]}zRt|jddsKd|j_
tjd	d
ddt
|d
|jnWYdd}~XnXdS)z#Save breakpoints when file is savedrNw=
breakpoint_error_displayedFTtitlez
IDLE Errorrz$Unable to update breakpoint list:
%sparent)r5rAropenr@	readlinesr#
startswithr!update_breakpointsstrgetattrrootrntkMessageBox	showerrorr7)r3ZbreaksrfplinesZnew_filererrrrrstore_file_breakss.	


	,
z%PyShellEditorWindow.store_file_breakscCs|jj|jdkr dS|jj}|dkr<dStjj|jrt|jd}|j	}WdQXxe|D]Z}|j
|drt|t|dd}x|D]}|j
|qWqqWndS)Nrjrlr)r7r-rArr=r>isfiler@rqrrrsevallenra)r3rrzr{rZbreakpoint_linenumbersZbreakpoint_linenumberrrrr2s

 
z'PyShellEditorWindow.restore_file_breakscCs4|j}|jd}|j|}||_dS)z3Retrieves all the breakpoints in the current windowrUN)r7Z
tag_rangesranges_to_linenumbersr5)r3r7rangesZlinenumber_listrrrrts	z&PyShellEditorWindow.update_breakpointscCsg}xtdt|dD]f}tt||j}tt||dj}x'||kr|j||d7}q^WqW|S)Nrr)rangerrdrestringr\)r3rr{rZrendrrrrs
z)PyShellEditorWindow.ranges_to_linenumberscCs|jtj|dS)z7Extend base method - clear breaks when module is closedN)rir_close)r3rrrr-s
zPyShellEditorWindow._close)rDrEzrmenu_check_cut)rGrHrI)rJrKzrmenu_check_paste)NNN)rMrNN)rOrPN)r
__module____qualname____doc__r6Zrmenu_specsrBrar9r:rir}r2rtrrrrrrr1vs$		*r1c@s1eZdZdZeZdZdddZdS)PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCsQ|jr|jjjn.t||_|jrJ|jjsJdSn|jS)N)r]topwakeupPyShellbegin)r3rfrrrr<<s		zPyShellFileList.open_shell)rrrrr1rr]r<rrrrr3src@sFeZdZdZddZddZddZdd	Zd
S)ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCstj||jdS)N)rr6LoadTagDefs)r3rrrr6Js
zModifiedColorDelegator.__init__cCs7|jddd|jdddtj|dS)NZTODOz1.0iomarkZSYNC)rhrYrrecolorize_main)r3rrrrNsz&ModifiedColorDelegator.recolorize_maincCs{tj|tj}|jjiidd6dd6d6tj|dd6tj|dd6tj|dd6dS)NrTrSstdinstdoutstderrconsole)rrrrVtagdefsr-rW)r3rXrrrrSs
z"ModifiedColorDelegator.LoadTagDefscCs+x$|jD]}|j|ddq
WdS)Nrr)rrh)r3tagrrrremovecolors]sz#ModifiedColorDelegator.removecolorsN)rrrrr6rrrrrrrrGs

rc@s4eZdZdZdddZdddZdS)ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNc
Cs\y-|jj|ddr,|jjdSWntk
rAYnXtj||||dS)N<r)delegatecomparercTclErrorrrb)r3rZcharstagsrrrrbes

zModifiedUndoDelegator.insertcCsYy-|jj|ddr,|jjdSWntk
rAYnXtj|||dS)Nrr)rrrcrrdelete)r3Zindex1Zindex2rrrrns

zModifiedUndoDelegator.delete)rrrrrbrrrrrrbs	rc@seZdZddZdS)MyRPCClientcCs
tdS)z0Override the base class - just re-raise EOFErrorN)EOFError)r3rrr
handle_EOFzszMyRPCClient.handle_EOFN)rrrrrrrrrxsrc@seZdZddZdZdZdZddZddZdd	Z	d
ddd
Z
ddZddZddZ
ddZd
ddZdZddZdZddZddZddZd d!Zd"Zd#d$Zdd%d&Zd'd(Zd)d*Zd+d,Zdd-d.Zd/d0Zd1d2Zd3d4Z d5d6Z!d7d8Z"d9d:Z#d;d<Z$d=d>Z%dS)?ModifiedInterpretercCsf||_tjdj}tj|d|d|_d|_d|_t	|_
|jjj
|_dS)N__main__localsF)	tkconsolesysmodules__dict__rr6save_warnings_filters
restartingsubprocess_arglistPORTportcompilecompilerflagsoriginal_compiler_flags)r3rrrrrr6s					zModifiedInterpreter.__init__NcCs:|jdkr!|j|_ntj|j|_dS)N)rbuild_subprocess_arglist
subprocessPopen
rpcsubproc)r3rrrspawn_subprocesssz$ModifiedInterpreter.spawn_subprocesscCs|jdkstdddtjD}tjddddd	d
d}tdkrnd
|f}n
d|f}tjg|d|t|jgS)Nrz/Socket should have been assigned a port number.cSsg|]}d|qS)z-Wr).0rrrr
<listcomp>s	z@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>mainGeneralzdelete-exitfuncdefaultFtypeboolzidlelib.PyShellz&__import__('idlelib.run').run.main(%r)z__import__('run').main(%r)z-c)	rAssertionErrorrwarnoptionsr	GetOptionr
executableru)r3rkZ	del_exitfZcommandrrrrs	
z,ModifiedInterpreter.build_subprocess_arglistcCst|jf}xXtdD]<}tj|yt||_PWqtk
rWYqXqW|jdS|jj	j
d|_tdkr|jj	jt
jt
jdn|j|jj	jdy|jjWn#t
jk
r|jdSYnX|jjd|j|jjd|jj|jjd|jj|jjd|jj|jjd	|jj|jjd
t|jjd||jdd
|j|jS)Nrr
rrrrr;rr^with_cwdT)HOSTrrtimeZsleeprrpccltr#display_port_binding_errorlistening_sockZgetsocknamerZ
setsockoptsocketZ
SOL_SOCKETZSO_REUSEADDRrZ
settimeoutaccepttimeoutdisplay_no_subprocess_errorregisterrrrrr;r
transfer_pathpoll_subprocess)r3Zaddrirrrstart_subprocesss>

	


	
z$ModifiedInterpreter.start_subprocessFrRcCs|jr|jSd|_|j}|rMytj|jWqMYqMXn|jj|j|j}|j}d|_|j	y|jj
Wn#tjk
r|j
dSYnX|jd||j|jjddd|r|nd}t|jt|dd	d
}|jdj|||jjdd|jjdd
|sz|jn|rtj|j|jn|j|jj_d|_|jS)NTFrrzend-1cz	RESTART: ZShellrrlz
{0} {1} {0}restartleft) rrgetdebuggerrZclose_subprocess_debuggercloseterminate_subprocessr	executingrrrrrr
stop_readliner7rrdwidthrr!formatmark_setmark_gravity
showpromptZrestart_subprocess_debuggerload_breakpointsrrrr)r3rrr`rZ
was_executingrZhalfbarrrrrestart_subprocesssH		

			

	
%

	z&ModifiedInterpreter.restart_subprocesscCs|jjddfidS)NexecZinterrupt_the_server)rZ
remotecall)r3rrrZ__request_interruptsz'ModifiedInterpreter.__request_interruptcCstjd|jjdS)Ntarget)	threadingZThread'_ModifiedInterpreter__request_interruptstart)r3rrrinterrupt_subprocesssz(ModifiedInterpreter.interrupt_subprocesscCs|jdk	r(|jjj|jny|jjjWntk
rPYnXy|jjWntk
rvYnX|jd|j_	d|_dS)NF)
_afteridrr7Zafter_cancelrrrr"rr)r3rrrkill_subprocesss


z#ModifiedInterpreter.kill_subprocesscCsXy|jjWntk
r)dSYn+Xy|jjWntk
rSdSYnXdS)z"Make sure subprocess is terminatedN)rkillr#wait)r3rrrrs
	
z(ModifiedInterpreter.terminate_subprocesscCsC|r"dg}|jtjn	tj}|jd|fdS)NrRzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)extendrr>
runcommand)r3rr>rrrrs		z!ModifiedInterpreter.transfer_pathcCs|j}|dkrdSy|j|jdd}Wn;tttfk
rr|jjr^dSd}|jYnX|rp|jj	d|_|\}}|jj
}|dkr|dk	rGtt|d|qGnl|dkr	|jj
drG|jqGn>|dkrGd}t||dtjt||d|ny|jjWqptk
rlYqpXn|jjs|jjj|jj|j|_ndS)	Nrg?ZOKrZ	EXCEPTIONz<<toggle-jit-stack-viewer>>ERRORz/PyShell.ModifiedInterpreter: Subprocess ERROR:
)rZpollresponse
active_seqrr#KeyboardInterruptrclosingrresetoutputrprintreprgetvarremote_stack_viewerr
__stderr__endexecutingr"r7afterpollintervalrr)r3ZcltresponseZhowZwhatrerrmsgrrrr,s@	
	
z#ModifiedInterpreter.poll_subprocesscCs
||_dS)N)r_)r3r_rrrsetdebuggerTszModifiedInterpreter.setdebuggercCs|jS)N)r_)r3rrrrWszModifiedInterpreter.getdebuggercCs|jjjd|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)r3rrropen_remote_stack_viewerZs
z,ModifiedInterpreter.open_remote_stack_viewercCsddlm}|jjdddi}|dkrK|jjjdS|j|j|}ddlm	}m
}t|jj}tj
}tj|dd}||d	|d
d}	|	jjddd
d||	jd|}
|
jdS)Nr)RemoteObjectBrowserrZstackviewerr;)ScrolledCanvasTreeNodeZnormalrTZbgZhighlightthicknessexpandrZfillZboth)zflist)idlelibrrremotequeuerrwrcZStubObjectTreeItemZidlelib.TreeWidgetrrZToplevelrrVrWZframeZpackZcanvasr)r3rZoiditemrrrrXrTZscZnoderrrrgsz'ModifiedInterpreter.remote_stack_viewerrcCs#|j|}|j||dS)z1Like runsource() but assumes complete exec sourceN)stuffsourceexecfile)r3sourcerrrr
execsourcezszModifiedInterpreter.execsourcecCs|dkr3tj|}|j}WdQXnyt||d}WnXttfk
r|jjtdd|jj	t
j|||jjYnX|j
|dS)zExecute an existing fileNrzB*** Error in script or command!
Traceback (most recent call last):r)tokenizerqreadr
OverflowErrorSyntaxErrorrrrrrshowsyntaxerrorrruncode)r3rrrzcoderrrrs
	
zModifiedInterpreter.execfilec
Cs|j|}d|_tjdd|_tjdddtt|tsYt	zt
j|||SWd|jdk	r|jtjdd<d|_nXdS)zBExtend base class method: Stuff the source in the line cache firstrNactionerrorr)r
Zmorer&filtersrfilterwarnings
SyntaxWarning
isinstancerurr	runsource)r3rrrrrrs		zModifiedInterpreter.runsourcecCsSd|j}|jd|_|jd}t|dd||ftj|<|S)z"Stuff source in the filename cachez<pyshell#%d>rrmr)gidsplitrrr*)r3rrr{rrrr
s

#zModifiedInterpreter.stuffsourcecCs|jd|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)r3rrrrprepend_syspathsz#ModifiedInterpreter.prepend_syspathcCs|j}|j}|jdddtj\}}}t|ddpU|pUd}t|ddpmd}t|d	dpd
}	|	d
kr|d7}n|dkrd|	d}
nd|d|	df}
|j||
|j|jd
||j	dS)zOverride Interactive Interpreter method: Use Colorizing

        Color the offending position instead of printing it and pointing at it
        with a caret.

        rz1.0rmsgrRz<no detail available>rroffsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
rr7rhrexc_inforvZcolorize_syntax_errorrr!r)r3rrr7rvaluetbrrr posrrrrs"		

z#ModifiedInterpreter.showsyntaxerrorcCsJ|jj|jtj||jjdrF|jjndS)z1Extend base class method to reset output properlyz<<toggle-jit-stack-viewer>>N)rrchecklinecacher
showtracebackropen_stack_viewer)r3rrrr&s



z!ModifiedInterpreter.showtracebackcCsXtj}xHt|jD]4}|dd|dddkr||=qqWdS)Nrz<>r))rr*r+keys)r3cr/rrrr%s	$z"ModifiedInterpreter.checklinecachecCsV|jjr|jdS|jrB|jjdd|fint||jdS)z*Run the code without invoking the debuggerrrrr)rrdisplay_executing_dialogrrrr)r3rrrrrs
	zModifiedInterpreter.runcommandcCs|jjr|jjn|j|jdk	rW|jtjdd<d|_n|j}zNyw|jj	|r|j
dk	r|j
jdd|fi|_n,|r|j
||jnt||jWntk
r4|jjs-tjddddd|jjr q0|jnYnytrmtd	d
|jj|j|jjn;|jjrd|j_tdd
|jjn
|jYnXWdtsy|jjWqtk
rYqXnXdS)
zOverride base class methodNrrzExit?zDo you want to exit altogether?ryesrpz IDLE internal error in runcode()rFr)rrr^rr%rr&rr_beginexecutingrZ
asyncqueuerZrunrr
SystemExitrrxZaskyesnor7r&use_subprocessrrrcanceledr")r3rr_rrrrsP
	


	


zModifiedInterpreter.runcodecCs|jjj|S)zOverride base class method)rrr!)r3rrrrr!"szModifiedInterpreter.writecCs tjddd|jjdS)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.rp)rxryrr7)r3rrrr&sz.ModifiedInterpreter.display_port_binding_errorcCs tjddd|jjdS)NzSubprocess Startup ErrorzIDLE's subprocess didn't make connection.  Either IDLE can't start a subprocess or personal firewall software is blocking the connection.rp)rxryrr7)r3rrrr1sz/ModifiedInterpreter.display_no_subprocess_errorcCs tjddd|jjdS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rp)rxryrr7)r3rrrr*9sz,ModifiedInterpreter.display_executing_dialog)&rrrr6rrrrrrrrrrrrrrr_rrrrrr
rrr
rrr&r%rrr!rrr*rrrrrsF
+-

&
1rcs/eZdZdedZeZeZdVdWdXdYdZd[gZ	ddl
mZdddZddZ
dZdZdZdZdZdZddZddZdddZddZddd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Z d1Z!d2d3Z"d4d5Z#d6d7Z$d8d9Z%dd:d;Z&d<d=Z'd>d?Z(d@dAZ)dBdCZ*dDdEZ+ddFdGZ,ddHdIZ-ddJdKZ.dLdMZ/dNdOZ0fdPdQZ1fdRdSZ2fdTdUZ3S)\rzPython z Shellr_Fileedit_Editr`_Debugoptions_Optionswindows_Windowhelp_Helpr)HistoryNc	Cstr9|j}|dddkr9|jddq9nt||_|dkrt}t||jt|}nt	j
||ddd|_d|_d|_
|j}|jdd|jd	|j|jd
|j|jd|j|jd|j|jd
|j|jd|j|jd|jtr~|jd|j|jd|jntj|_tj|_tj|_ ddl!m"}t#|d|j$|_t%|d|j$|_t%|d|j$|_t%|d|j$|_&ts?|jt_|jt_|jt_nyddl'}|j(|_)Wntj*t_YnX|j+|j|_,d|_-dS)NrrshellShe_llTZwrapcharz<<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>>)	IOBindingrrrr2)zshellr<).r.
menu_specsrbrr^Tkr	withdrawrr
r6ZusetabsZindentwidthZcontext_use_ps1r7Z	configurer8enter_callbacklinefeed_callbackcancel_callbackeof_callbackr'toggle_debuggertoggle_jit_stack_viewerview_restart_mark
restart_shellrrsave_stdoutrsave_stderrr
save_stdinrr?PseudoInputFileencodingPseudoOutputFilerpydocZ
plainpagerZpagerrr:historyr)r3r;Zmsrwr7r?rRrrrr6Ws\		

				zPyShell.__init__cCstjddS)NZ
shell_onlyT)rZ
GetExtensions)r3rrrget_standard_extension_namessz$PyShell.get_standard_extension_namesFcCs
|adS)N)r )r3streamrrrset_warning_streamszPyShell.set_warning_streamcCstS)N)r )r3rrrget_warning_streamszPyShell.get_warning_streamcCs`|jr0tjddd|j|jdS|jj}|rR|jn
|jdS)NzDon't debug nowz*You can only toggle the debugger when idlerprQ)	rrxryr7set_debugger_indicatorr^rclose_debugger
open_debugger)r3rfdbrrrrHs		


zPyShell.toggle_debuggercCs%|jj}|jd|dS)Nz<<toggle-debugger>>)r^rZsetvar)r3r[rrrrXszPyShell.set_debugger_indicatorcCsdS)Nr)r3rfrrrrIszPyShell.toggle_jit_stack_viewercCs|jj}|r|jjd|j|jjrQtj|jjn|j|jj	ddt
_|jn|j
dS)Nz[DEBUG OFF]
z>>> )r^rrrrrZclose_remote_debuggerrrr!rps1rrX)r3r[rrrrYs

	
zPyShell.close_debuggercCsq|jjr'tj|jj|}ntj|}|jj||jdt_|j	|j
dS)Nz[DEBUG ON]
>>> )r^rrZstart_remote_debuggerrrrrr\rrX)r3Zdbg_guirrrrZs
	
zPyShell.open_debuggercCs|jd|_dS)zHelper for ModifiedInterpreterrN)rr)r3rrrr,s
zPyShell.beginexecutingcCs d|_d|_|jdS)zHelper for ModifiedInterpreterrN)rr/r)r3rrrrs		zPyShell.endexecutingcCsf|jr=tjddddd|j}|dkr=dSn|jd|_d|_tj|S)	zExtend EditorWindow.close()zKill?z7Your program is still running!
 Do you want to kill it?rokrpFZcancelT)	rrxZaskokcancelr7rr/rrr)r3rrrrrs	
		z
PyShell.closecCs||jtr |jjn|jt_|jt_|j	t_
d|_d|_d|j_
d|_tj|dS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)rYr.r^rrLrrrMrrNrrr;r]rSrr)r3rrrrs
			zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr)r3rrrrispythonsourceszPyShell.ispythonsourcecCs|jS)N)shell_title)r3rrrshort_titleszPyShell.short_titlez@Type "copyright", "credits" or "license()" for more information.cCs|jjdd|jtrOd}|jj}|sm|jdSndddd}tjt	_|j
d	t	jt	j|j
|f|jj|jd
dl}d|_dS)NrrbrRFz==== 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
%srT)r7rrr.r^rrrdisplayhookrr!versionplatform	COPYRIGHTZfocus_forcertkinterZ
_default_root)r3ZnosubZclientrerrrrs$

	

	z
PyShell.begincCs'|js
dSd|_|jjdS)NT)reading_stop_readline_flagrquit)r3rrrrs		zPyShell.stop_readlinecCs|j}zd|_|jjWd||_X|jrFd|_dS|jjdd}t|dkrvd}n|j|jrd|_t	st
qn|jrd|_d}n|S)NrFrRrzend-1crrm)rfrmainlooprgr7getrrr/r.r	endoffile)r3r.rrrrreadline"s(		
			
					zPyShell.readlinecCsdS)NTr)r3rrrisatty9szPyShell.isattyc
Csy |jjdddrdSWnYnX|jp:|jse|j|jjd|jdSd|_d|_	|jr|jj
r|jjr|jjq|jj
n|jr|jjndS)Nz	sel.firstz!=zsel.lastzKeyboardInterrupt
rQrr)r7rrrfrr^r!rrkr/rrrrrrh)r3rfrrrrF<s&

			zPyShell.cancel_callbackcCs|jr|jrdS|jjdddoD|jjdddsKdS|jsk|j|jnd|_d|_|jj	dS)Nrz==rbzend-1crrrQ)
rrfr7rrrr/rkrrh)r3rfrrrrGRs	

		
zPyShell.eof_callbackcCs@|jr/|jjdd|jjdn
|j|dS)NrbrmrQ)rfr7rbseenewline_and_indent_event)r3rfrrrrEas
	
zPyShell.linefeed_callbackcCs|jr|jrdSyN|jjdd}|rd|jjdddrd|j||dSnWnYnX|jjdddr|jjd	d}|r|jjdd|d
r|j|jj|d|d
|dS|jjd	d}|rL|jjdd
|drL|j|jj|d|d
|dS|jjdd}|r|jj|dddr|j|jj|d
d|n|j|jjdd|dS|jjdddr|jjddn|jjdd}|r8|j	r8|jj
ddn|jjdddra|j|dS|jjdd|jr|jjdd|jj
dn
|j||jjd	dd|jj|jr|jjn
|jdS)Nz	sel.firstzsel.lastz<=rrQrbrziomark linestartrrrzinsert lineendz>=rzinsert linestartzend-1czend-1c linestartrm)rrfr7rjrrecallZ
tag_prevrangeZ
tag_nextrangerrrrorbrnrYZupdate_idletasksrrhrunit)r3rfselprevnextindicesrrrrrDjsX"'"'&
	

	
zPyShell.enter_callbackcCstjdd|}tjdd|}|jd}|jjzL|jjddd|jjdd	|jjd
d}|jj	dr|j
||jjd
d}n|jjd|djt
|d
krtjd|djd}tjd|jd}xd|d
dD]O}|j|rm||t
|d}n|jjdd|jq;WnWd|jjd|jjXdS)Nz^\s*\nrRz\n\s*$rmrrz1.0rrbzend-1czinsert linestart:rrz	^([ \t]*))resubrr7Zundo_block_startrhrrjrstripendswithrorbrrsearchgrouprsrnZundo_block_stop)r3rrfr{prefixZorig_base_indentZnew_base_indentrrrrrps*

(zPyShell.recallcCs|jjdd}t|}x.|dkrQ||ddkrQ|d}q$W|dkr||ddkr|d}nx.|dkr||ddkr|d}qW|d|}|jj|dS)Nrzend-1crrz 	rm)r7rjrr^r)r3rrrrrrqs# 
#z
PyShell.runitcCss|jjr|jjSytjWn%tjddd|jdSYnXddlm	}||j
|jdS)NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined)rpr)StackBrowser)r^rrrlast_tracebackrxryr7Zidlelib.StackViewerr~rwr;)r3rfr~rrrr's
	
	zPyShell.open_stack_viewercCs$|jjd|jjddS)Nrr)r7rn)r3rfrrrrJszPyShell.view_restart_markcCs|jjdddS)z&Callback for Run/Restart Shell Cntl-F6rTN)r^r)r3rfrrrrKszPyShell.restart_shellc	Csl|jyttj}Wnd}YnX|jj||jjdd|j|j	j
dS)NrRrbzend-1c)rrurr\rr!r7rset_line_and_columnrAZ
reset_undo)r3rrrrrs

zPyShell.showpromptcCs|jjdd}|jr1|jj|n|jjddkr_|jjddn|jjdd|jdS)Nrzend-1czend-2crm)r7rjrSZstorerbrr)r3rrrrrs	zPyShell.resetoutputcCst|tryt|ryt|dkryx*t|D]\}}|dkr:Pq:q:Wtd|||ddnyB|jjddtj	|||d}|jjddWnYnX|j
rd|_
tstqn|S)	Nu￿zUCS-2rz%Non-BMP character not supported in Tkrrightrr)
rrurmax	enumerateUnicodeEncodeErrorr7rr
r!r/r.r)r3rrrr>countrrrr!s"-		z
PyShell.writecsFy |jjdddrdSWntk
r8dSYnXtjS)Nz	sel.firstrrdisabled)r7rrsuperrF)r3)	__class__rrrFs
	zPyShell.rmenu_check_cutcs)|jjdddrdStjS)Nrbrrr)r7rrrL)r3)rrrrLszPyShell.rmenu_check_paste)zfiler0)r1r2)zdebugr3)r4r5)r6r7)zhelpr9)4rrrrr_rrrrrAZidlelib.IdleHistoryr:r6rTrfrr/rkrrgrVrWrHrXrIrYrZr,rrrr^r`rdrrrlrmrFrGrErDrprqr'rJrKrrr!rFrLrr)rrrAsd	:
	?	rc@sOeZdZdddZeddZeddZdd	ZdS)

PseudoFileNcCs||_||_||_dS)N)r;r	_encoding)r3r;rrPrrrr6"s		zPseudoFile.__init__cCs|jS)N)r)r3rrrrP'szPseudoFile.encodingcCsd|jS)Nz<%s>)r)r3rrrname+szPseudoFile.namecCsdS)NTr)r3rrrrm/szPseudoFile.isatty)rrrr6propertyrPrrmrrrrr src@s(eZdZddZddZdS)rQcCsdS)NTr)r3rrrwritable5szPseudoOutputFile.writablecCs}|jrtdnt|tk	rgt|tsUtdt|jntj|}n|jj	||j
S)Nzwrite to closed filezmust be str, not )closedr[rrur	TypeErrorr__str__r;r!r)r3rrrrr!8s	zPseudoOutputFile.writeN)rrrrr!rrrrrQ3srQc@sUeZdZdddZddZd
ddZdd	d
ZddZdS)rONcCs#tj||||d|_dS)NrR)rr6_line_buffer)r3r;rrPrrrr6EszPseudoInputFile.__init__cCsdS)NTr)r3rrrreadableIszPseudoInputFile.readablercCs|jrtdn|dkr-d}n+t|tsXtdt|jn|j}d|_|dkrx|jj	}|sPn||7}qyWn_x9t
||kr|jj	}|sPn||7}qW||d|_|d|}|S)Nzread from closed filerzmust be int, not rRrr))rr[rrdrrrrr;rlr)r3sizeresultrrrrrLs,				zPseudoInputFile.readcCs|jrtdn|dkr-d}n+t|tsXtdt|jn|jpm|jj	}|dkrt
|}n|jdd|}|dkr|d}n||d|_|d|S)Nzread from closed filerzmust be int, not rrmr))rr[rrdrrrrr;rlrfind)r3rrZeolrrrrlcs		
zPseudoInputFile.readlinecCs|jjdS)N)r;r)r3rrrrsszPseudoInputFile.closer)r))rrrr6rrrlrrrrrrOCs
rOa
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].
cstddad}d}d}d}d}d}y)tjtjddd\}}WnRtjk
r}z/td|tfdtjtj	dWYdd}~XnXxE|D]=\}	}
|	dkr|
}d}n|	d	krd}d}n|	d
krd}n|	dkr9tj
jttj	n|	dkrNd}n|	d
krvtddtjdan|	dkr|
}tj
j|rntd|tj	d}n|	dkrd}d}n|	dkr|
t_d}qqW|r(|ddkr(tjj}d}nx=tttj
D]&}tj
jtj
|tj
|<q>W|r|ddkrdg|ddt_n|rdg|t_n|r|g|t_n|rTd}g}x'|D]}
|jtj
j|
qWxy|D]=}tj
j|}|tj
krtj
jd|qqWn1tj}|tj
krtj
jd|ntjddddd}|p|}|p|}tddatj
jtj
jtdt dkr tj
jd}tj!d |nft"d!krt"d"kr>d#nd$fd%d&d3D}d*d&|D}tj#d|nt$ttj%t&ta't(j)tt't(j*rtj+d+d,tj+d+d-tj+d+d.n|r`|p|s`x=|ddD]+}
t'j,|
dkr|j-|
qqW|s]t'j.q]q`n|rt'j/}|s|dSt(j*rt'j0r|j1j2qn	t'j3}|r|j4n|rtj5j6d/ptj5j6d0}
|
rtj
j|
r|j7j8|
qn|s$|r|j7j9d1tjf|rW|j7j:|q|r|j7j;||j7j8|qn5|rt(j<t}|r|j7j9d2|qnxt'j=rtj>qWtj?tddS)4NTFrzc:deihnr:st:zError: %s
%srrz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tr-rRrrzeditor-on-startuprrZ	classNameZIdleZIconsZWindowszidle.icorg!@g333333!@z.pngz.gifcs/g|]%}tjjd|fqS)z	idle_%d%s)r=r>r?)rr)exticondirrrrs	zmain.<locals>.<listcomp> 0cSsg|]}td|qS)r)Z
PhotoImage)riconfilerrrrs	ZTextz<B2>z<B2-Motion>z<<PasteSelection>>ZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
zprint('%s'))rrr)@r(r.getoptrargvrr	usage_msgrexitrr!r=r>r~rr_rrrrabspathr\dirnamerbgetcwdrrrBrwr?__file__rZ
wm_iconbitmapZ	TkVersionZwm_iconphotor	rCrr;rZsetupAppZisAquaTkZunbind_classrqrgnewr<dictrlowerr]rZenvironrjr^rrr
rZtkVersionWarningZinversedictriZdestroy)Zenable_shellZenable_editr`cmdZscriptZstartupZoptsrCroarZpathxrdirZ
edit_startrZ	iconfilesZiconsr;Ztkversionwarningr)rrrrs
) 			
		
	

			
	$


!


	
	
rrF)Err=Zos.pathrwrrrrrrrArrrrcrrreImportErrorrrrZtkinter.messageboxZ
messageboxrxZidlelib.EditorWindowrr	Zidlelib.FileListr
Zidlelib.ColorDelegatorrZidlelib.UndoDelegatorrZidlelib.OutputWindowr
Zidlelib.configHandlerrrrrrrrrr r&rr$r%r(
checkcacher0r1rrrZ	RPCClientrrr
TextIOBaserrQrOrrrrrrrr<module>sx
	
	
	h