python (3.12.0)

(root)/
lib/
python3.12/
idlelib/
__pycache__/
run.cpython-312.opt-1.pyc

̑eSNdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
ZddlZddl
Z
ddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lmZddlZddlZeej2d
ds4dD]Zeeeej2d
ez=dej2d
_dZ	dZee_ee _d4dZ"	d5dZ#da$dZ%e%dejLZ'e'fdZ(da)da*da+d6dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZdZ3dZ4d Z5d!Z6d"Z7Gd#d$ejpZ9Gd%d&ejtZ;Gd'd(e;Z<Gd)d*e;Z=Gd+d,ej|Z?Gd-d.Z@eAd/k(rdd0lBm,Z,e,d1d23e%dy#e!$rYwxYw)7z 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)simpledialog
messageboxfontdialog
filedialogcommondialogttkztkinter.Fz	127.0.0.1zCtrl-D (end-of-file)cd}|d|d|dz
}|tj||}|j}|r|d|zz
}||jd|dz
}|S)zFormat warnings the IDLE way.z!
Warning (from warnings module):
z  File "z", line 
z    %s
: )	linecachegetlinestrip__name__)messagecategoryfilenamelinenoliness      ?/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/idlelib/run.pyidle_formatwarningr 3sy	.A9XJixr	22A|  62::<D	Z$
Hb		,,AHc	|tj}	|jt|||||y#t$rYywxYw)zuShow Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    N)sysstderrwriter OSError)rrrrfilers      ridle_showwarning_subprocr(@sH|zz


%8VT;	<

s3	??c|r't tjatt_yyttt_dayy)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)_warnings_showwarningwarningsshowwarningr()captures rcapture_warningsr.PsA ($,$8$8!#;H )!,#8H $(!-r!Tc&|jdy)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)tcls rhandle_tk_eventsr3`sHHXr!c|a	ttjd}t
ddgtjddtjtdt|ffdj		tr	t	tj j#dd	
}|r3|\}\}}}||i|}tj(j+||fn
t-t#t	dtj
YyxYw#t$rYwxYw#t$j&$rd}YwxYw#t$rt.rdaYt0$r
t
dtj2\}}	}
	t5tj(j+dfY0#t7j4||	|
tj
tYnxYwYxYw)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.r'NT
SockThread)targetnameargsdaemon皙?)blocktimeoutF)no_exitfuncintr#argvprint
__stderr__r.	threadingThread
manage_socket	LOCALHOSTstartexit_nowexitKeyboardInterruptr
request_queuegetqueueEmptyresponse_queueputr3quitting
SystemExitexc_infoprint_exception	traceback)del_exitfuncportrequestseqmethodr;kwargsrettypevaluetbs           rmainrbns*K388B< T$CHHQK
M&%t,. eg
$	F
++//dD/I
.5++fdFd-f-""&&Sz2 "'
?>>	#)
;;

!		U#
	!llnOD%
!""&&T{3
))$rOsqC&3D2:
D!D&?D2&D	DD2DD2D/,D2.D//D22G-G3+F!!3GGcrtdD])}tj|	t|t}n+t
dtjt|day|jy#t
$r:}t
d|jdzdztj|}Yd}~d}~wwxYw)NzIDLE Subprocess: OSError: z, retrying....r6z8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
rangetimesleepMyRPCServer	MyHandlerr&rCr;r#rDshow_socket_errorrJhandle_request)addressiservererrsocket_errors     rrGrGs
1X

1
	 )4F		*03	@,0
	.!<"#),
9L	sA33	B6<0B11B6cddl}ddlm}|j}t	||j|dd|dd|dd|jd	|jd
	||jy)z(Display socket error from manage_socket.rN)	showerrorzSubprocess Connection Errorz#IDLE's subprocess can't connect to :rez.
Fatal OSError #rzz.
See the 'Startup failure' section of the IDLE doc, online at
https://docs.python.org/3/library/idle.html#startup-failure)parent)	tkintertkinter.messageboxrsTkfix_scalingwithdrawerrnostrerrordestroy)rprmrvrsroots     rrkrks{,7::<DMMO
)1'!*QwqzlK!ii[3<<.9J
J
	LLNr!c@|ttfvrotj}t	j
