ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/guppy/heapy/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/guppy/heapy/__pycache__/Remote.cpython-311.pyc

�

�܋f>=���dZddlmZddlmZddlmZmZddlTddl	m
Z
ddlmZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZGd	�d
e��ZGd�d��ZGd
�dej��ZGd�d��ZGd�d��ZGd�dej��Zd�Z d�Z!da"da#e
j$e!��dS)z4
    Support remote access to a Python interpreter.
�)�cmd��hpy)�heapyc�Target)�*)�Console)�	mutbitsetNc��eZdZdS)�SocketClosedN)�__name__�
__module__�__qualname__���e/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/guppy/heapy/Remote.pyrrs�������Drrc��eZdZd�Zd�ZdS)�IsolatedCallerc��||_dS�N��func)�selfrs  r�__init__zIsolatedCaller.__init__"s
����	�	�	rc��|j|i|��Srr)r�args�kwdss   r�__call__zIsolatedCaller.__call__%s���t�y�$�'�$�'�'�'rN)r
rrrrrrrrrs2���������(�(�(�(�(rrc��eZdZdd�ZdS)�QueueWithReadline���c�\�		|�d���S#tj$rY�)wxYw)N���?)�timeout)�get�queue�Empty�r�sizes  r�readlinezQueueWithReadline.readline*sB��	�
��x�x��x�,�,�,���;�
�
�
���
���s��+�+N�r!)r
rrr+rrrr r )s(�����������rr c�2�eZdZd�Zed���Zdd�ZdS)�InterruptableSocketc��||_|jj|_|jj|_|jj|_|jj|_|jj|_dSr)�_backing�fileno�close�readable�writable�seekable)r�backings  rrzInterruptableSocket.__init__6sI����
��m�*����]�(��
��
�.��
��
�.��
��
�.��
�
�
rc��|jjSr)r0�closed�rs rr8zInterruptableSocket.closed>s
���}�#�#rr!c��tj|gggd��ds	tj|gggd��d�|j�|��S)Nr$r)�selectr0�readr)s  rr<zInterruptableSocket.readBs]���-����B��4�4�Q�7�	���-����B��4�4�Q�7�	��}�!�!�$�'�'�'rNr,)r
rrr�propertyr8r<rrrr.r.5sR������/�/�/��$�$��X�$�(�(�(�(�(�(rr.c�$�eZdZd�Zdd�Zdd�ZdS)�	NotiInputc�"�||_||_dSr��input�output)rrBrCs   rrzNotiInput.__init__Js����
�����rr!c�,�|�|��Sr)r+r)s  rr<zNotiInput.readNs���}�}�T�"�"�"rc�t�|j�t��|j�|��Sr)rC�write�READLINErBr+r)s  rr+zNotiInput.readlineRs.������(�#�#�#��z�"�"�4�(�(�(rNr,)r
rrrr<r+rrrr?r?IsK���������#�#�#�#�)�)�)�)�)�)rr?c���eZdZejZejZdZdZ	dd�Z
d�Zd�Zd�Z
d�Zd	�Zd
�ZejjZd�ZeZd�Zd
�ZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#dS)�Annexrz<Annex> Nc�b�tj�|��|�t}t|f|_||_|jjd�	|j
��|_d|_d|_
tj��|_i|_|�d��dS)Nzguppy.heapy.Remoter�)r�Cmdr�	HEAPYPORT�	LOCALHOST�server_address�target�sys�modulesr�asynch_closer2�socket�isclosed�_thread�
allocate_lock�	closelock�	intlocals�do_reset)rrP�ports   rrzAnnex.__init__]s������������<��D�(�$�/�������z�)�*>�?�N�N������������
� �.�0�0���
����
�
�b�����rc���|j���	|jsd|_|���|j���n#|j���wxYwt|d��rX|j���rCtj	d��t|d��r|j����=dSdSdSdS)Nr#�thr$)
rX�acquirerU�
disconnect�release�hasattrr]�is_alive�time�sleepr9s rrSzAnnex.asynch_closens���	
���� � � �	%��=�
"� !��
����!�!�!��N�"�"�$�$�$�$��D�N�"�"�$�$�$�$�����d�D�!�!�	�d�g�&6�&6�&8�&8�	��J�s�O�O�O��d�D�!�!�	�d�g�&6�&6�&8�&8�	�	�	�	�	�	�	�	�	s�"A�A2c
���tj|j|j��|_|jsc	|j�|j��nD#t$r�tj$r|jr�tj	d��YnwxYw|j�cdStj|j�dd���dd���|_
ttjt|j�dd�����dd���|j
��|_t"j|_|���t(j�||j|j
�	��dS)
N��wbr)�	bufferingzutf-8T)�encoding�
write_through�rb)�stdin�stdout)rT�address_family�socket_typerU�connectrO�
SystemExit�errorrcrd�io�
TextIOWrapper�makefilermr?r.rlrQ�stderr�start_ki_threadrrLrr9s rrpz
Annex.connect�s���m�D�$7�$(�$4�6�6����-�	�	
���#�#�D�$7�8�8�8����
�
�
���<�
�
�
��=����
�1�
�
�
�
�
�
�����-�	�
�F��&��K� � ��� �3�3��D�2�2�2����r�/���� 4� 4�T�Q� 4� G� G�H�H��D� 2� 2� 2�37�;�@�@��
��j��������������T�Z����D�D�D�D�Ds�A
�
5B�Bc�,�����t����j�t��j����_�j�����fd�}tj|d����_�jdj	�j_	�j�
��dS)NrAc���	��jurn�j���}|snR|tkr.��jur$t	j�jjt��n�j	|����ju�n��jur&t	j�jjt��dSdS#��jur%t	j�jjt��wwxYwr)rTrBr+�KEYBOARDINTERRUPTr�
set_async_excrP�annex_thread�KeyboardInterrupt�putr)�line�ostdinr'rrTs ����r�runz"Annex.start_ki_thread.<locals>.run�s���
7����+�+�!�<�0�0�2�2�D�����0�0�0�!�T�[�0�0�"�0���1I�1B�D�D�D��"��	�$�������+�+��T�[�(�(��(���)A�)5�7�7�7�7�7�)�(��6�T�[�(�(��(���)A�)5�7�7�7�7�)���s�A7B+�+0Cr)rPr�hp)r rlr?rCrT�	threading�Threadr]rY�_hiding_tag_�start)rr�r�r'rTs` @@@rrwzAnnex.start_ki_thread�s�������"�#�#������U�&,�m�5�5�5��
����	7�	7�	7�	7�	7�	7�	7�	7�"�"�#�(*�,�,�,���#�~�d�3�@������
�
�����rc�H�|j}|�dSd|_	|�t��n#t$rYnwxYw	|�tj��n#t$rYnwxYw	|���n#t$rYnwxYwdt_dSr)	rT�send�DONE�	Exception�shutdown�	SHUT_RDWRr2rQ�last_traceback)r�socks  rr_zAnnex.disconnect�s����{���<��F����	��I�I�d�O�O�O�O���	�	�	��D�	����	��M�M�&�*�+�+�+�+���	�	�	��D�	����	��J�J�L�L�L�L���	�	�	��D�	����!����s0�/�
<�<�A � 
A-�,A-�1B�
B�Bc�.�|���dS)Nr#)rS�r�args  r�do_closezAnnex.do_close�s���������qrc�2�td|j���dS)Na�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.��file��printrmr9s r�
help_closezAnnex.help_close�s/��
�%�,0�;�	8�	8�	8�	8�	8�	8rc�2�td|j���dS)Nz�h(elp)
-----
Without argument, print the list of available commands.
With a command name as argument, print help about that command.r�r�r9s r�help_hzAnnex.help_h�s8��
�C�JN��	V�	V�	V�	V�	V�	Vrc���tj}tj}tj}	|jt_|jt_|jt_t	tjtj|j���}|�d|jz��|t_|t_|t_dS#|t_|t_|t_wxYw)N)rlrm�localsz8Remote interactive console. To return to Annex, type %r.)rQrlrmrvr	rY�interact�EOF_key_sequence)rr�r��ostdout�ostderr�cons      r�do_intzAnnex.do_int�s�������*���*��	!��
�C�I���C�J���C�J���	�#�*�!%��1�1�1�C��L�L�J��$�%�
&�
&�
&�
�C�I� �C�J� �C�J�J�J���C�I� �C�J� �C�J� � � � s�A;C�&C-c�2�td|j���dS)Na{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.r�r�r9s r�help_intzAnnex.help_ints7��
�?�$FJ�[�%	R�	R�	R�	R�	R�	Rr� a1e55f5dc4c9f708311e9f97b8098cd3c�N�|jd}g}||_g}||j|j<td|j��|||jd|j|g}|���}|j|�|zr�t
d|j���t|��D]d\}}|�|��|zrGt
d|z|j���t
|�|��j	|j����ent
d|j���|`|j|j=dS)Nr��0�__builtins__zIsolation test failed.r�z)-- Shortest Path(s) to testobjects[%d] --zIsolation test succeeded.)
rY�_a�_bname�eval�heap�isor�rm�	enumerate�shpaths)	rr�r��a�b�testobjects�h�i�vs	         r�do_isolatestzAnnex.do_isolatest#sI��
�^�D�
!���������&'���t�{�#��S�$�.�!�!�!����~�n�5��~��	��
�G�G�I�I���2�6�;��!�#�	A��*���=�=�=�=�!�+�.�.�
?�
?���1��6�6�!�9�9�q�=�?��C�a�G�d�k�[�[�[�[��"�&�&��)�)�+�$�+�>�>�>�>��	
?�
�-�D�K�@�@�@�@��G��N�4�;�'�'�'rc�2�td|j���dS)Nadisolatest
----------
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.r�r�r9s r�help_isolatestzAnnex.help_isolatestAs/��
�&�-1�K�	9�	9�	9�	9�	9�	9rc�^�td|j���td|j���dS)Nz(To return to Monitor, type <Ctrl-C> or .r�z4To close this connection ('permanently'), type closer�r�s  r�do_qz
Annex.do_qPs4��
�8�t�{�K�K�K�K�
�D�4�;�W�W�W�W�W�Wrc�2�td|j���dS)Nz�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.)r�r�r9s r�help_qzAnnex.help_qTs8��
�D�KO�+�
	W�	W�	W�	W�	W�	Wrc���|j���|j�|j|���|jd���|jd|jd<dS)N)rr�rPr�r�)rY�clear�updaterrPr�s  rrZzAnnex.do_reset]sj��������������H��8�8�:�:��{�
�
�	�	�	�#�n�T�2���s���rc�2�td|j���dS)Nareset
-----
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.)
r�r�r9s r�
help_resetzAnnex.help_reseths/��
���+�	�	�	�	�	�	rc��td|j���td|j���td|jjjz|j���td|jjjz|j���td|jjz|j���td|jjz|j���td|j���dS)NzTarget overviewr�z$------------------------------------ztarget.sys.executable   = %sztarget.sys.argv         = %sztarget.wd               = %sztarget.pid              = %d)r�rmrPrQ�
executable�argv�wd�pidr�s  r�do_statz
Annex.do_statzs���
��d�k�2�2�2�2�
�4�4�;�G�G�G�G�
�,��k�o�(�)�/3�{�	<�	<�	<�	<�
�,��k�o�"�#�)-��	6�	6�	6�	6�
�,��k�n��#'�;�	0�	0�	0�	0�
�,��k�o��$(�K�	1�	1�	1�	1�
�4�4�;�G�G�G�G�G�Grc�2�td|j���dS)Na�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.

r�r�r9s r�	help_statzAnnex.help_stat�s/��
���+�	�	�	�	�	�	rc��ddlm}||i|��}d|j_|j|j_|j|j_|j|jj_d|_|S)Nrrr#zhp.)�guppyr�View�is_hiding_calling_interpreterrPr�r2�reprefix)rrrrr�s     rrz	Annex.hpy�sd��������
�S�$�
�$�
�
��01���-������#%�?��� �)+�����&�����	rc��	|js�|���|js�|�d��		|���ng#t$rYn\t
$rO	t
j|j���n0#t
$r#t
jtj���YYnwxYwY�zwxYw�~|�
��|j��|���dS#|���wxYw)NrKr#r�)rUrpr��cmdlooprr��	traceback�	print_excrmrQr_rSr9s rr�z	Annex.run�s7��	 ��m�
"��������}�
%��L�L��$�$�$�%�
%� �L�L�N�N�N�N��+�"�"�"�!�E�(�%�%�%�&� )� 3��� E� E� E� E� E��#,�&�&�&� )� 3��� D� D� D� D� %���&����%�H�
%����%����!�!�!�!�m�
"�*
���������D���������sd�8C)�A�C)�
B4�C)�	B4�&B�B4�)B.�*B4�+C)�-B.�.B4�1C)�3B4�4C)�)C?r)$r
rrrT�AF_INETrn�SOCK_STREAMro�use_rawinput�promptrrSrprwr_r�r�rrL�do_help�do_hr��	help_helpr�r�r�r�r�r�r�rZr�r�r�rr�rrrrIrIWs��������^�N��$�K��L�
�F�����"���(E�E�E�:!�!�!�F"�"�"�&���8�8�8��7�?�D�V�V�V��I�!�!�!�6R�R�R�*0�F�(�(�(�<
9�
9�
9�X�X�X�W�W�W�	3�	3�	3����$H�H�H������� � � � � rrIc���t�dSttdd��rdSd}tj��atj|dti��att_dS)N�#_is_guppy_heapy_remote_interpreter_rz�# 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()
rP)r|�getattrrQrrPr�interpreter)�start_annexs r�onr��sb�������s�9�1�=�=�����K��]�_�_�F��%�k�H�f�3E�F�F�L�&�F���rc�n�t�dStd��D]>}	tj}|��n%#t$rtjd��Y�;wxYw�tjtt��	ttjdtz��sntjd���8dxaadS)N�
g�������?Tz
t%d_async_exc)r|�rangerPr2�AttributeErrorrcrdrr{rqra�	RootState)r�r2s  r�offr��s�������
�2�Y�Y����	��L�E�
�E�G�G�G��E��
�	�	�	�
�J�t������	����	�
���z�2�2�2���v�'��<�)G�H�H�	���J�t����	�!� �L�6�6�6s�4�A�A)%�__doc__�	guppy.etcrr�r�guppy.heapyrr�guppy.heapy.RemoteConstants�guppy.heapy.Consoler	�
guppy.setsr
�atexitrsr'r;rTrQrcrVr�r�r�rr�Queuer r.r?rLrIr�r�r|rP�registerrrr�<module>r�s"����������������&�&�&�&�&�&�&�&�)�)�)�)�'�'�'�'�'�'� � � � � � �
�
�
�
�	�	�	�	�����
�
�
�
�
�
�
�
�
�
�
�
�����������������	�	�	�	�	�9�	�	�	�
(�
(�
(�
(�
(�
(�
(�
(�	�	�	�	�	���	�	�	�(�(�(�(�(�(�(�(�()�)�)�)�)�)�)�)�_ �_ �_ �_ �_ �C�G�_ �_ �_ �D'�'�'�,!�!�!�8��	
����������r

Zerion Mini Shell 1.0