ok

Mini Shell

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

�

�܋f:���ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z		ddl
Z
n#e$rYnwxYwddlZddl
Z
ddlTddlmZddlmZddlmZddlmZGd�dej��Zd	�Zdd
�ZdZGd�d
ej��ZGd�dej��ZGd�d��Z d�Z!e"dkre!��dSdS)�N)�*)�Console)�
mutnodeset)�ptable)�cmdc��eZdZdS)�ServerN)�__name__�
__module__�__qualname__���f/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/guppy/heapy/Monitor.pyr	r	s�������Drr	c�X�tj|ggg|��\}}}t|��S�N)�select�len)�fd�wait�r�w�xs     r�ioreadyrs*���m�R�D�"�b�$�/�/�G�A�q�!��q�6�6�Mrc�h�		|�d���S#tj$r|rYdSYnwxYw�2)N�g�������?)�timeout)�get�queue�Empty)�q�noblocks  r�queue_get_interruptibler"$s[���	��5�5��5�%�%�%���{�	�	�	��
����
�
�	����s��0�0)�CLOSEDc�>�eZdZdZd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
S)�Handlerrc� �|j�d��ss|jj�|��|j�t��|j�	d��|j�
��dSdS)Nr�)�isclosed�tas�server�monitor�remove_connection�dataq�put�CONN_CLOSED�request�shutdown�close��selfs rr2z
Handler.close5s����}� � ��#�#�	!��K��1�1�$�7�7�7��J�N�N�;�'�'�'��L�!�!�!�$�$�$��L��� � � � � �		!�	!rc��|jd��s|dz
}|j�|jd����dS)N�
�utf-8)�endswithr0�send�encode�r4rs  r�send_cmdzHandler.send_cmd<sG���s�|�D�!�!�	��4�K�C�����*�#�*�W�-�-�.�.�.�.�.rc��|jdkr|�dd���|jdkr|�dd���|�|d���S)Nz>>> r r)�retdataz<Annex> �cont)�prompt�exec_cmdr;s  r�browser_cmdzHandler.browser_cmdAs^���;�&� � ��M�M�#�q�M�)�)�)��;�*�$�$��M�M�&�!�M�,�,�,��}�}�S�!�}�,�,�,rrc�6�|�|�|��d|_g}	t|j|��}|�|jrn�t	jd���5|turt�|ddkrKd|_|r|�|d��njtj
�|d��nD|ddkr6|d|_|j�
��rd|_nd|_nJ���|rd�|��SdS)NFrr�DATA�PROMPTT�)r<�promptstater"r-�time�sleepr/�EOFError�append�sys�stdout�writer@�empty�join)r4rr>r!�datas�ps      rrAzHandler.exec_cmdHs6���?��M�M�#����$�D����	�'��
�G�<�<�A��y��#����J�q�M�M�M���K�������t�v�~�~�#(�� ��+��L�L��1��&�&�&�&��J�$�$�Q�q�T�*�*�*�*��1���!�!���d����:�#�#�%�%�-�'+�D�$��',�D�$�$��q�1	�2�	"��7�7�5�>�>�!�	"�	"rc���|j�d��D]S}|�|��r<d|vr4|�d��}||dzd����}|cS�TdS)Nr6�=rrF)�	firstdata�split�
startswith�index�strip)r4�name�line�ixs    r�get_pszHandler.get_psis���N�(�(��.�.�	�	�D����t�$�$�
��$�;�;����C���B���1����;�,�,�.�.�D�����	
�
�rrc�Z�|�d|z��}tj|��S)Nzdump %s)rB�pickle�loads)r4�expr�datas   r�get_valzHandler.get_valrs*�����	�D� 0�1�1���|�D�!�!�!rc��d|_d|_t��|_t	j��|_|jj�	|��		|j
����d��}|std���|�t��rtd���n#tt jf$rYn�wxYw|�t$��r]|dt't$���}|j�d|f��|j�|�dd���|_n|j�d|f����|���dS)	NFrr7zEnd of file�DONErE)rr>rD)r@rGrr(r�Queuer-r*r+�add_connection�rfile�readline�decoderJr8re�socket�error�READLINErr.rArUr2)r4rbr@s   r�handlezHandler.handlevsd����� ���"����
��[�]�]��
����*�*�4�0�0�0�	/�
��z�*�*�,�,�3�3�G�<�<���2�"�=�1�1�1��=�=��&�&�+�"�6�*�*�*�+���f�l�+�
�
�
���
�����}�}�X�&�&�
/��o��H�
�
�~�o�.���
����&�1�2�2�2��;�&�%)�]�]�t�Q�]�%G�%G�D�N���
�����~�.�.�.�	/� 	
�
�
�����s�A&C�C�CN)rr)r
rr�allow_reuse_addressr2r<rBrAr]rcrnr
rrr%r%2s���������!�!�!�/�/�/�
-�-�-�"�"�"�"�B���"�"�"�����rr%c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Ze
jjZd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�MonitorConnectionrc�r�i|_tj�|��d|_d|_d|_d|_||_tttft��x|_
}||j
_tj|jd���|_|j���dS)Nrz
<Monitor> r
)�target�args)�aliasesr�Cmd�__init__�hnor(�	forceexitr@r+r	�	LOCALHOST�	HEAPYPORTr%r*�	threading�Thread�
run_server�st�start)r4r+�ss   rrwzMonitorConnection.__init__�s�������������������
����"������ �)�Y�!7��A�A�A���a�%�����"�$�/�(*�,�,�,�����
�
�����rc��d|_|jj�d��|j���d�|j_dS)Nrr'c��dS�Nrr
)r�ys  r�<lambda>z)MonitorConnection.close.<locals>.<lambda>�s��!�r)r(r*rkr1�server_close�verify_requestr3s rr2zMonitorConnection.close�sH����
����#�#�A�&�&�&��� � �"�"�"�%3�^���"�"�"rc��tj�||��tj�|d��dS)NrF)rrv�default�do_help)r4r[s  rr�zMonitorConnection.default�s4�������d�#�#�#������b�!�!�!�!�!rc��|j}|js|���|j�|���dSr)r*r(�handle_requestr�)r4r�s  rr~zMonitorConnection.run_server�sG���K���-�	�
�������-�	�	�������rc���|sdS|}	|�|��}|�|��}|�||��}|S#t$r|�|��YdSwxYwr)�precmd�onecmd�postcmd�
BaseException�handle_error)r4rr[�stops    rrAzMonitorConnection.exec_cmd�s����	�
�F���	$��;�;�t�$�$�D��;�;�t�$�$�D��<�<��d�+�+�D��K���	$�	$�	$����d�#�#�#�#�#�#�	$���s�AA
�
A-�,A-c� �tdtj���tddtj���tt|��tj���ddl}|j��tdtj���dS)ztHandle an error gracefully.  May be overridden.

        The default is to print a traceback and continue.

        z(----------------------------------------)�filez0Exception happened during processing the command� )�endr�rN)�printrL�stderr�repr�	traceback�	print_exc)r4�cmdliner�s   rr�zMonitorConnection.handle_error�s���	�f�3�:�&�&�&�&�
