ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/tracemalloc.cpython-311.pyc

�

�fF���ddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZd�Z
Gd�d��ZGd	�d
��Zd�ZeGd�d
����ZeGd�de����Zd�ZGd�d��ZGd�de��Zd�ZGd�d��ZGd�de��ZGd�de��ZGd�d��Zd�ZdS)�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracesc���dD]a}t|��dkr|dkr|r	d||fzcSd||fzcSt|��dks|dkr|r	d||fzcSd	||fzcS|d
z}�bdS)N)�B�KiB�MiB�GiB�TiB�dr
z%+.1f %sz%.1f %si(rz%+.0f %sz%.0f %si)�abs)�size�sign�units   �2/opt/alt/python311/lib64/python3.11/tracemalloc.py�_format_sizer
s���1�
�
���t�9�9�s�?�?�t�s�{�{��
0�!�T�4�L�0�0�0�0� �D�$�<�/�/�/�/��t�9�9�y� � �D�E�M�M��
0�!�T�4�L�0�0�0�0� �D�$�<�/�/�/�/������
�
�c�:�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    ��	tracebackr�countc�0�||_||_||_dS�Nr)�selfrrrs    r�__init__zStatistic.__init__%s��"�����	���
�
�
rc�D�t|j|j|jf��Sr)�hashrrr�rs r�__hash__zStatistic.__hash__*s���T�^�T�Y��
�;�<�<�<rc��t|t��stS|j|jko|j|jko|j|jkSr)�
isinstancer�NotImplementedrrr�r�others  r�__eq__zStatistic.__eq__-sM���%��+�+�	"�!�!���%�/�1�.��I���+�.��J�%�+�-�	/rc��d|jt|jd��|jfz}|jr%|j|jz}|dt|d��zz
}|S)Nz%s: size=%s, count=%iF�, average=%s)rrrr�r�text�averages   r�__str__zStatistic.__str__4sc��'��N� ���E�2�2��J� � ���:�	B��i�$�*�,�G��N�\�'�5�%A�%A�A�A�D��rc�0�d|j|j|jfzS)Nz)<Statistic traceback=%r size=%i count=%i>rr"s r�__repr__zStatistic.__repr__>s��;��>�4�9�d�j�9�:�	;rc�*�|j|j|jfSr)rrrr"s r�	_sort_keyzStatistic._sort_keyBs���	�4�:�t�~�6�6rN��__name__�
__module__�__qualname__�__doc__�	__slots__rr#r)r/r1r3�rrrrs��������/�I����
=�=�=�/�/�/����;�;�;�7�7�7�7�7rrc�:�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    �rr�	size_diffr�
count_diffc�L�||_||_||_||_||_dSrr=)rrrr>rr?s      rrzStatisticDiff.__init__Ms)��"�����	�"�����
�$����rc�\�t|j|j|j|j|jf��Sr)r!rrr>rr?r"s rr#zStatisticDiff.__hash__Ts.���T�^�T�Y����Z���2�3�3�	3rc���t|t��stS|j|jko?|j|jko/|j|jko|j|jko|j|jkSr)r%r<r&rrr>rr?r's  rr)zStatisticDiff.__eq__Xst���%��/�/�	"�!�!���%�/�1�8��I���+�8��N�e�o�5�8��J�%�+�-�8��O�u�'7�7�		9rc���d|jt|jd��t|jd��|j|jfz}|jr%|j|jz}|dt|d��zz
}|S)Nz %s: size=%s (%s), count=%i (%+i)FTr+)rrrr>rr?r,s   rr/zStatisticDiff.__str__asw��2��>���	�5�1�1�����5�5��:��?�	$�$���:�	B��i�$�*�,�G��N�\�'�5�%A�%A�A�A�D��rc�H�d|j|j|j|j|jfzS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>r=r"s rr1zStatisticDiff.__repr__ms*��K��>�4�9�d�n��:�t��0�0�	1rc�v�t|j��|jt|j��|j|jfSr)rr>rr?rrr"s rr3zStatisticDiff._sort_keyrs3���D�N�#�#�T�Y��D�O�$�$�d�j��� �	 rNr4r:rrr<r<Fs���������J�I�%�%�%�3�3�3�9�9�9�
�
�
�1�1�1�
 � � � � rr<c	���g}|���D]�\}}|�|d��}|�8t||j|j|jz