|5t
j|||ddd|jjdddzgStj||S#1swYExYw)z,Return line composing the exception message.Nr)AttributeError	NameErrorioStringIO
contextlibredirect_stderrr#__excepthook__getvaluesplitrWformat_exception_only)typexcrarps    rget_message_linesrs
~y))kkm

'
'
,	-sC,	-$$T*2.566..sC88		-	-sBBc*ddl}|jttjtj
x\}}}}|\t_t_t_|t_	tfd|||y)Nrc>jt||j}|j}|8t|vr+
t	|||j
t
d	nE|C|js7t|vr*
t	|||j
t
d	|rGtj|}t
d	d}t||tj|	t|||}|D]}t
|d	y)NzF
The above exception was the direct cause of the following exception:
r6zE
During handling of the above exception, another exception occurred:
z"Traceback (most recent call last):)zrun.pyzrpc.pyzthreading.pyzqueue.pyz
debugger_r.pyzbdb.pyr7)endr')
addid__context__	__cause__r_
__traceback__rC__suppress_context__rW
extract_tbcleanup_traceback
print_listr)rrracontextcausetbeexcludelinesrefile	print_excseens         rrz"print_exception.<locals>.print_excsC//

E$!6d5k5%*=*=>28=
?!**k%d7mWg.C.CD28=
?
&&r*C6UC2Gc7+  51!#sB/	,D$BU+	,r!)r
checkcacheflush_stdoutr#r$rU	last_type
last_valuelast_tracebacklast_excset)rrvalraexcinforrrs     @@@rrVrVslINJJE \\^+LCb78?5CM3>3#5CL5D,2c3r!c|dd}|r'|D]}|ddj|snn|d=|r'|r'|D]}|ddj|snn|d=|r't|dk(r#|dd|ddtdtjt
jdj}tt|D]E}||\}}}}	|dk(rd}|	s'|jd	r|jd
d||fi}	||||	f||<Gy)zARemove excluded traces from beginning/end of tb; get cached linesNrr5z** IDLE Internal Exception: r6exec?z
-toplevel-z	<pyshell#rr)countlenrCr#r$robjecttable
rpchandlerrf
startswith
remotecall)
rarorig_tbrpcfilerrnfnlnnmrs
          rrrs0eG
	G!uQx~~g&	
qE


	G"vayw'	
rF

2w!|
1
,3::>(33J
3r7^!a5BD
9B

k2((i/12h<DBD 1!r!cy)zXXX How to do this now?Nrr!rrr0sr!cxtrddl}|jtdt	j
dy)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@atexit_clearr.r#rK)rs rrKrK3s&

UHHQKr!c(ddl}t|jjdd}|dkDrd|jj|D]E}|jj
||d}t|d}|dks5td	|z|d<Gyy)
zScale fonts on HiDPI displays.rNtkscalinggffffff?T)r~r:existssizeg)	tkinter.fontfloatrcallr
namesFontrAround)r~rvrr:r
rs      rryryBsDGGLLy12G}LL&&t,	1D<<$$$T$$GDtF|$Dax$U4Z0V		1r!c|j|jdznd}|tjtj|z|_y)Nz

r7)__doc__textwrapfilldedent)funtexttems   rfixdocrNs9$'KK$;3;;C

hood&;<<CKr!ctjtjfdt	dt
dtjtjfdt	dt
dt
dtjtjt
zt_t_y)	z9Install wrappers to always add 30 to the recursion limit.c|rtd	|\}|dkDstdj|tzS#t$rtdt|dwxYw)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;r]limitsetrecursionlimits   rrz:install_recursionlimit_wrappers.<locals>.setrecursionlimitXs@B
B	=FEqyAC
C!,,U5I-IJJ	=)),T7<=
=	=s	<"Az#            This IDLE wrapper adds z7 to prevent possible
            uninterruptible loops.c2jtz