�@��C�J�	(�	(�	(�	(�
�d�7�m�m�#�*�-�-�-�-������	�����
�f�3�:�&�&�&�&�&�&rc	�r�||_|s|S|���}|d|jv�r|j|d}d|vr�d}|dd�D]n}|�dt	|��z|��}|�dt	|��zd�||d�����}|dz}�o|�dd�|dd�����}n#|dzd�|dd���z}|���}|d|jv��|ddkrp|�d	��}|dkrU||d
zd����}|j�	|��|d|��
��}|S)z*Handle alias expansion and ';;' separator.r�%rNz%>=r�z%*�aliasz;;r')�curlinerVru�replace�strrP�find�lstrip�cmdqueuerK�rstrip)r4r[rt�ii�tmpArg�marker�nexts       rr�zMonitorConnection.precmd�s�������	��K��z�z�|�|���1�g���%�%��<��Q��(�D��d�{�{���"�1�2�2�h� � �F��<�<��c�"�g�g�
�(.�0�0�D��<�<���B����(+����b�c�c��(;�(;�=�=�D��a��B�B��|�|�D�#�(�(�4����8�*<�*<�=�=����c�z�C�H�H�T�!�"�"�X�$6�$6�6���:�:�<�<�D��1�g���%�%� ��7�g����Y�Y�t�_�_�F���{�{��F�1�H�I�I��-�-�/�/���
�$�$�T�*�*�*��G�V�G�}�+�+�-�-���rc��d|_dS�Nr)ry�r4�args  r�do_exitzMonitorConnection.do_exit�s������qrc�$�td��dS)Nz�exit
-----
Exit from the monitor and from the Python process that started it.
This makes sure to exit without waiting for the server thread to terminate.
See also the q command.�r�r3s r�	help_exitzMonitorConnection.help_exit�s#��
��	�	�	�	�	rc�$�td��dS)Nz�h(elp)
-----
Without argument, print the list of available commands.
With a command name as argument, print help about that command.r�r3s r�help_hzMonitorConnection.help_h�s)��
�C�	D�	D�	D�	D�	Drc�.�|���dSr)r�r3s r�	help_helpzMonitorConnection.help_helps�����
�
�
�
�
rc��	t|j|j|j���}|�d|jz��dS#wxYw)N)�stdinrM�localsz9Local interactive console. To return to Monitor, type %r.)rr�rM�__dict__�interact�EOF_key_sequence)r4r��cons   r�do_intzMonitorConnection.do_ints\��	���
�4�;�!%��0�0�0�C��L�L�K��$�%�
&�
&�
&�

