AlkantarClanX12

Your IP : 18.119.125.240


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/tracemalloc.cpython-312.pyc

�

�Q�fF��\�ddlmZmZddlmZddlZddlZddlZddl	Z	ddl
�ddl
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�Zy)�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracesc��dD]U}t|�dkr|dk7r|r	d||fzcSd||fzcSt|�dks|dk(r|r	d||fzcSd	||fzcS|d
z}�Wy)N)�B�KiB�MiB�GiB�TiB�dr
z%+.1f %sz%.1f %si(rz%+.0f %sz%.0f %si)�abs)�size�sign�units   �2/opt/alt/python312/lib64/python3.12/tracemalloc.py�_format_sizer
sz��1���t�9�s�?�t�s�{��!�T�4�L�0�0� �D�$�<�/�/��t�9�y� �D�E�M��!�T�4�L�0�0� �D�$�<�/�/�����2�c�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    ��	tracebackr�countc�.�||_||_||_y�Nr)�selfrrrs    r�__init__zStatistic.__init__%s��"�����	���
rc�Z�t|j|j|jf�Sr)�hashrrr�rs r�__hash__zStatistic.__hash__*s ���T�^�^�T�Y�Y��
�
�;�<�<rc���t|t�stS|j|jk(xr4|j|jk(xr|j
|j
k(Sr)�
isinstancer�NotImplementedrrr�r�others  r�__eq__zStatistic.__eq__-sQ���%��+�!�!����%�/�/�1�.��I�I����+�.��J�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�N� ����E�2��J�J� � ���:�:��i�i�$�*�*�,�G��N�\�'�5�%A�A�A�D��rc�N�d|j|j|jfzS)Nz)<Statistic traceback=%r size=%i count=%i>rr"s r�__repr__zStatistic.__repr__>s%��;��>�>�4�9�9�d�j�j�9�:�	;rc�H�|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��
=�/��;�7rrc�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    �rr�	size_diffr�
count_diffc�J�||_||_||_||_||_yrr=)rrrr>rr?s      rrzStatisticDiff.__init__Ms%��"�����	�"�����
�$��rc��t|j|j|j|j|j
f�Sr)r!rrr>rr?r"s rr#zStatisticDiff.__hash__Ts3���T�^�^�T�Y�Y�����Z�Z����2�3�	3rc�8�t|t�stS|j|jk(xrj|j|jk(xrO|j
|j
k(xr4|j|jk(xr|j|jk(Sr)r%r<r&rrr>rr?r's  rr)zStatisticDiff.__eq__Xs����%��/�!�!����%�/�/�1�8��I�I����+�8��N�N�e�o�o�5�8��J�J�%�+�+�-�8��O�O�u�'7�'7�7�		9rc��d|jt|jd�t|jd�|j|j
fz}|jr+|j|jz}|dt|d�zz
}|S)Nz %s: size=%s (%s), count=%i (%+i)FTr+)rrrr>rr?r,s   rr/zStatisticDiff.__str__asx��2��>�>���	�	�5�1������5��:�:��?�?�	$�$���:�:��i�i�$�*�*�,�G��N�\�'�5�%A�A�A�D��rc�z�d|j|j|j|j|jfzS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>r=r"s rr1zStatisticDiff.__repr__ms4��K��>�>�4�9�9�d�n�n��:�:�t���0�0�	1rc��t|j�|jt|j�|j|j
fSr)rr>rr?rrr"s rr3zStatisticDiff._sort_keyrs7���D�N�N�#�T�Y�Y��D�O�O�$�d�j�j���� �	 rNr4r:rrr<r<Fs-���J�I�%�3�9�
�1�
 rr<c	�2�g}|j�D]�\}}|j|d�}|�Rt||j|j|jz
