Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.224.56.35
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : tracemalloc.cpython-310.opt-1.pyc
o

^bF�@sddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZdd�Z
Gdd	�d	�ZGd
d�d�Zdd
�ZeGdd�d��ZeGdd�de��Zdd�ZGdd�d�ZGdd�de�Zdd�ZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!�Zd"d#�ZdS)$�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracescCs�dD]>}t|�dkr |dkr |rd||fSd||fSt|�dks*|dkr<|r4d||fSd	||fS|d
}qdS)N)�BZKiBZMiBZGiB�TiB�drz%+.1f %sz%.1f %si(r	z%+.0f %sz%.0f %si)�abs)�size�signZunit�r�4/usr/local/python-3.10/lib/python3.10/tracemalloc.py�_format_size
s
�rc@�DeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    ��	tracebackr�countcCs||_||_||_dS�Nr)�selfrrrrrr�__init__%s
zStatistic.__init__cCst|j|j|jf�Sr)�hashrrr�rrrr�__hash__*�zStatistic.__hash__cCs2t|t�stS|j|jko|j|jko|j|jkSr)�
isinstancer�NotImplementedrrr�r�otherrrr�__eq__-s

�
�zStatistic.__eq__cCsBd|jt|jd�|jf}|jr|j|j}|dt|d�7}|S)Nz%s: size=%s, count=%iF�, average=%s)rrrr�r�textZaveragerrr�__str__4s
��zStatistic.__str__cCsd|j|j|jfS)Nz)<Statistic traceback=%r size=%i count=%i>rrrrr�__repr__>s�zStatistic.__repr__cCs|j|j|jfSr)rrrrrrr�	_sort_keyB�zStatistic._sort_keyN��__name__�
__module__�__qualname__�__doc__�	__slots__rrr!r%r&r'rrrrrs
rc@r)�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    �rr�	size_diffr�
count_diffcCs"||_||_||_||_||_dSrr0)rrrr1rr2rrrrMs

zStatisticDiff.__init__cCst|j|j|j|j|jf�Sr)rrrr1rr2rrrrrTs�zStatisticDiff.__hash__cCsJt|t�stS|j|jko$|j|jko$|j|jko$|j|jko$|j|jkSr)rr/rrrr1rr2rrrrr!Xs

�
�
�
�zStatisticDiff.__eq__cCsPd|jt|jd�t|jd�|j|jf}|jr&|j|j}|dt|d�7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTr")rrrr1rr2r#rrrr%as

��zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>r0rrrrr&ms
��zStatisticDiff.__repr__cCs t|j�|jt|j�|j|jfSr)rr1rr2rrrrrrr'rs�zStatisticDiff._sort_keyNr)rrrrr/Fs	r/cCs�g}|��D]2\}}|�|d�}|dur't||j|j|j|j|j|j�}nt||j|j|j|j�}|�|�q|��D]\}}t|d|jd|j�}|�|�q=|S�Nr)�items�popr/rr�append)�	old_group�	new_group�
statisticsr�statZpreviousrrr�_compare_grouped_statsxs"��r;c@s\eZdZdZdZdd�Zedd��Zedd��Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Framez
    Frame of a traceback.
    ��_framecC�
||_dSrr=�r�framerrrr��
zFrame.__init__cC�
|jdSr3r=rrrr�filename�rBzFrame.filenamecCrC�N�r=rrrr�lineno�rBzFrame.linenocC�t|t�stS|j|jkSr�rr<rr>rrrrr!��
zFrame.__eq__cC�t|t�stS|j|jkSrrIrrrr�__lt__�rJzFrame.__lt__cC�
t|j�Sr)rr>rrrrr��
zFrame.__hash__cC�d|j|jfS)Nz%s:%s�rDrGrrrrr%�r(z
Frame.__str__cCrO)Nz<Frame filename=%r lineno=%r>rPrrrrr&�r(zFrame.__repr__N)r*r+r,r-r.r�propertyrDrGr!rLrr%r&rrrrr<�s