SN)rr)getrecursionlimitsrrz:install_recursionlimit_wrappers.<locals>.getrecursionlimitms ,,.1EEEr!z(            This IDLE wrapper subtracts z# to compensate
            for the z" IDLE adds when setting the limit.N)	functoolswrapsr#rrrr)rrs@@rinstall_recursionlimit_wrappersrTs__S**+K,K #$$8#9:#&'__S**+F,F#))=(>?)**LPQ
#//14HHI-C-Cr!c\ttjddrttjddrutjjt_tjjt_tjtjt
z
yyy)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)getattrr#rrrrrr!r!uninstall_recursionlimit_wrappersr|sy
C))=$?C))=$? # 5 5 A A # 5 5 A Ac3358LLM	
@
@r!ceZdZdZy)ric	#t$rt$rdatjYyt
j}ttjdddtjjd|d|d	|tjd|	ttjd
d|datjYyxYw)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: r6i)rr'a
            *** 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)rTEOFErrorrJthreadinterrupt_mainr#rDrCrrrEcurrent_threadr:rWrrS)selfrZclient_addresserfs    rhandle_errorzMyRPCServer.handle_errors	$		$H!!#	$..C(//'

H--/4456""0!12[!
#


c4(//'
H
# #

$H!!#s(CB*CN)r
__module____qualname__rrr!rriris!$r!ricJeZdZddZedZedZedZdZy)	StdioFilec<||_||_||_||_yr)shelltags	_encoding_errors)rrrencodingerrorss     r__init__zStdioFile.__init__s
	!r!c|jSr)rrs rrzStdioFile.encodings~~r!c|jSr)rrs rrzStdioFile.errorss||r!c d|jzS)Nz<%s>)rrs rr:zStdioFile.names		!!r!cyNTrrs risattyzStdioFile.isattyr!N)zutf-8strict)	rrrrpropertyrrr:rrr!rrrsH""r!rceZdZdZdZy)
StdOutputFilecyrrrs rwritablezStdOutputFile.writablerr!c|jrtdtj||j|j
j
|j|j
}|jj||jS)Nzwrite to closed file)
closedrstrencoderrdecoderr%r)rrs  rr%zStdOutputFile.writes_;;344JJq$--5<<T]]DKKXzz499--r!N)rrrrr%rr!rrrs.r!rc,eZdZdZdZddZddZdZy)StdInputFiler7cyrrrs rreadablezStdInputFile.readablerr!c|jrtd|d}n1t|ts!t	dt|jz|j}d|_|dkr@|jjx}r"||z
}|jjx}r"|St||kr1|jj}|sn||z
}t||kr1||d|_|d|}|S)Nread from closed filer5must be int, not r7r)r	r
isinstancerArr_r_line_bufferrreadliner)rrresultrs    rreadzStdInputFile.reads;;455<DD#&/$t*2E2EEFF""!8**--//$/$**--//$/

f+$zz**,U$f+$!'tu
DET]F
r!cd|jrtd|d}n1t|ts!t	dt|jz|jxs|jj}|dkrt|}|jdd|}|dk\r|dz}||d|_|d|S)Nrr5rrrre)r	rrrArr_rrrrrfind)rrreols    rrzStdInputFile.readlines;;455<DD#&/$t*2E2EEFF  9DJJ$7$7$9!8t9Diia&!87D KET{r!c8|jjyr)rclosers rrzStdInputFile.closes

r!N)r5)rrrrrrrrrr!rrrsL* r!rc$eZdZdZdZdZdZy)rjct|}|jd||jd|_t	|jdt
jt
jt_	t|jdt
jt
jt_t|jdt
jdt_tjt_ddl}|j |_tj|_t'|jd	|_tj*j-|dd
y)zOverride base methodrconsolestdinstdoutr$backslashreplacerNinterpr=)myseqwait)	Executiveregisterget_remote_proxyr rrrrr#r!rr"r$rdisplayhookpydoc
plainpagerpager_keep_stdinrr$
RPCHandlergetresponse)r	executiver+s   rhandlezMyHandler.handlesdO	