|j|j|jz
�}n7t||j|j|j|j�}|j|���|j�D];\}}t|d|jd|j�}|j|��=|S�Nr)�items�popr<rr�append)�	old_group�	new_group�
statisticsr�stat�previouss      r�_compare_grouped_statsrPxs����J�$�?�?�,��	�4��=�=��D�1���� ��!%���D�I�I��
�
�,E�!%���T�Z�Z�(�.�.�-H�J�D�!��!%���D�I�I�!%���T�Z�Z�9�D�	���$��-�%�?�?�,��	�4��Y��D�I�I�:�q�4�:�:�+�F�����$��-��rc�X�eZdZdZdZd�Zed��Zed��Zd�Z	d�Z
d�Zd	�Zd
�Z
y)�Framez
    Frame of a traceback.
    ��_framec��||_yrrS�r�frames  rrzFrame.__init__�s	����rc� �|jdSrGrSr"s r�filenamezFrame.filename�����{�{�1�~�rc� �|jdS�N�rSr"s r�linenozFrame.lineno�rZrc�`�t|t�stS|j|jk(Sr�r%rRr&rTr's  rr)zFrame.__eq__��%���%��'�!�!����u�|�|�+�,rc�`�t|t�stS|j|jkSrr`r's  r�__lt__zFrame.__lt__�s%���%��'�!�!����e�l�l�*�+rc�,�t|j�Sr)r!rTr"s rr#zFrame.__hash__�����D�K�K� � rc�8�|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�sU����I����������-�
,�
!�6�NrrRc�d�eZdZdZdZdd�Zed��Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zy)�	Tracebackz`
    Sequence of Frame instances sorted from the oldest frame
    to the most recent frame.
    )�_frames�
_total_nframeNc�n�tj|�tt|��|_||_yr)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�rtd�|j|D��St	|j|�S)Nc3�2K�|]}t|����y�wr)rR��.0�traces  r�	<genexpr>z(Traceback.__getitem__.<locals>.<genexpr>������G�3F�%��u��3F���)r%�slicerqrnrR�r�indexs  r�__getitem__zTraceback.__getitem__��:���e�U�#��G�4�<�<��3F�G�G�G�����e�,�-�-rc�2�|j|jvSr)rTrnrVs  r�__contains__zTraceback.__contains__�����|�|�t�|�|�+�+rc�,�t|j�Sr)r!rnr"s rr#zTraceback.__hash__�s���D�L�L�!�!rc�`�t|t�stS|j|jk(Sr�r%rmr&rnr's  rr)zTraceback.__eq__�s%���%��+�!�!�����
�
�-�.rc�`�t|t�stS|j|jkSrr�r's  rrczTraceback.__lt__�s%���%��+�!�!����u�}�}�,�-rc��t|d�SrG)�strr"s rr/zTraceback.__str__�s���4��7�|�rc�n�dt|���}|j�|dz
}|S|d|j�d�z
}|S)Nz<Traceback rjz total_nframe=)rqrort)r�ss  rr1zTraceback.__repr__�sO���%��+��'�����%�
��H�A���
�>�$�"3�"3�!4�A�6�6�A��rc�R�g}|�|dkDr||d}n|d|}n|}|rt|�}|D]|}|jd|j�d|j���t	j
|j|j�j
�}|s�i|jd|z��~|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�"�E�6�7�m��"�6�E�l���K��"�;�/�K� �E��L�L�!�N�N�E�L�L�:�
;��$�$�U�^�^�U�\�\�B�H�H�J�D�����X��_�-�!��rr)NF)r5r6r7r8r9rrkrtrxr�r�r#r)rcr/r1r�r:rrrmrm�sT���-�I�*��"��"�!�.�,�"�/�
.�
��rrmc�4�t|�}|�t|�Sy)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�
���� � �rc�b�eZdZdZdZd�Zed��Zed��Zed��Z	d�Z
d�Zd	�Zd
�Z
y)�Tracez"
    Trace of a memory block.
    ��_tracec��||_yrr��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�/�*�*rc�`�t|t�stS|j|jk(Sr)r%r�r&r�r's  rr)zTrace.__eq__'rarc�,�t|j�Sr)r!r�r"s rr#zTrace.__hash__,rerc�L�|j�dt|jd���S)Nz: F)rrrr"s rr/z
