%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/idlelib/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/idlelib/__pycache__/run.cpython-38.pyc

U

qaQ@sBdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddl
Z
ddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZdd	l
mZddlZddlZeejd
dsdD]Zeeeejd
e=qdejd
_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;Z;e<d<kr6dd=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commondialogttkztkinter.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__)messagecategoryfilenamelinenolinesr'/usr/local/lib/python3.8/idlelib/run.pyidle_formatwarning+srcCsB|dkrtj}z|t|||||Wntk
r<YnXdS)zuShow Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    N)sysstderrwriterOSError)rrrrfilerrrridle_showwarning_subproc8s
rcCs0|rtdkr,tjatt_ntdk	r,tt_dadS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)_warnings_showwarningwarningsshowwarningr)capturerrrcapture_warningsHsr#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_eventsXsr'cCs|az$ttjdkstttjd}WntdtjdYdSXtddgtjdd<t	j
tdt|ffd	}d|_
|ztrz
tWntk
rYWqYnXztjjdd
d}Wntjk
rd}YnX|r|\}\}}}|||}tj||fntWqtk
r:tr2daYqYqtk
rXtdYqt\}	}
}zttj|dfWn&tj|	|
|tjdtYnXYqYqXqdS)
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)targetnameargs皙?)blocktimeoutF)no_exitfunclenrargvAssertionErrorintprint
__stderr__r#	threadingThread
manage_socket	LOCALHOSTdaemonstartexit_nowexitKeyboardInterruptrZ
request_queuegetqueueEmptyZresponse_queueputr'quitting
SystemExitexc_infoprint_exception	traceback)Zdel_exitfuncportZ
sockthreadrequestseqmethodr.kwargsrettypevaluetbrrrmainfs`



rTcCstdD]f}t|zt|t}WqWqtk
rl}z$td|jddtj	d|}W5d}~XYqXqtdtj	dt
||dadS|dS)NzIDLE Subprocess: OSError: r(z, retrying....r*z8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
rangetimesleepMyRPCServer	MyHandlerrr7r.rr8show_socket_errorr?Zhandle_request)addressiZservererrZsocket_errorrrrr;s&



r;cCslddl}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.messageboxr_ZTkfix_scalingZwithdrawerrnostrerrorZdestroy)r^r\rbr_rootrrrr[s(r[csdddl}|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||}|D]}t|ddqdS)NzF
The above exception was the direct cause of the following exception:
r*zE
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__rQ
__traceback__r7__suppress_context__rJ
extract_tbcleanup_traceback
print_listformat_exception_only)	typexcrScontextcauseZtbeexcludelinesrZefile	print_excseenrrrys4


z"print_exception.<locals>.print_exc)
r
checkcacheflush_stdoutrrrH	last_type
last_valuelast_tracebackset)rrrvalrSexcinforrxrrIsrIc
Cs|dd}|r:|D]}|dd|rq2qq:|d=q|rh|D]}|dd|rBq`qBqh|d=q:t|dkr|dd|dd<tdtjdtjdj}tt|D]R}||\}}}}	|dkrd}|	s|	d	r|
d
d||fi}	||||	f||<qdS)zARemove excluded traces from beginning/end of tb; get cached linesNrr)z** IDLE Internal Exception: r*exec?z
-toplevel-z	<pyshell#rr
)countr3r7rrrZobjecttable
rpchandlerrV
startswithZ
remotecall)
rSrvZorig_tbZrpcfilerr]fnZlnZnmrrrrros6rocCsdS)zXXX How to do this now?Nrrrrrr|sr|cCs*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)r2atexit_clearr#rr@)rrrrr@s
r@cCsnddl}t|jdd}|dkrj|j|D]:}|jj||dd}t|d}|dkr.td	||d<q.dS)
zScale fonts on HiDPI displays.rNtkscalinggffffff?T)rfr-existssizeg)	Ztkinter.fontfloatrcallr
namesZFontr6round)rfrbrr-r
rrrrrc+srccCs2|jdk	r|jdnd}|tt||_dS)Nz

r+)__doc__textwrapfilldedent)ZfuntextZtemrrrfixdoc7srcs|ttjfddtdtdttjfddtdtdtd	tttt_t_d
S)z9Install wrappers to always add 30 to the recursion limit.cs^|rtdz
|\}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
ValueErrorr3__wrapped__RECURSIONLIMIT_DELTA)r.rOlimit)setrecursionlimitrrrAs
z:install_recursionlimit_wrappers.<locals>.setrecursionlimitz#            This IDLE wrapper adds z7 to prevent possible
            uninterruptible loops.cstSN)rrr)getrecursionlimitrrrVsz: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=s



rcCsFttjddrBttjddrBtjjt_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_wrapperses

rc@seZdZddZdS)rYcCszWntk
rYntk
r:datYnvtj}tt	dddt
jd|d|d	|dt
jd|d	tt	d
d|ddatYnXdS)zrOverride RPCServer method for IDLE

        Interrupt the MainThread and exit server if link is dropped.

        Tz
            z(----------------------------------------zU
            Unhandled exception in user code execution server!'
            Thread: z"
            IDLE Client Address: z
            Request: r*i)rra
            *** Unrecoverable, server exiting!

            Users should never see this message; it is likely transient.
            If this recurs, report this with a copy of the message
            and an explanation of how to make it repeat.
            N)rGEOFErrorr?threadinterrupt_mainrr8r7rrr9current_threadr-rJryrF)selfrLZclient_addresserfrrrhandle_errorvs4zMyRPCServer.handle_errorN)r