r<c@steZdZdZdZddd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS)�	Tracebackz`
    Sequence of Frame instances sorted from the oldest frame
    to the most recent frame.
    )�_frames�
_total_nframeNcCs"t�|�tt|��|_||_dSr)rr�tuple�reversedrSrT)r�frames�total_nframerrrr�s

zTraceback.__init__cC�|jSr)rTrrrrrX��zTraceback.total_nframecCrMr)�lenrSrrrr�__len__�rNzTraceback.__len__cC�0t|t�rtdd�|j|D��St|j|�S)Ncs��|]}t|�VqdSr)r<��.0�tracerrr�	<genexpr>���z(Traceback.__getitem__.<locals>.<genexpr>)r�slicerUrSr<�r�indexrrr�__getitem__��
zTraceback.__getitem__cC�|j|jvSr)r>rSr@rrr�__contains__��zTraceback.__contains__cCrMr)rrSrrrrr�rNzTraceback.__hash__cCrHr�rrRrrSrrrrr!�rJzTraceback.__eq__cCrKrrlrrrrrL�rJzTraceback.__lt__cCst|d�Sr3)�strrrrrr%�rkzTraceback.__str__cCs:dt|���}|jdur|d7}|S|d|j�d�7}|S)Nz<Traceback �>z total_nframe=)rUrTrX)r�srrrr&�s
�zTraceback.__repr__FcCs�g}|dur|dkr||d�}q|d|�}n|}|r!t|�}|D] }|�d|j|jf�t�|j|j���}|rC|�d|�q#|S)Nrz  File "%s", line %sz    %s)rVr6rDrG�	linecache�getline�strip)r�limitZmost_recent_first�linesZframe_slicerA�linerrr�format�s"
��zTraceback.formatr)NF)r*r+r,r-r.rrQrXr\rgrjrr!rLr%r&rvrrrrrR�s
	
rRcCst|�}|dur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)rrR)�objrWrrr�get_object_tracebacksrxc@s`eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Tracez"
    Trace of a memory block.
    ��_tracecCr?rrz�rrarrrrs
zTrace.__init__cCrCr3rzrrrr�domainrBzTrace.domaincCrCrErzrrrrrrBz
Trace.sizecCst|jdd��S)N�)rRr{rrrrr#szTrace.tracebackcCrHr)rryrr{rrrrr!'rJzTrace.__eq__cCrMr)rr{rrrrr,rNzTrace.__hash__cCsd|jt|jd�fS)Nz%s: %sF)rrrrrrrr%/sz
Trace.__str__cCsd|jt|jd�|jfS)Nz'<Trace domain=%s size=%s, traceback=%r>F)r}rrrrrrrr&2s�zTrace.__repr__N)r*r+r,r-r.rrQr}rrr!rr%r&rrrrrys


ryc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracescCst�|�||_dSr)rr�_traces)r�tracesrrrr8s

z_Traces.__init__cCrMr)r[r�rrrrr\=rNz_Traces.__len__cCr])Ncsr^r)ryr_rrrrbBrcz&_Traces.__getitem__.<locals>.<genexpr>)rrdrUr�ryrerrrrg@rhz_Traces.__getitem__cCrir)r{r�r|rrrrjFrkz_Traces.__contains__cCrHr)rrrr�rrrrr!IrJz_Traces.__eq__cCsdt|�S)Nz<Traces len=%s>)r[rrrrr&Nrkz_Traces.__repr__N)	r*r+r,rr\rgrjr!r&rrrrr7srcCs&tj�|�}|�d�r|dd�}|S)Nz.pyc���)�os�path�normcase�endswith)rDrrr�_normalize_filenameRs
r�c@seZdZdd�Zdd�ZdS)�
BaseFiltercCr?r)�	inclusive)rr�rrrrZrNzBaseFilter.__init__cCst�r)�NotImplementedErrorr|rrr�_match]szBaseFilter._matchN)r*r+r,rr�rrrrr�Ysr�csLeZdZ	d�fdd�	Zedd��Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�FilterNFcs2t��|�||_t|�|_||_||_||_dSr)�superrr�r��_filename_patternrG�
all_framesr})rr��filename_patternrGr�r}��	__class__rrrbs

zFilter.__init__cCrYr)r�rrrrr�krZzFilter.filename_patterncCs2t|�}t�||j�s
dS|jdurdS||jkS)NFT)r��fnmatchr�rG�rrDrGrrr�_match_frame_implos