Trace.__str__/s���>�>�<��	�	�5�+I�J�Jrc�j�d|j�dt|jd��d|j�d�S)Nz<Trace domain=z size=Fz, traceback=rj)r�rrrr"s rr1zTrace.__repr__2s(���;�;��T�Y�Y�� >����P�	QrN)r5r6r7r8r9rrkr�rrr)r#r/r1r:rrr�r�se����I��
���������+��+�-�
!�K�Qrr�c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�_Tracesc�<�tj|�||_yr)rr�_traces)r�tracess  rrz_Traces.__init__8s�����$����rc�,�t|j�Sr)rwr�r"s rrxz_Traces.__len__=ryrc��t|t�rtd�|j|D��St	|j|�S)Nc3�2K�|]}t|����y�wr)r�r|s  rrz&_Traces.__getitem__.<locals>.<genexpr>Br�r�)r%r�rqr�r�r�s  rr�z_Traces.__getitem__@r�rc�2�|j|jvSr)r�r�r�s  rr�z_Traces.__contains__Fr�rc�`�t|t�stS|j|jk(Sr)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�,�,rN)	r5r6r7rrxr�r�r)r1r:rrr�r�7s ���
!�.�,�/�
-rr�c�p�tjj|�}|jd�r|dd}|S)Nz.pyc���)�os�path�normcase�endswith)rYs r�_normalize_filenamer�Rs4���w�w����)�H����� ��C�R�=���Orc��eZdZd�Zd�Zy)�
BaseFilterc��||_yr)�	inclusive)rr�s  rrzBaseFilter.__init__Zs	��"��rc��t�r)�NotImplementedErrorr�s  r�_matchzBaseFilter._match]s��!�!rN)r5r6r7rr�r:rrr�r�Ys��#�"rr�c�J��eZdZ	d�fd�	Zed��Zd�Zd�Zd�Zd�Z	�xZ
S)�Filterc�|��t�|�|�||_t|�|_||_||_||_yr)�superrr�r��_filename_patternr^�
all_framesr�)rr��filename_patternr^r�r��	__class__s      �rrzFilter.__init__bs:���
����#�"���!4�5E�!F������$�����rc��|jSr)r�r"s rr�zFilter.filename_patternks���%�%�%rc��t|�}tj||j�sy|j�y||jk(S)NFT)r��fnmatchr�r^�rrYr^s   r�_match_frame_implzFilter._match_frame_implos?��&�x�0�����x��)?�)?�@���;�;����d�k�k�)�*rc�B�|j||�|jzSr)r�r�r�s   r�_match_framezFilter._match_framexs!���%�%�h��7�t�~�~�;M�N�Nrc����jr-t�fd�|D��r�jS�jS|d\}}�j||�S)Nc3�H�K�|]\}}�j||����y�wr)r�)r}rYr^rs   �rrz*Filter._match_traceback.<locals>.<genexpr>}s+�����6�+4�'�x���)�)�(�F�;�+4�s�"r)r��anyr�r�)rrrYr^s`   r�_match_tracebackzFilter._match_traceback{sW����?�?��6�+4�6�6��~�~�%� �N�N�*�+�(��|��H�f��$�$�X�v�6�6rc��|\}}}}|j|�}|j�2|jr|xr||jk(S|xs||jk7S|Sr)r�r�r�)rr~r�rrrt�ress       rr�z
Filter._match�s^��05�-���i���#�#�I�.���;�;�"��~�~��6��$�+�+� 5�6��5�v����4�5��
r)NFN)r5r6r7rrkr�r�r�r�r��
__classcell__�r�s@rr�r�as4���7;���&��&�+�O�	7�rr�c�4��eZdZ�fd�Zed��Zd�Z�xZS)�DomainFilterc�2��t�|�|�||_yr)r�r�_domain)rr�r�r�s   �rrzDomainFilter.__init__�s���
����#���rc��|jSr)r�r"s rr�zDomainFilter.domain�s���|�|�rc�J�|\}}}}||jk(|jzSr)r�r�)rr~r�rrrts      rr�zDomainFilter._match�s+��05�-���i���$�+�+�%�d�n�n�*<�=�=r)r5r6r7rrkr�r�r�r�s@rr�r��s!��������>rr�c�N�eZdZdZd�Zd�Zed��Zd�Zd�Z	d�Z
dd�Zdd	�Zy
)�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    c�2�t|�|_||_yr)r�r��traceback_limit)rr�r�s   rrzSnapshot.__init__�s���f�o���.��rc��t|d�5}tj||tj�ddd�y#1swYyxYw)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dump�HIGHEST_PROTOCOL)rrY�fps   rr�z
Snapshot.dump�s2���(�D�
!�R��K�K��b�&�"9�"9�:�"�
!�
!�s	�&<�Ac�p�t|d�5}tj|�cddd�S#1swYyxYw)z.
        Load a snapshot from a file.
        �rbN)r�r��load)rYr�s  rr�z