�D��D�D�D�Ds�>A�Ac�$�td��dS)Nz�int
-----
Local interactive console.
This will bring up a Python console locally in
the same interpreter process that the Monitor itself.r�r3s r�help_intzMonitorConnection.help_ints#��
�9�	:�	:�	:�	:�	:rc��|s|j}t|��}|jj|}|�d��rtd��dStd|z��|�t��dS)N�noninterruptiblezCError: Can not interrupt this remote connection (uses Python < 2.4)z+Sending KeyboardInterrupt to connection %s.)�conid�intr+�connectionsr]r�r<�KEYBOARDINTERRUPT)r4r��cs   r�do_kizMonitorConnection.do_kis����	��*�C��#�h�h���L�$�S�)���8�8�&�'�'�	*��G�
H�
H�
H�
H�
H�
�?�#�E�F�F�F�
�J�J�(�)�)�)�)�)rc�$�td��dS)Na\ki <connection ID>
-----
Keyboard Interrupt

Send a command to interrupt the remote thread on the specified
connection (default is the last one connected to).

Notes:

It currently only works with Python >= 2.4.  The remote thread will
not always be awakened, for example if it is waiting in
time.sleep(). Sometimes using several ki commands helps.r�r3s r�help_kizMonitorConnection.help_ki%s#��
�<�	=�	=�	=�	=�	=rc��gd�g}t|jj�����D]C\}}|�||�d��|�d��g���Dt
||j��dS)N)�CID�PID�ARGVz
target.pidztarget.sys.argv)�listr+r��itemsrKr]rrM)r4r��table�cidr�s     r�do_lczMonitorConnection.do_lc3s���'�'�'�(���T�\�5�;�;�=�=�>�>�	:�	:�H�C���L�L�#��*�*�\�2�2��*�*�%6�7�7�9�
:�
:�
:�
:�	�u�d�k�"�"�"�"�"rc�$�td��dS)Na�lc
-----
List Connections.
List the currently open connections.
The table printed has one line per connection in this form:

CID PID   ARGV
  1 17999 ['/home/nilsson/bin/solitaire.py']

CID is the connection ID, which may be used as argument to the sc
command.

PID is the process ID of the target interpreter process.  In Linux,
this is the parent of the remote control interpreter thread that runs
the Annex that the connection is talking to.

ARGV is the argument vector in the target Python interpereter.r�r3s r�help_lczMonitorConnection.help_lc<s)��
�B�	C�	C�	C�	C�	Crc��|rt|��|_td|jz��|j�|jj|j��dS)NzFRemote connection %d. To return to Monitor, type <Ctrl-C> or .<RETURN>)r�r�r�r+�set_connectionr�r�s  r�do_sczMonitorConnection.do_scOsW���	"��S���D�J�
�V�Y]�Yc�c�d�d�d���#�#�D�L�$<�T�Z�$H�I�I�I�I�Irc�$�td��dS)Napsc <connection ID>
-----
Set connection to communicate with a remote thread.

With an argument, set current connection to the number specified.
Without argument, use the same connection as last time.  You will then
be talking to a remote process via that connection.  You can return to
Monitor at any time by <Ctrl-C>. You may also use the '.' command
(followed by <Return>), if the remote process is waiting for input.
The '.' character may be followed by a monitor command, to execute it
directly instead of returning to the monitor. For example, when
talking to a connection, '.sc 1' will directly change to connection 1.r�r3s r�help_sczMonitorConnection.help_scUs)��
�J�	K�	K�	K�	K�	Krc��dSr�r
r�s  r�do_qzMonitorConnection.do_qcs���qrc�$�td��dS)Nz�q
-----
Quit from the monitor.
This will not exit from Python itself if called from an interactive
interpreter. To make sure to exit from Python, use the exit command.r�r3s r�help_qzMonitorConnection.help_qfs)��
�H�	I�	I�	I�	I�	IrN)r
rr�
use_raw_inputrwr2r�r~rAr�r�r�r�rrvr��do_hr�r�r�r�r�r�r�r�r�r�r�r�r
rrrqrq�sp�������M�
�
�
�4�4�4�"�"�"����
$�
$�
$�'�'�'� ���>�������7�?�D�D�D�D����	�	�	�:�:�:�
*�
*�
*�=�=�=�#�#�#�C�C�C�&J�J�J�K�K�K����I�I�I�I�Irrqc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�Monitorrc�f�t|��x|_|_i|_d|_d|_dSr�)rq�
connection�monitor_connectionr��idsr@r3s rrwzMonitor.__init__qs3��4E�d�4K�4K�K���$�1�����������rc���|jsd|_|j|j_nIt	dgd�t|j�����D��z��dz|_|jS)Nrc��g|]}|��Sr
r
)�.0r�s  r�
<listcomp>z!Monitor.newid.<locals>.<listcomp>|s��I�I�I�a��I�I�Ir)r�r�r�r��maxr��keysr3s r�newidz
Monitor.newidwsm����	M��D�H�,0�H�D�#�)�)��A�3�I�I�4��0@�0E�0E�0G�0G�+H�+H�I�I�I�I�J�J�1�L�D�H��x�rc��|���}||j|<||_|�d|z��dS)Nz*** Connection %s opened ***)r�r��
monitor_id�print_async)r4r��hids   rrgzMonitor.add_connectionsD���j�j�l�l�� *����� #�
�����7�#�=�>�>�>�>�>rc��|j�Vtd|z��tj�|j��tj���dSdS)zS Print text only if we are waiting for input,
        and then restore the prompt. Nr6)r@r�rLrMrN�flush)r4�texts  rr�zMonitor.print_async�sX���;�"��$�t�)�����J���T�[�)�)�)��J��������#�"rc��|j|j=||jur|�|j��|�d|jz��dS)Nz*** Connection %s closed ***)r�r�r�r�r�r��r4r�s  rr,zMonitor.remove_connection�sd����Z�2�3����(�(����� 7�8�8�8����7�#�.�/�	0�	0�	0�	0�	0rc���	d}|�s1	|s�|j}|j|_||jur|�dd���t	|j��}d|_d}|jd��r%|dkr
|j|_n|dd�}|j}n|j}|r6	|�|��}n#t$rd}YnwxYw||jur|rd}|��nd#t$r!	td��|j|_d}Yn:t$r.td��td��|j|_Y��-wxYw|��1d|_|�	��dS#d|_|�	��wxYw)Nrr)rr!�.z%*** End Of File - Exiting Monitor ***�KeyboardInterruptz1Use the ki command to interrupt a remote process.)
r�r@r�rA�inputrWrJr�r�r2)r4r��connrrs     r�runzMonitor.run�s���)	��D��#
�"�"�)�#���&*�k����t�'>�>�>� �M�M�d�A�M�>�>�>�#�D�K�0�0��&*���#��)�3�>�#�.�.�3�"�c�z�z�26�2I����&)�!�"�"�g��'+�'>���$(�?�D��)�&�$(�M�M�#�$6�$6����#+�&�&�&�$%����&����#�t�'>�>�>�1�>�'(��/#�)���0 ����E��A�B�B�B�&*�&=�D�O��D�D�D�(�����-�.�.�.��M�N�N�N�&*�&=�D�O��H�	����?�#
�L�D�K��J�J�L�L�L�L�L���D�K��J�J�L�L�L�L���s_�E�BC�B/�.C�/B>�;C�=B>�>C�E�(D2�9E�;3D2�.E�1D2�2E�E2c�P�t|j�����D],}	|����#tj$rY�)wxYw	|j���n#tj$rYnwxYw|jjrtj	d��dSdSr�)
r�r��valuesr2rkrlr�ry�os�_exit)r4r�s  rr2z
Monitor.close�s����d�&�-�-�/�/�0�0�	�	�A�
����	�	�	�	���<�
�
�
���
����	��#�)�)�+�+�+�+���|�	�	�	��D�	�����"�,�	��H�Q�K�K�K�K�K�	�	s!�?�A�A�A/�/B�Bc�,�||_|j|_dSr)r�r@r�s  rr�zMonitor.set_connection�s��$��� �'����rN)r
rrr�rwr�rgr�r,r�r2r�r
rrr�r�ns��������M�������?�?�?����0�0�0�*�*�*�X���(�(�(�(�(rr�c�~�ddlm}|���t��}|���dS)z�monitor() [0]

Start an interactive remote monitor.

This can be used to get information about the state, in
particular the memory usage, of separately running Python
processes.

References
    [0] heapy_Use.html#heapykinds.Use.monitorr)�RemoteN)�guppy.heapyr�offr�r�)r�ms  rr+r+�s=��#�"�"�"�"�"�
�J�J�L�L�L��	�	�A��E�E�G�G�G�G�Gr�__main__)r)#r�pprint�signalrk�socketserverrLr|rHr�r_ri�ImportErrorrr�guppy.heapy.RemoteConstants�guppy.heapy.Consoler�
guppy.setsr�
guppy.etc.etcr�	guppy.etcr�ThreadingTCPServerr	rr"r/�StreamRequestHandlerr%rvrqr�r+r
r
rr�<module>rs1��	�	�	�	�
�
�
�
�
�
�
�
�
�
�
�
�����
�
�
�
�����������������	��O�O�O�O���	�	�	��D�	�����
�
�
�����)�)�)�)�'�'�'�'�'�'�!�!�!�!�!�!� � � � � � �������	�	�	�	�	�\�
,�	�	�	����
������\�\�\�\�\�l�/�\�\�\�~ZI�ZI�ZI�ZI�ZI���ZI�ZI�ZI�za(�a(�a(�a(�a(�a(�a(�a(�H���"�z����G�I�I�I�I�I��s�/�7�7

Zerion Mini Shell 1.0