zFilter._match_frame_implcCs|�||�|jASr)r�r�r�rrr�_match_framexrzFilter._match_framecsB�jrt�fdd�|D��r�jS�jS|d\}}��||�S)Nc3s �|]\}}��||�VqdSr)r�)r`rDrGrrrrb}s��z*Filter._match_traceback.<locals>.<genexpr>r)r��anyr�r�)rrrDrGrrr�_match_traceback{s�zFilter._match_tracebackcCsF|\}}}}|�|�}|jdur!|jr|o||jkS|p ||jkS|Sr)r�r}r�)rrar}rrrX�resrrrr��s

z
Filter._match)NFN)r*r+r,rrQr�r�r�r�r��
__classcell__rrr�rr�as�	
	r�cs0eZdZ�fdd�Zedd��Zdd�Z�ZS)�DomainFiltercst��|�||_dSr)r�r�_domain)rr�r}r�rrr�s
zDomainFilter.__init__cCrYr)r�rrrrr}�rZzDomainFilter.domaincCs|\}}}}||jk|jASr)r}r�)rrar}rrrXrrrr��szDomainFilter._match)r*r+r,rrQr}r�r�rrr�rr��s

r�c@sXeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�ZdS)�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    cCst|�|_||_dSr)rr��traceback_limit)rr�r�rrrr�s

zSnapshot.__init__cCs@t|d��}t�||tj�Wd�dS1swYdS)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dump�HIGHEST_PROTOCOL)rrD�fprrrr��s"�z
Snapshot.dumpcCs8t|d��
}t�|�Wd�S1swYdS)z.
        Load a snapshot from a file.
        �rbN)r�r��load)rDr�rrrr��s$�z
Snapshot.loadcs@|rt�fdd�|D��sdS|rt�fdd�|D��rdSdS)Nc3s�|]}|���VqdSr�r��r`�trace_filter�rarrrb�s��z)Snapshot._filter_trace.<locals>.<genexpr>Fc3s�|]	}|���VqdSrr�r�r�rrrb�s��T)r�)r�include_filters�exclude_filtersrarr�r�
_filter_trace�s��zSnapshot._filter_tracecs�t|t�stdt|�j��|r5g�g�|D]}|jr!��|�q��|�q���fdd��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 %scsg|]}����|�r|�qSr)r�r_�r�r�rrr�
<listcomp>�s�
�z*Snapshot.filter_traces.<locals>.<listcomp>)rr�	TypeError�typer*r�r6r�r��copyr�r�)r�filtersr�Z
new_tracesrr�r�
filter_traces�s
�zSnapshot.filter_tracesc
Cs�|dvrtd|f��|r|dvrtd|��i}i}|s�|jjD]`}|\}}}}	z||}
Wn,ty[|dkr=|}n|dkrH|dd�}n	|dddff}t|�}
|
||<Ynwz||
}|j|7_|jd7_Wq!ty�t|
|d�||
<Yq!w|S|jjD]Y}|\}}}}	|D]N}
z||
}
Wn ty�|dkr�|
f}n|
ddff}t|�}
|
||
<Ynwz||
}|j|7_|jd7_Wq�ty�t|
|d�||
<Yq�wq�|S)	N)rrDrGzunknown key_type: %r)rGrDz/cumulative mode cannot by used with key type %rrrGrFr)�
ValueErrorr�r��KeyErrorrRrrr)r�key_type�
cumulativeZstatsZ
tracebacksrar}rZtrace_tracebackrXrrWr:rArrr�	_group_by�sf��	�����zSnapshot._group_byFcCs,|�||�}t|���}|jdtjd�|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T��reverse�key)r��list�values�sortrr')rr�r�Zgroupedr9rrrr9szSnapshot.statisticscCs6|�||�}|�||�}t||�}|jdtjd�|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�r;r�r/r')rZold_snapshotr�r�r8r7r9rrr�
compare_tos

zSnapshot.compare_toN)F)
r*r+r,r-rr��staticmethodr�r�r�r�r9r�rrrrr��s

3
r�cCs$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�RuntimeErrorrZget_traceback_limitr�)r�r�rrr�
take_snapshot's

r�)�collections.abcrr�	functoolsrr�rpZos.pathr�r�Z_tracemallocrrrrr/r;r<rRrxryrr�r�r�r�r�r�rrrr�<module>s4(2&M'0	
© 2025 GrazzMean