|j|j|jz
��}n't||j|j|j|j��}|�|����|���D]9\}}t|d|jd|j��}|�|���:|S�Nr)�items�popr<rr�append)�	old_group�	new_group�
statisticsr�stat�previouss      r�_compare_grouped_statsrPxs���J�$�?�?�,�,�
 �
 ��	�4��=�=��D�1�1���� ��!%��D�I��
�,E�!%��T�Z�(�.�-H�J�J�D�D�!��!%��D�I�!%��T�Z�9�9�D�	���$�����$�?�?�,�,� � ��	�4��Y��D�I�:�q�4�:�+�F�F�����$������rc�f�eZdZdZdZd�Zed���Zed���Zd�Z	d�Z
d�Zd	�Zd
�Z
dS)�Framez
    Frame of a traceback.
    ��_framec��||_dSrrS�r�frames  rrzFrame.__init__�s
������rc��|jdSrGrSr"s r�filenamezFrame.filename�����{�1�~�rc��|jdS�N�rSr"s r�linenozFrame.lineno�rZrc�Z�t|t��stS|j|jkSr�r%rRr&rTr's  rr)zFrame.__eq__��)���%��'�'�	"�!�!���u�|�+�,rc�Z�t|t��stS|j|jkSrr`r's  r�__lt__zFrame.__lt__�s)���%��'�'�	"�!�!���e�l�*�+rc�*�t|j��Sr)r!rTr"s rr#zFrame.__hash__�����D�K� � � rc�$�|j�d|j��S)N�:�rYr^r"s rr/z
Frame.__str__�s���-�-�-����5�5rc�(�d|j�d|j�d�S)Nz<Frame filename=z lineno=�>rhr"s rr1zFrame.__repr__�s���26�-�-�-�����M�MrN)r5r6r7r8r9r�propertyrYr^r)rcr#r/r1r:rrrRrR�s����������I��������X������X��-�-�-�
,�,�,�
!�!�!�6�6�6�N�N�N�N�NrrRc�l�eZdZdZdZdd�Zed���Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�ZdS)�	Tracebackz`
    Sequence of Frame instances sorted from the oldest frame
    to the most recent frame.
    )�_frames�
_total_nframeNc�~�tj|��tt|����|_||_dSr)rr�tuple�reversedrnro)r�frames�total_nframes   rrzTraceback.__init__�s:����$����
�X�f�-�-�.�.���)����rc��|jSr)ror"s rrtzTraceback.total_nframe�s���!�!rc�*�t|j��Sr)�lenrnr"s r�__len__zTraceback.__len__�����4�<� � � rc��t|t��r$td�|j|D����St	|j|��S)Nc3�4K�|]}t|��V��dSr)rR��.0�traces  r�	<genexpr>z(Traceback.__getitem__.<locals>.<genexpr>��(����G�G�%��u���G�G�G�G�G�Gr)r%�slicerqrnrR�r�indexs  r�__getitem__zTraceback.__getitem__��M���e�U�#�#�	.��G�G�4�<��3F�G�G�G�G�G�G����e�,�-�-�-rc��|j|jvSr)rTrnrVs  r�__contains__zTraceback.__contains__�����|�t�|�+�+rc�*�t|j��Sr)r!rnr"s rr#zTraceback.__hash__�s���D�L�!�!�!rc�Z�t|t��stS|j|jkSr�r%rmr&rnr's  rr)zTraceback.__eq__�s)���%��+�+�	"�!�!����
�-�.rc�Z�t|t��stS|j|jkSrr�r's  rrczTraceback.__lt__�s)���%��+�+�	"�!�!���u�}�,�-rc�,�t|d��SrG)�strr"s rr/zTraceback.__str__�s���4��7�|�|�rc�`�dt|����}|j�|dz
}n|d|j�d�z
}|S)Nz<Traceback rjz total_nframe=)rqrort)r�ss  rr1zTraceback.__repr__�sG��'�%��+�+�'�'����%�
��H�A�A�
�6�$�"3�6�6�6�6�A��rFc�X�g}|�|dkr||d�}n
|d|�}n|}|rt|��}|D]r}|�d|j�d|j����t	j|j|j�����}|r|�d|z���s|S)Nrz  File "z", line z    %s)rrrJrYr^�	linecache�getline�strip)r�limit�most_recent_first�lines�frame_slicerW�lines       r�formatzTraceback.format�s��������q�y�y�"�E�6�7�7�m���"�6�E�6�l����K��	0�"�;�/�/�K� �	.�	.�E��L�L�L�!�N�N�N�E�L�L�:�
;�
;�
;��$�U�^�U�\�B�B�H�H�J�J�D��
.����X��_�-�-�-���rr)NF)r5r6r7r8r9rrkrtrxr�r�r#r)rcr/r1r�r:rrrmrm�s���������-�I�*�*�*�*��"�"��X�"�!�!�!�.�.�.�,�,�,�"�"�"�/�/�/�
.�.�.�
�����������rrmc�F�t|��}|�t|��SdS)z�
    Get the traceback where the Python object *obj* was allocated.
    Return a Traceback instance.

    Return None if the tracemalloc module is not tracing memory allocations or
    did not trace the allocation of the object.
    N)rrm)�objrss  r�get_object_tracebackr�s*��#�3�
