%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyc

�
;�Pc@sVdZddlmZddlmZddlmZmZddlTddl	m
Z
ddlmZddl
Z
ddlZddlZddlZddlZddlZddlZddlZd	efd
��YZdfd��YZd
ejfd��YZdfd��YZdejfd��YZd�Zd�Zeaea dS(s4
    Support remote access to a Python interpreter.
i����(tcmd(thpy(theapyctTarget(t*(tConsole(t	mutbitsetNtSocketClosedcBseZRS((t__name__t
__module__(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyRstIsolatedCallercBseZd�Zd�ZRS(cCs
||_dS(N(tfunc(tselfR((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyt__init__scOs|j||�S(N(R(Rtargstkwds((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyt__call__s(RR	R
R(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR
s	tQueueWithReadlinecBseZdd�ZRS(i����cCs9x2y|jdd�SWqtjk
r0qqXqWdS(Nttimeoutg�?(tgettQueuetEmpty(Rtsize((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytreadline s
(RR	R(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyRst	NotiInputcBs)eZd�Zdd�Zdd�ZRS(cCs||_||_dS(N(tinputtoutput(RRR((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR
,s	i����cCs
|j|�S(N(R(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytread0scCs |jjt�|jj|�S(N(RtwritetREADLINERR(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR4s(RR	R
RR(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR+s	tAnnexcBs�eZejZejZdZdZdd�Z
d�Zd�Zd�Z
d�Zd�Zd�ZejjZd	�ZeZd
�Zd�ZdZd
�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#RS(is<Annex> cCs�tjj|�|dkr%t}nt|f|_||_t|j	�|_
d|_d|_t
j�|_i|_|jd�dS(Nit(RtCmdR
tNonet	HEAPYPORTt	LOCALHOSTtserver_addressttargetR
tasynch_closetclosetsockettisclosedtthreadt
allocate_lockt	closelockt	intlocalstdo_reset(RR%tport((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR
>s					cCsE|jj�z#|js/d|_|j�nWd|jj�XdS(Ni(R,tacquireR)t
disconnecttrelease(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR&Ps
		cCs)tj|j|j�|_xo|js�y|jj|j�WnCtk
rT�qtjk
r�|jrs�ntj	d�qXPqWdS|jj
ddd�|_t|jj
d�|j�|_
tj|_tjd
kr�d|_n|j�d|_tjj|d|j
d	|j�dS(Nitwtbufsizeitriitstdintstdout(ii(R(taddress_familytsocket_typeR)tconnectR$t
SystemExitterrorttimetsleeptmakefileR7RR6tsyststderrtversion_infot
interruptibletstart_ki_threadRR R
(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR:bs*
	!
	cstt���j�td�d�j��_�j�����fd�}tjd|dd�}|j�dS(NRRcs�z��jdj}xp��jkr��jj�}|s>Pn|tkru��jkr�tj�jj	t
�q�q�j|�qWWd��jkr�tj�jj	t�nXdS(Nthp(
R-t_hiding_tag_R(RRtKEYBOARDINTERRUPTRt
set_async_excR%tannex_threadtKeyboardInterrupttputR(RFtline(tostdintqueueRR((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytrun�s
R%R((RR6RRR(t	threadingtThreadtstart(RROtth((RMRNRR(sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyRD�s				cCsl|j}|dkrdSd|_y|jt�WnnXy|j�WnnXdt_tj�dS(N(R(R!tsendtDONER'R@tlast_tracebackt	exc_clear(RR(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR1�s			cCs|j�dS(Ni(R&(Rtarg((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytdo_close�s
cCs|jdIJdS(Ns�close
-----
Close and disable this remote connection completely.  It can then not
be reopened other than by some command from within the target process.

Normally you shouldn't need to use this command, because you can
return to the Monitor via other commands (<Ctrl-C> or .) keeping the
connection open.

But it might be useful when you want to get rid of the remote control
interpreter and thread, if it uses too much memory or disturbs the
target process in some other way.(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyt
help_close�scCs|jdIJdS(Ns�h(elp)
-----
Without argument, print the list of available commands.
With a command name as argument, print help about that command.(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pythelp_h�scCs�tj}tj}tj}z`|jt_|jt_|jt_tdtjdtjd|j�}|jd|j�Wd|t_|t_|t_XdS(NR6R7tlocalss8Remote interactive console. To return to Annex, type %r.(R@R6R7RARR-tinteracttEOF_key_sequence(RRXRMtostdouttostderrtcon((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytdo_int�s					cCs|jdIJdS(Ns{int
-----
Interactive console.
Bring up a Python console in the Remote Control interpreter.

This console will initially have access to a heapy constructor, named
hpy, and a ready-made instance, named hp, and the target (see also the
reset command).  Other things may be imported as needed.

After returning to the Annex (by q) or to the Monitor (by . or
<Ctrl-C>), the data in the interactive console will remain there - and
will be available till the next time the console is entered.  But the
data may be cleared and reset to the initial state - a new heapy
instance will be created - by the 'reset' command of Annex.

It should be noted that the interpreter thread under investigation is
executing in parallell with the remote control interpreter. So there
may be some problems to do with that if both are executing at the same
time. This has to be dealt with for each case specifically.(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pythelp_int�st a1e55f5dc4c9f708311e9f97b8098cd3c	Cs|jd}g}||_g}||j|j<td|j�|||jd|j|g}|j�}|j|�|@r�|jdIJxjt|�D]L\}}|j|�|@r�|jd|IJ|j|j|�jIJq�q�Wn
|jdIJ|`|j|j=dS(NREt0t__builtins__sIsolation test failed.s)-- Shortest Path(s) to testobjects[%d] --sIsolation test succeeded.(	R-t_at_bnametevaltheaptisoR7t	enumeratetshpaths(	RRXREtatbttestobjectsthtitv((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytdo_isolatests*
	
	
#
cCs|jdIJdS(Nsdisolatest
----------
Isolation test.

Test that the target interpreter heap view is isolated from the data
in the remote control interpreter. Data introduced here, eg in the
interactive console, should not be seen in the heap as reported by
hp.heap() etc. This is achieved by setting hp to not follow the
calling interpreter root.  However, this isolation may become broken.
This test is intended to diagnose this problem. The test checks that
none of a number of test objects is visible in the target heap
view. If the test failed, it will show the shortest path(s) to each of
the test objects that was visible.(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pythelp_isolatest'scCs|jdIJ|jdIJdS(Ns(To return to Monitor, type <Ctrl-C> or .s4To close this connection ('permanently'), type close(R7(RRX((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytdo_q6s
cCs|jdIJdS(Ns�q
-----
Quit.

This doesn't currently do anything except printing a message.  (I
thought it would be too confusing to have a q (quit) command from the
Annex, when there was a similarly named command in the Monitor.)(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pythelp_q:scCsV|jj�|jji|jd6|j�d6|jd6�|jd|jd<dS(NRRER%Rq(R-tcleartupdateRR%(RRX((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR.Ds
	

cCs|jdIJdS(Ns�reset
-----
Reset things to an initial state.

This resets the state of the interactive console data only, for now.
It is reinitialized to contain the following:

hpy	--- from guppy import hpy
hp      --- hp = hpy()
target  --- a reference to some data in the target interpreter
h       --- h = hp; h is a shorthand for hp

(The hpy function is modified here from the normal one so
it sets some options to make it be concerned with the target
interpreter heap under investigation rather than the current one.)
(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyt
help_resetOscCs�|jdIJ|jdIJ|jd|jjjIJ|jd|jjjIJ|jd|jjIJ|jd|jjIJ|jdIJ|js�|jdIJndS(NsTarget overviews$------------------------------------starget.sys.executable   = %sstarget.sys.argv         = %sstarget.wd               = %sstarget.pid              = %ds$noninterruptible interactive console(R7R%R@t
executabletargvtwdtpidRC(RRX((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytdo_statas


	cCs|jdIJdS(Ns�stat
-----
Print an overview status table, with data from the target interpreter.

In the table, sys.executable and sys.argv means the current values of
those attributes in the sys module of the target interpreter. The row
labeled target.wd is the working directory of the target interpreter,
at the time the Remote Control interpreter was started (the actual
working directory may have changed since that time). The row labeled
target.pid is the process id of the target interpreter.

(R7(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyt	help_statlscOsYddlm}|||�}d|j_|j|j_|j|jj_d|_|S(Ni����(Rishp.(tguppyRtViewtis_hiding_calling_interpreterR%RFR'treprefix(RRRRRE((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyRys	cCs�z�x�|js�|j�|js�|jd�xhy|j�Wq2tk
rTPq2ytjd|j�Wq2tjdtj�Pq2Xq2q2Xq2Wn|j	�qWWd|j
�XdS(NRtfile(R)R:RtcmdloopRt	tracebackt	print_excR7R@R1R&(R((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyRO�s&
	

N($RR	R(tAF_INETR8tSOCK_STREAMR9tuse_rawinputtpromptR!R
R&R:RDR1RYRZRR tdo_helptdo_hR[t	help_helpRbRcRhRtRuRvRwR.RzRR�RRO(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyR9s6				 	'										
				
		cCs^tdk	rdSttdd�r&dSd}tj�atj|itd6�att_dS(Nt#_is_guppy_heapy_remote_interpreter_is�# Set a flag to stop recursion when importing site
# in case sitecustomize tries to do Remote.on()
import sys
sys._is_guppy_heapy_remote_interpreter_ = 1
import site
from guppy.heapy import Remote
Remote.Annex(target).run()
R%(RIR!tgetattrR@RR%Rtinterpreter(tstart_annex((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyton�s	cCs�tdkrdSxRtd�D]A}y
tj}Wn#tk
rUdGHtjd�qX|�PqW�tj	tt
�daadS(Ni
s"Can not turn it off yet, waiting..i(RIR!trangeR%R'tAttributeErrorR=R>RRHR;(RrR'((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pytoff�s

(!t__doc__t	guppy.etcRR�Rtguppy.heapyRRtguppy.heapy.RemoteConstantstguppy.heapy.ConsoleRt
guppy.setsRtosR(R@R=R*RPR�Rt	ExceptionRR
RRR RR�R�R!RIR%(((sE/opt/alt/python27/lib64/python2.7/site-packages/guppy/heapy/Remote.pyt<module>s"
`�e		

Zerion Mini Shell 1.0