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

NjEO@s@dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZdd	l
mZddlZddlZeejd
dsx"dD]Zeeeejd
e=qWdejd
_dZdAddZdBddZdaddZ e de!Z"e"fddZ#da$da%da&dCddZ'ddZ(ddZ)dd Z*d!d"Z+d#d$Z,d%d&Z-d'd(Z.d)d*Z/d+Z0d,d-Z1d.d/Z2Gd0d1d1ej3Z4Gd2d3d3ej5Z6Gd4d5d5e6Z7Gd6d7d7e6Z8Gd8d9d9ej9Z:Gd:d;d;e;Z<e=d<kr4dd=l>m'Z'e'd>d?d@e ddS)Dz idlelib.run

Simplified, pyshell.ModifiedInterpreter spawns a subprocess with
f'''{sys.executable} -c "__import__('idlelib.run').run.main()"'''
'.run' is needed because __import__ returns idlelib, not idlelib.run.
N)autocomplete)calltip)
debugger_r)
debugobj_r)iomenu)rpc)stackviewerzidlelib.runfirstrun)ZsimpledialogZ
messageboxfontZdialogZ
filedialogZcommondialogZttkztkinter.Fz	127.0.0.1cCsVd}|d||f7}|dkr(t||}|}|r@|d|7}|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__)messagecategoryfilenamelinenolinesr0/opt/alt/python37/lib64/python3.7/idlelib/run.pyidle_formatwarning*srcCsB|dkrtj}y|t|||||Wntk
r<YnXdS)zuShow Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    N)sysstderrwriterOSError)rrrrfilerrrridle_showwarning_subproc7srcCs0|rtdkr,tjatt_ntdk	r,tt_dadS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)_warnings_showwarningwarningsshowwarningr)Zcapturerrrcapture_warningsGsr!TcCs|ddS)zProcess any tk events that are ready to be dispatched if tkinter
    has been imported, a tcl interpreter has been created and tk has been
    loaded.updateN)eval)tclrrrhandle_tk_eventsWsr%cCs|ay$ttjdkstttjd}WntdtjddStddgtjdd<t	j
tdt|ffd	}d|_
|x2ytry
tWntk
rwYnXytjjdd
d}Wntjk
rd}YnX|r
|\}\}}}|||}tj||fntWqtk
r4tr.dawYqtk
rRtdYqt\}	}
}yttj|dfWn&tj|	|
|tjdtYnXwYqXqWdS)
afStart the Python execution server in a subprocess

    In the Python subprocess, RPCServer is instantiated with handlerclass
    MyHandler, which inherits register/unregister methods from RPCHandler via
    the mix-in class SocketIO.

    When the RPCServer 'server' is instantiated, the TCPServer initialization
    creates an instance of run.MyHandler and calls its handle() method.
    handle() instantiates a run.Executive object, passing it a reference to the
    MyHandler object.  That reference is saved as attribute rpchandler of the
    Executive instance.  The Executive methods have access to the reference and
    can pass it on to entities that they command
    (e.g. debugger_r.Debugger.start_debugger()).  The latter, in turn, can
    call MyHandler(SocketIO) register/unregister methods via the reference to
    register and unregister themselves.

    z/IDLE Subprocess: no IP port passed in sys.argv.)rNTZ
SockThread)targetnameargsg?)blockZtimeoutF)no_exitfunclenrargvAssertionErrorintprint
__stderr__r!	threadingZThread
manage_socket	LOCALHOSTZdaemonstartexit_nowexitKeyboardInterruptrZ
request_queuegetqueueZEmptyZresponse_queueZputr%quitting
SystemExitexc_infoprint_exception	traceback)Zdel_exitfuncZportZ
sockthreadrequestseqmethodr+kwargsZrettypevaluetbrrrmaines^




rIcCsxtdD]b}t|yt|t}PWq
tk
rj}z$td|jddtj	d|}Wdd}~XYq
Xq
Wtdtj	dt
||dadS|dS)NzIDLE Subprocess: OSError: r&z, retrying....)rz8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
rangetimesleepMyRPCServer	MyHandlerrr2r+rr3show_socket_errorr8Zhandle_request)addressiZservererrZsocket_errorrrrr5s



r5cCslddl}ddlm}|}t|||dd|dd|dd|jd	|jd
	|d|dS)z(Display socket error from manage_socket.rN)	showerrorzSubprocess Connection Errorz#IDLE's subprocess can't connect to :r&z.