'�
'�F�
���� � � ��trc�v�eZdZdZdZd�Zed���Zed���Zed���Z	d�Z
d�Zd	�Zd
�Z
dS)�Tracez"
    Trace of a memory block.
    ��_tracec��||_dSrr��rr~s  rrzTrace.__init__s������rc��|jdSrGr�r"s r�domainzTrace.domainrZrc��|jdSr\r�r"s rrz
Trace.sizerZrc�.�t|jdd��S)N�)rmr�r"s rrzTrace.traceback#s���$�+�a�b�b�/�*�*rc�Z�t|t��stS|j|jkSr)r%r�r&r�r's  rr)zTrace.__eq__'rarc�*�t|j��Sr)r!r�r"s rr#zTrace.__hash__,rerc�@�|j�dt|jd����S)Nz: F)rrrr"s rr/z
Trace.__str__/s"���>�>�>�<��	�5�+I�+I�+I�J�Jrc�T�d|j�dt|jd���d|j�d�S)Nz<Trace domain=z size=Fz, traceback=rj)r�rrrr"s rr1zTrace.__repr__2s5����;�;�;��T�Y�� >� >� >� >�����P�	QrN)r5r6r7r8r9rrkr�rrr)r#r/r1r:rrr�r�s����������I����
����X������X���+�+��X�+�-�-�-�
!�!�!�K�K�K�Q�Q�Q�Q�Qrr�c�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�_Tracesc�<�tj|��||_dSr)rr�_traces)r�tracess  rrz_Traces.__init__8s����$��������rc�*�t|j��Sr)rwr�r"s rrxz_Traces.__len__=ryrc��t|t��r$td�|j|D����St	|j|��S)Nc3�4K�|]}t|��V��dSr)r�r|s  rrz&_Traces.__getitem__.<locals>.<genexpr>Br�r)r%r�rqr�r�r�s  rr�z_Traces.__getitem__@r�rc��|j|jvSr)r�r�r�s  rr�z_Traces.__contains__Fr�rc�Z�t|t��stS|j|jkSr)r%r�r&r�r's  rr)z_Traces.__eq__Is)���%��)�)�	"�!�!����
�-�.rc�&�dt|��zS)Nz<Traces len=%s>)rwr"s rr1z_Traces.__repr__Ns�� �3�t�9�9�,�,rN)	r5r6r7rrxr�r�r)r1r:rrr�r�7sn���������
!�!�!�.�.�.�,�,�,�/�/�/�
-�-�-�-�-rr�c��tj�|��}|�d��r
|dd�}|S)Nz.pyc���)�os�path�normcase�endswith)rYs r�_normalize_filenamer�Rs?���w����)�)�H����� � �!��C�R�C�=���Orc��eZdZd�Zd�ZdS)�
BaseFilterc��||_dSr)�	inclusive)rr�s  rrzBaseFilter.__init__Zs
��"����rc��t�r)�NotImplementedErrorr�s  r�_matchzBaseFilter._match]s��!�!rN)r5r6r7rr�r:rrr�r�Ys2������#�#�#�"�"�"�"�"rr�c�P��eZdZ	d	�fd�	Zed���Zd�Zd�Zd�Zd�Z	�xZ
S)
�FilterNFc���t���|��||_t|��|_||_||_||_dSr)�superrr�r��_filename_patternr^�
all_framesr�)rr��filename_patternr^r�r��	__class__s      �rrzFilter.__init__bsL���
������#�#�#�"���!4�5E�!F�!F������$�������rc��|jSr)r�r"s rr�zFilter.filename_patternks���%�%rc��t|��}tj||j��sdS|j�dS||jkS)NFT)r��fnmatchr�r^�rrYr^s   r�_match_frame_implzFilter._match_frame_implosE��&�x�0�0����x��)?�@�@�	��5��;���4��d�k�)�*rc�@�|�||��|jzSr)r�r�r�s   r�_match_framezFilter._match_framexs"���%�%�h��7�7�t�~�;M�N�Nrc����jr*t�fd�|D����r�jS�jS|d\}}��||��S)Nc3�J�K�|]\}}��||��V��dSr)r�)r}rYr^rs   �rrz*Filter._match_traceback.<locals>.<genexpr>}sK�����6�6�'�x���)�)�(�F�;�;�6�6�6�6�6�6rr)r��anyr�r�)rrrYr^s`   r�_match_tracebackzFilter._match_traceback{s|����?�	7��6�6�6�6�+4�6�6�6�6�6�
,��~�%� �N�*�+�(��|��H�f��$�$�X�v�6�6�6rc��|\}}}}|�|��}|j�!|jr
|o
||jkS|p
||jkS|Sr)r�r�r�)rr~r�rrrt�ress       rr�z
Filter._match�s^��05�-���i���#�#�I�.�.���;�"��~�
6��6��$�+� 5�6��5�v���4�5��
r)NFN)r5r6r7rrkr�r�r�r�r��
__classcell__�r�s@rr�r�as��������7;��������&�&��X�&�+�+�+�O�O�O�	7�	7�	7�������rr�c�:��eZdZ�fd�Zed���Zd�Z�xZS)�DomainFilterc�X��t���|��||_dSr)r�r�_domain)rr�r�r�s   �rrzDomainFilter.__init__�s&���
������#�#�#�����rc��|jSr)r�r"s rr�zDomainFilter.domain�s
���|�rc�8�|\}}}}||jk|jzSr)r�r�)rr~r�rrrts      rr�zDomainFilter._match�s'��05�-���i���$�+�%�d�n�*<�=�=r)r5r6r7rrkr�r�r�r�s@rr�r��sb����������������X��>�>�>�>�>�>�>rr�c�V�eZdZdZd�Zd�Zed���Zd�Zd�Z	d�Z
dd	�Zdd
�ZdS)
�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    c�<�t|��|_||_dSr)r�r��traceback_limit)rr�r�s   rrzSnapshot.__init__�s���f�o�o���.����rc��t|d��5}tj||tj��ddd��dS#1swxYwYdS)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dump�HIGHEST_PROTOCOL)rrY�fps   rr�z
Snapshot.dump�s����(�D�
!�
!�	;�R��K��b�&�"9�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s�!?�A�Ac�~�t|d��5}tj|��cddd��S#1swxYwYdS)z.
        Load a snapshot from a file.
        �rbN)r�r��load)rYr�s  rr�z