__module____qualname__rrrrrrYtsrYc@sBeZdZdddZeddZeddZed	d
ZddZd
S)	StdioFileutf-8strictcCs||_||_||_||_dSr)shelltags	_encoding_errors)rrrencodingerrorsrrr__init__szStdioFile.__init__cCs|jSr)rrrrrrszStdioFile.encodingcCs|jSr)rrrrrrszStdioFile.errorscCs
d|jS)Nz<%s>)rrrrrr-szStdioFile.namecCsdSNTrrrrrisattyszStdioFile.isattyN)rr)	rrrrpropertyrrr-rrrrrrs



rc@seZdZddZddZdS)
StdOutputFilecCsdSrrrrrrwritableszStdOutputFile.writablecCs<|jrtdt||j|j|j|j}|j||j	S)Nzwrite to closed file)
closedrstrencoderrdecoderrr)rrrrrrszStdOutputFile.writeN)rrrrrrrrrrsrc@s4eZdZdZddZdddZd
ddZd	d
ZdS)StdInputFiler+cCsdSrrrrrrreadableszStdInputFile.readabler)cCs|jrtd|dkrd}nt|ts8tdt|j|j}d|_|dkrh|j	}|s\q||7}qLn@t
||kr|j	}|sq||7}qh||d|_|d|}|S)Nread from closed filer)must be int, not r+r)rr
isinstancer6rrQr_line_bufferrreadliner3)rrresultrrrrreads*



zStdInputFile.readcCs|jrtd|dkrd}nt|ts8tdt|j|jpF|j	}|dkrXt
|}|dd|}|dkrv|d}||d|_|d|S)Nrr)rr
r()rrrr6rrQrrrrr3find)rrrZeolrrrrs
zStdInputFile.readlinecCs|jdSr)rcloserrrrrszStdInputFile.closeN)r))r))rrrrrrrrrrrrrs


rc@s,eZdZddZddZddZddZd	S)
rZcCst|}|d||d|_t|jdtjtjt_	t
|jdtjtjt_t
|jdtjdt_t
jt_ddl}|j|_tj	|_t|d	|_t
jj|dd
ddS)zOverride base methodrconsolestdinstdoutrbackslashreplacerNinterpr/)Zmyseqwait)	Executiveregisterget_remote_proxyrrrrrrrrrrrdisplayhookpydocZ
plainpagerZpagerZ_keep_stdinrr
RPCHandlerZgetresponse)rZ	executiverrrrhandles,zMyHandler.handlecCstddS)z>override SocketIO method - wait for MainThread to shut us down
N)rWrXrrrrexithook
szMyHandler.exithookcCsdatdS)zEOverride SocketIO method - terminate wait on callback and exit threadTNrFrrrrrrEOFhookszMyHandler.EOFhookcCsdatdS)zinterrupt awakened threadTNrrrrrdecode_interrupthookszMyHandler.decode_interrupthookN)rrrrrrrrrrrrZsrZc@sNeZdZddZddZddZddZd	d
ZddZd
dZ	dddZ
dS)rcCs8||_tjdkr.tj|_t|_t	|_ni|_dS)NF)
ridlelibZtesting__main____dict__localsrZCalltiprZAutoComplete)rrrrrr s

zExecutive.__init__c
Cs
z&d|_dazt||jW5daXWntk
r}z<|jrp|jd}t|tdtfspt	dt
|tjdW5d}~XYnt
|_trttjtjkrtn.ztj|jWnt
|_tYnX|jjd}|r|jjYnXtdS)NTFrzSystemExit: r*z<<toggle-jit-stack-viewer>>)
user_exc_info
interruptablerrrGr.rrQr6r7rrrrHrFr@
excepthook__excepthook__rIrrZgetvarrZopen_remote_stack_viewerr|)rcodeeobZjitrrrruncode)s4

&

zExecutive.runcodecCstrtdSr)rrrrrrrinterrupt_the_serverJszExecutive.interrupt_the_servercCst|j|Sr)rZstart_debuggerr)rZgui_adap_oidrrrstart_the_debuggerNszExecutive.start_the_debuggercCs|j|dS)zDUnregister the Idb Adapter.  Link objects and Idb then subject to GCN)r
unregister)rZidb_adap_oidrrrstop_the_debuggerQszExecutive.stop_the_debuggercCs|j|Sr)rZ	fetch_tip)rr-rrrget_the_calltipUszExecutive.get_the_calltipcCs|j||Sr)rZfetch_completions)rZwhatmoderrrget_the_completion_listXsz!Executive.get_the_completion_listNcCsn|jr|j\}}}ndSd}|dk	r0|j|}|rL|jjddkrL|j}q0|t_|t_t	
||}t|S)Nr)rrun)
rrrtb_frame	f_globalstb_nextrr}r~rZ
StackTreeItemrZremote_object_tree_item)rZ	flist_oidrrrrSflistitemrrrr[szExecutive.stackviewer)N)rrrrrrrrrrrrrrrrs	!rr)rTzidlelib.idle_test.test_run)	verbosity)N)NN)F)>rriorrCrrrWrJ_threadrr9r rrrrrrrrrrbhasattrmodulesmoddelattrr	r<rrrr#ZTclr&r'r?rFrrTr;r[rIror|r@rcrrrrZ	RPCServerrY
TextIOBaserrrrrZrrZunittestrrrr<module>sz





M$((1-M


Zerion Mini Shell 1.0