Fatal OSError #z: zz.
See the 'Startup failure' section of the IDLE doc, online at
https://docs.python.org/3/library/idle.html#startup-failure)parent)	tkinterZtkinter.messageboxrTZTkfix_scalingZwithdrawerrnostrerrorZdestroy)rSrQrWrTrootrrrrPs(rPcsdddl}|ttjt\}}}}|\t_t_t_t	fdd|||dS)Nrc	st||j}|j}|dk	rNt|krNt|||jtddn8|dk	r|jst|krt|||jtdd|rt	|}tddd}t
||tj|dt||}x|D]}t|ddqWdS)NzF
The above exception was the direct cause of the following exception:
)rzE
During handling of the above exception, another exception occurred:
z"Traceback (most recent call last):)zrun.pyzrpc.pyzthreading.pyzqueue.pyz
debugger_r.pyzbdb.pyr()endr)
addid__context__	__cause__rF
__traceback__r2__suppress_context__rA
extract_tbcleanup_traceback
print_listformat_exception_only)	typexcrHcontextcauseZtbeexcludelinesr)efile	print_excseenrrrns,



z"print_exception.<locals>.print_exc)
r
checkcacheflush_stdoutrrr?	last_type
last_valuelast_tracebackset)rrgvalrHexcinfor)rmrnrorr@sr@c
Cs|dd}x2|r>x"|D]}|dd|rPqWP|d=qWx2|rrx"|D]}|dd|rLPqLWP|d=qBWt|dkr|dd|dd<tdtjdtjdj}xbtt|D]R}||\}}}}	|dkrd}|	s|	d	r|
d
d||fi}	||||	f||<qWdS)zARemove excluded traces from beginning/end of tb; get cached linesNrr'z** IDLE Internal Exception: )rexec?z
-toplevel-z	<pyshell#rr)countr.r2rrrZobjecttable
rpchandlerrK
startswithZ
remotecall)
rHrkZorig_tbZrpcfiler{rRfnZlnZnmrrrrrds2



rdcCsdS)zXXX How to do this now?NrrrrrrqsrqcCs*trddl}|tdtddS)zExit subprocess, possibly after first clearing exit functions.

    If config-main.cfg/.def 'General' 'delete-exitfunc' is True, then any
    functions registered with atexit will be removed before exiting.
    (VPython support)

    rNF)r-atexitZ_clearr!rr9)r~rrrr9s
r9cCsrddl}t|jdd}|dkrnxJ|j|D]:}|jj||dd}t|d}|dkr0td	||d<q0WdS)
zScale fonts on HiDPI displays.rNtkscalinggffffff?T)r[r*existssizeg)	Ztkinter.fontfloatrZcallr
namesZFontr1round)r[rWrr*r
rrrrrX*srXcCs2|jdk	r|jdnd}|tt||_dS)Nz

r()__doc__textwrapZfilldedent)ZfuntextZtemrrrfixdoc6srcs|ttjfddtdtdttjfddtdtdtd	tttt_t_d
S)z9Install wrappers to always add 30 to the recursion limit.cs^|rtdy
|\}Wn(tk
r>tdt|dYnX|dksPtd|tS)Nz.setrecursionlimit() takes no keyword argumentsz0setrecursionlimit() takes exactly one argument (z given)rz/recursion limit must be greater or equal than 1)	TypeError
ValueErrorr.__wrapped__RECURSIONLIMIT_DELTA)r+rElimit)setrecursionlimitrrr@s
z:install_recursionlimit_wrappers.<locals>.setrecursionlimitz#            This IDLE wrapper adds z7 to prevent possible
            uninterruptible loops.cstS)N)rrr)getrecursionlimitrrrUsz:install_recursionlimit_wrappers.<locals>.getrecursionlimitz(            This IDLE wrapper subtracts z# to compensate
            for the z" IDLE adds when setting the limit.N)	functoolswrapsrrrrrrr)rrrinstall_recursionlimit_wrappers<srcCsFttjddrBttjddrBtjjt_tjjt_tttdS)zUninstall the recursion limit wrappers from the sys module.

    IDLE only uses this for tests. Users can import run and call
    this to remove the wrapping.
    rN)getattrrrrrrrrrr!uninstall_recursionlimit_wrappersds


rc@seZdZddZdS)rNcCsyWntk
rYntk
r:datYntj}td|dtd|dtdt	j
|dtd||dtdt||dtj
|dtd|dtd	|ddatYnXd
S)zrOverride RPCServer method for IDLE

        Interrupt the MainThread and exit server if link is dropped.

        Tz)
----------------------------------------)rzUnhandled server exception!z
Thread: %szClient Address: z	Request: z#
*** Unrecoverable, server exiting!z(----------------------------------------N)r>EOFErrorr8threadinterrupt_mainrr3r2r4Zcurrent_threadr*reprrArnr=)selfrBZclient_addressZerfrrrhandle_errorus&zMyRPCServer.handle_errorN)r
__module____qualname__rrrrrrNssrNc@sBeZdZdddZeddZeddZed	d
ZddZd
S)	StdioFileutf-8strictcCs||_||_||_||_dS)N)shelltags	_encoding_errors)rrrencodingerrorsrrr__init__szStdioFile.__init__cCs|jS)N)r)rrrrrszStdioFile.encodingcCs|jS)N)r)rrrrrszStdioFile.errorscCs
d|jS)Nz<%s>)r)rrrrr*szStdioFile.namecCsdS)NTr)rrrrisattyszStdioFile.isattyN)rr)	rrrrpropertyrrr*rrrrrrs