Snapshot.load�s���
�(�D�
!�
!�	#�R��;�r�?�?�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#s�2�6�6c���|rt�fd�|D����sdS|rt�fd�|D����rdSdS)Nc3�B�K�|]}|����V��dSr�r��r}�trace_filterr~s  �rrz)Snapshot._filter_trace.<locals>.<genexpr>�sE�����<�<�'�$�*�*�5�1�1�<�<�<�<�<�<rFc3�D�K�|]}|����V��dSrr�r�s  �rrz)Snapshot._filter_trace.<locals>.<genexpr>�sH�����8�8�#�$�*�*�5�1�1�1�8�8�8�8�8�8rT)r�)r�include_filters�exclude_filtersr~s   `r�
_filter_tracezSnapshot._filter_trace�s�����	��<�<�<�<�+:�<�<�<�<�<�
��u��	��8�8�8�8�'6�8�8�8�8�8�
��u��trc�����t|t��s$tdt|��jz���|rVg�g�|D]4}|jr��|�����|���5���fd��jjD��}n�jj�	��}t|�j��S)z�
        Create a new Snapshot instance with a filtered traces sequence, filters
        is a list of Filter or DomainFilter instances.  If filters is an empty
        list, return a new Snapshot instance with a copy of the traces.
        z)filters must be a list of filters, not %sc�B��g|]}����|���|��Sr:)r�)r}r~r�r�rs  ���r�
<listcomp>z*Snapshot.filter_traces.<locals>.<listcomp>�sE���8�8�8�E�!�/�/��0?�05�7�7�8�%�8�8�8r)r%r�	TypeError�typer5r�rJr�r��copyr�r�)r�filtersr��
new_tracesr�r�s`   @@r�
filter_traceszSnapshot.filter_traces�s�������'�8�,�,�	6��G�"�7�m�m�4�5�6�6�
6��
	4� �O� �O� '�
9�
9���)�9�#�*�*�<�8�8�8�8�#�*�*�<�8�8�8�8�8�8�8�8�8�8�T�[�-@�8�8�8�J�J�
��,�1�1�3�3�J��
�D�$8�9�9�9rc�>�|dvrtd|�����|r|dvrtd|z���i}i}|s�|jjD]�}|\}}}}		||}
nO#t$rB|dkr|}n"|dkr|dd�}n|dddff}t	|��}
|
||<YnwxYw	||
}|xj|z
c_|xjdz
c_��#t$rt|
|d��||
<Y��wxYwn�|jjD]�}|\}}}}	|D]�}
	||
}
n9#t$r,|dkr|
f}n|
ddff}t	|��}
|
||
<YnwxYw	||
}|xj|z
c_|xjdz
c_�o#t$rt|
|d��||
<Y��wxYw��|S)	N)rrYr^zunknown key_type: )r^rYz/cumulative mode cannot by used with key type %rrr^r]r)�
ValueErrorr�r��KeyErrorrmrrr)r�key_type�
cumulative�stats�
tracebacksr~r�r�trace_tracebackrtrrsrNrWs              r�	_group_byzSnapshot._group_by�s����>�>�>��*�x�x�A�B�B�B��	<�(�*@�@�@��0�2:�;�<�<�
<����
��'	I���,�
E�
E��>C�;���o�|�
<� *�?� ;�I�I���<�<�<��;�.�.�!0���!�X�-�-�!0��!��!4���#2�1�#5�a�#8�!�"<�!>�� )�&� 1� 1�I�2;�J��/�/�/�<����E� ��+�D��I�I��%�I�I��J�J�!�O�J�J�J���E�E�E�'0��D�!�'D�'D�E�)�$�$�$�E����#
E�*��,�
I�
I��>C�;���o�|�,�I�I�E�6�$.�u�$5�	�	��#�6�6�6�#�x�/�/�&+�X�F�F�',�Q�x��m�%5�F�$-�f�$5�$5�	�,5�
�5�)�)�)�
6����I�$�Y�/���	�	�T�)�	�	��
�
�a��
�
�
��#�I�I�I�+4�Y��a�+H�+H��i�(�(�(�I����I� �sI�A�A	B �B �$(C
�
C.�-C.�D�3E�
E�(E8�8F�FFc��|�||��}t|�����}|�dtj���|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T��reverse�key)r�list�values�sortrr3)rrr�groupedrMs     rrMzSnapshot.statisticssM��
�.�.��:�6�6���'�.�.�*�*�+�+�
�����)�*=��>�>�>��rc��|�||��}|�||��}t||��}|�dtj���|S)z�
        Compute the differences with an old snapshot old_snapshot. Get
        statistics as a sorted list of StatisticDiff instances, grouped by
        group_by.
        Tr
)rrPrr<r3)r�old_snapshotrrrLrKrMs       r�
compare_tozSnapshot.compare_tosZ���N�N�8�Z�8�8�	� �*�*�8�Z�@�@�	�+�I�y�A�A�
�����-�*A��B�B�B��rN)F)
r5r6r7r8rr��staticmethodr�r�rrrMrr:rrr�r��s���������/�/�/�;�;�;��#�#��\�#�	�	�	�:�:�:�21�1�1�f����
�
�
�
�
�
rr�c��t��std���t��}t��}t	||��S)zI
    Take a snapshot of traces of memory blocks allocated by Python.
    zLthe tracemalloc module must be tracing memory allocations to take a snapshot)�
is_tracing�RuntimeErrorr�get_traceback_limitr�)r�r�s  r�
take_snapshotr'sK���<�<�=��<�=�=�	=�
�]�]�F�)�+�+�O��F�O�,�,�,r)�collections.abcrr�	functoolsrr�r��os.pathr�r��_tracemallocrrrrr<rPrRrmr�r�r�r�r�r�r�r�rr:rr�<module>r!s���.�.�.�.�.�.�.�.�$�$�$�$�$�$�������������
�
�
�
�����;�;�;�;�;�;�;�;����"%7�%7�%7�%7�%7�%7�%7�%7�P/ �/ �/ �/ �/ �/ �/ �/ �d���(�#N�#N�#N�#N�#N�#N�#N���#N�L�J�J�J�J�J��J�J���J�Z���$Q�$Q�$Q�$Q�$Q�$Q�$Q�$Q�N-�-�-�-�-�h�-�-�-�6���"�"�"�"�"�"�"�"�-�-�-�-�-�Z�-�-�-�`>�>�>�>�>�:�>�>�>�E�E�E�E�E�E�E�E�P	-�	-�	-�	-�	-r

Zerion Mini Shell 1.0