Snapshot.load�s,��
�(�D�
!�R��;�;�r�?�	#�	#�
!�
!�s�,�5c�b��|rt�fd�|D��sy|rt�fd�|D��ryy)Nc3�@�K�|]}|j�����y�wr�r��r}�trace_filterr~s  �rrz)Snapshot._filter_trace.<locals>.<genexpr>�s$�����<�+:�<�$�*�*�5�1�+:�s�Fc3�B�K�|]}|j�����y�wrr�r�s  �rrz)Snapshot._filter_trace.<locals>.<genexpr>�s'�����8�'6�|�$�*�*�5�1�1�'6�s�T)r�)r�include_filters�exclude_filtersr~s   `r�
_filter_tracezSnapshot._filter_trace�s<�����<�+:�<�<����8�'6�8�8��rc���t|t�s!tdt|�jz��|rqg}g}|D]1}|j
r|j
|��!|j
|��3|jjD�cgc]}|j|||�r|��}}n$|jjj�}t||j�Scc}w)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 %s)
r%r�	TypeError�typer5r�rJr�r�r��copyr�r�)r�filtersr�r�r�r~�
new_tracess       r�
filter_traceszSnapshot.filter_traces�s����'�8�,��G�"�7�m�4�4�5�6�
6�� �O� �O� '���)�)�#�*�*�<�8�#�*�*�<�8�	!(�
.2�[�[�-@�-@�8�-@�E�!�/�/��0?�05�7� �-@�J�8�
���,�,�1�1�3�J��
�D�$8�$8�9�9��
8s�Cc�&�|dvrtd|����|r|dvrtd|z��i}i}|sZ|jjD]?}|\}}}}		||}
	||
}|xj
|z
c_|xjdz
c_�A|S|jjD]F}|\}}}}	|D]8}
	||
}
	||
}|xj
|z
c_|xjdz
c_�:�H|S#t$r1|dk(r|}n|dk(r|dd}n|dddff}t	|�}
|
||<Y��wxYw#t$rt|
|d�||
<Y��wxYw#t$r$|dk(r|
f}n|
ddff}t	|�}
|
||
<Y��wxYw#t$rt|
|d�||
<Y��wxYw)	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�A�B�B��(�*@�@��0�2:�;�<�
<����
�����,�,��>C�;���o�|�
<� *�?� ;�I�E� ��+�D��I�I��%�I��J�J�!�O�J�!-�N��%���,�,��>C�;���o�|�,�E�6�$.�u�$5�	�I�$�Y�/���	�	�T�)�	��
�
�a��
�-�-�$���G �<��;�.�!0��!�X�-�!0��!�!4��#2�1�#5�a�#8�!�"<�!>�� )�&� 1�I�2;�J��/�<�� �E�'0��D�!�'D�E�)�$�E��$�6�#�x�/�&+�X�F�',�Q�x��m�%5�F�$-�f�$5�	�,5�
�5�)�
6��$�I�+4�Y��a�+H��i�(�I�sH�C(�/D%�-E�3/E4�(7D"�!D"�%E�E�*E1�0E1�4F�Fc��|j||�}t|j��}|jdtj
��|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T��reverse�key)r
�list�values�sortrr3)rrr�groupedrMs     rrMzSnapshot.statisticssA��
�.�.��:�6���'�.�.�*�+�
�����)�*=�*=��>��rc��|j||�}|j||�}t||�}|jdtj��|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)r
rPrr<r3)r�old_snapshotrrrLrKrMs       r�
compare_tozSnapshot.compare_tosN���N�N�8�Z�8�	� �*�*�8�Z�@�	�+�I�y�A�
�����-�*A�*A��B��rN)F)
r5r6r7r8rr��staticmethodr�r�rr
rMrr:rrr�r��s?���/�;��#��#�	�:�21�f�
rr�c�l�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's7���<��<�=�	=�
�]�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�P/ �/ �d�(�#N�#N��#N�L�J��J��J�Z�$Q�$Q�N-�h�-�6�"�"�-�Z�-�`>�:�>�E�E�P	-r