rc@seZdZddZddZdS)
StdOutputFilecCsdS)NTr)rrrrwritableszStdOutputFile.writablecCs<|jrtdt||j|j|j|j}|j||j	S)Nzwrite to closed file)
closedrstrencoderrdecoderrr)rrrrrrszStdOutputFile.writeN)rrrrrrrrrrsrc@s4eZdZdZddZdddZd
ddZd	d
ZdS)StdInputFiler(cCsdS)NTr)rrrrreadableszStdInputFile.readabler'cCs|jrtd|dkrd}nt|ts8tdt|j|j}d|_|dkrlxb|j	}|s^P||7}qNWnDx(t
||kr|j	}|sP||7}qnW||d|_|d|}|S)Nzread from closed filer'zmust be int, not r(r)rr
isinstancer1rrFr_line_bufferrreadliner.)rrresultrrrrreads,


zStdInputFile.readcCs|jrtd|dkrd}nt|ts8tdt|j|jpF|j	}|dkrXt
|}|dd|}|dkrv|d}||d|_|d|S)Nzread from closed filer'zmust be int, not r
r&)rrrr1rrFrrrrr.find)rrrZeolrrrrs
zStdInputFile.readlinecCs|jdS)N)rclose)rrrrrszStdInputFile.closeN)r')r')rrrrrrrrrrrrrs


rc@s,eZdZddZddZddZddZd	S)
rOcCst|}|d||d|_t|jdtjtjt_	t
|jdtjtjt_t
|jdtjdt_t
jt_ddl}|j|_tj	|_t|d	|_t
jj|dd
ddS)zOverride base methodrxconsolestdinstdoutrbackslashreplacerNinterpg?)Zmyseqwait)	Executiveregisterget_remote_proxyrrrrrrrrrrrdisplayhookpydocZ
plainpagerZpagerZ_keep_stdinrr
RPCHandlerZgetresponse)rZ	executiverrrrhandles zMyHandler.handlecCstddS)z>override SocketIO method - wait for MainThread to shut us down
N)rLrM)rrrrexithookszMyHandler.exithookcCsdatdS)zEOverride SocketIO method - terminate wait on callback and exit threadTN)r=rr)rrrrEOFhook	szMyHandler.EOFhookcCsdatdS)zinterrupt awakened threadTN)r=rr)rrrrdecode_interrupthookszMyHandler.decode_interrupthookN)rrrrrrrrrrrrOsrOc@sNeZdZddZddZddZddZd	d
ZddZd
dZ	dddZ
dS)rcCs&||_tj|_t|_t|_dS)N)r{__main____dict__localsrZCalltiprZAutoComplete)rr{rrrrs
zExecutive.__init__c
Csy&d|_dazt||jWddaXWntk
r}z<|jrp|jd}t|tdtfspt	dt
|tjdWdd}~XYnJt
|_trtt|jjd}|r|jjYnXtdS)NTFrzSystemExit: )rz<<toggle-jit-stack-viewer>>)usr_exc_info
interruptablerxrr>r+rrFr1r2rrrr?r=r9r@r{rZgetvarrZopen_remote_stack_viewerrq)rcodeeZobZjitrrrruncodes(

&
zExecutive.runcodecCstrtdS)N)rrr)rrrrinterrupt_the_server8szExecutive.interrupt_the_servercCst|j|S)N)rZstart_debuggerr{)rZgui_adap_oidrrrstart_the_debugger<szExecutive.start_the_debuggercCs|j|dS)zDUnregister the Idb Adapter.  Link objects and Idb then subject to GCN)r{Z
unregister)rZidb_adap_oidrrrstop_the_debugger?szExecutive.stop_the_debuggercCs|j|S)N)rZ	fetch_tip)rr*rrrget_the_calltipCszExecutive.get_the_calltipcCs|j||S)N)rZfetch_completions)rZwhatmoderrrget_the_completion_listFsz!Executive.get_the_completion_listNcCsr|jr|j\}}}ndSd}|dk	r0|j|}x|rN|jjddkrN|j}q2W|t_|t_t	
||}t|S)Nr)rrun)
rr{rtb_frame	f_globalstb_nextrrrrsrZ
StackTreeItemrZremote_object_tree_item)rZ	flist_oidrgrvrHZflistitemrrrrIs
zExecutive.stackviewer)N)rrrrrrrrrrrrrrrrsrr)rIzidlelib.idle_test.test_run)	verbosity)N)NN)F)?rriorr<rrrLrA_threadrr4rZidlelibrrrrrrrrrWhasattrmodulesmoddelattrr	r6rrrr!ZTclr$r%r8r=rrIr5rPr@rdrqr9rXrrrrZ	RPCServerrN
TextIOBaserrrrrOobjectrrZunittestrrrr<module>st







M$(!1-C