fi(,,Y7 w!'&--A	"4<<#)??FMMC
"4<<#)??4FH
//&&99')++H5""4t$"?r!c.tjdy)z>override SocketIO method - wait for MainThread to shut us down
N)rgrhrs rexithookzMyHandler.exithook"s


2r!c0datjy)zEOverride SocketIO method - terminate wait on callback and exit threadTNrSrrrs rEOFhookzMyHandler.EOFhook&r!c0datjy)zinterrupt awakened threadTNr7rs rdecode_interrupthookzMyHandler.decode_interrupthook,r9r!N)rrrr2r5r8r;rr!rrjrjs@4  r!rjc>eZdZdZdZdZdZdZdZdZ	d
d	Z
y)r'c||_tjdurHtj|_t
j|_tj|_yi|_y)NF)
ridlelibtesting__main____dict__localsrCalltiprAutoComplete)rrs  rrzExecutive.__init__5sH$??e#"++DK"??,DL , 9 9 ;DDKr!c>	d|_da	t||jda	t	y#dawxYw#t
$rq}|jr[|jd}t|tdtfs,tdt|ztjYd}~yYd}~yYd}~yd}~wtj|_tr
t!tj"tj$urt'nH	tj"|jn*#tj|_t'YnxYw|j(j*j-d}|r&|j(j.j1YyYyxYw)NTFrzSystemExit: r6z<<toggle-jit-stack-viewer>>)
user_exc_info
interruptablerrBrrTr;rr_rArCr
r#r$rUrSrK
excepthookrrVrr getvarr$open_remote_stack_viewer)rcodeeobjits     rruncodezExecutive.runcode>s1	!%D M
&T4;;' %
.
N/!&
	EvvVVAY!"tDz3&78.3r72DD9
	B!$D~~!3!33!&NND$6$67&),D&#%//))001NOC&&??As@	70747	FAB,,AFD#"F#%E
AFc:trtjyyr)rGrrrs rinterrupt_the_serverzExecutive.interrupt_the_server_s!!#r!cBtj|j|Sr)rstart_debuggerr)rgui_adap_oids  rstart_the_debuggerzExecutive.start_the_debuggercs((,GGr!c:|jj|y)zDUnregister the Idb Adapter.  Link objects and Idb then subject to GCN)r
unregister)ridb_adap_oids  rstop_the_debuggerzExecutive.stop_the_debuggerfs""<0r!c8|jj|Sr)r	fetch_tip)rr:s  rget_the_calltipzExecutive.get_the_calltipjs||%%d++r!c:|jj||Sr)rfetch_completions)rwhatmodes   rget_the_completion_listz!Executive.get_the_completion_listms  224>>r!Ncn|jr|j\}}}nyd}||jj|}|rE|jjddvr*|j
}|r|jjddvr*||_tj||}tj|S)Nr)rrun)rFrr)tb_frame	f_globalstb_nextrr	
StackTreeItemrremote_object_tree_item)r	flist_oid_rraflistitems       rr	zExecutive.stackviewerps++JAsB OO44Y?ER[[**:6.HBR[[**:6.H((e411$77r!r)rrrrrOrQrUrYr\rar	rr!rr'r'3s,B$H1,?8r!r'r@)rbzidlelib.idle_test.test_run)	verbosityr)NN)F)CrrrrrrOr#rrgrW_threadrrEr+r>rrrrrrr	r@rvhasattrmodulesmoddelattrr
rHeofrKquitrr r(r*r.Tclr2r3rJrSrGrbrGrkrrVrrryrrrr	RPCServerri
TextIOBaserrrr/rjr'runittestrr!r<module>rzs	
 s{{=):6*	KK
S()	*+0CKK
'		
 CDHDH

>B
)gkkm
L\&"	9#J!>"	1=%.PN#$#--#$P

0	.I	.,9,^* * ZI8I8Xz	%3i		s6FF$#F$