https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/duplicity/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/duplicity/__pycache__/statistics.cpython-310.pyc
o

��`5�@s�dZddlmZddlmZddlmZddlmZddlmZddlZddl	Z	ddl
Z
ddlmZGd	d
�d
e
�ZGdd�de�ZGd
d�de�ZdS)z&Generate and process backup statistics�)�division)�zip)�map)�str)�objectN)�dup_timec@seZdZdS)�StatsExceptionN)�__name__�
__module__�__qualname__�rr�6/usr/lib/python3/dist-packages/duplicity/statistics.pyr%src@s�eZdZdZe�d�ZdZdZdZ	de	eeZ
dZdZd	d
�Z
dd�Zd
d�Zdd�Zdd�Zd1dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0S)2�StatsObjz@Contains various statistics, provide string conversion functions� )
�SourceFiles�SourceFileSize�NewFiles�NewFileSize�DeletedFiles�ChangedFiles�ChangedFileSize�ChangedDeltaSize�DeltaEntries�RawDeltaSize)�Errors�TotalDestinationSizeChange)�	StartTime�EndTime�ElapsedTime)�Filename)
)rF)rT)rF)rT)rF)rF)rT)rT)rF)rT))l�TB)i@�GB)i�MB)i�KBcCs|jD]}d|j|<qdS)zSet attributes to NoneN)�
stat_attrs�__dict__��self�attrrrr
�__init__Ss
�zStatsObj.__init__cCs
|j|S)zGet a statistic�r%)r'�	attributerrr
�get_statXs
zStatsObj.get_statcCs||j|<dS)zSet attribute to given valueNr*)r'r(�valuerrr
�set_stat\�zStatsObj.set_statcCs|j|d7<dS)zAdd 1 to value of attribute�Nr*r&rrr
�increment_stat`szStatsObj.increment_statcCsdS)z�Return total destination size change

        This represents the total increase in the size of the
        duplicity destination directory, or None if not available.

        rr�r'rrr
�get_total_dest_size_changedsz#StatsObj.get_total_dest_size_changer0csp�fdd��jD�}|sd}n!tjj|�}|r0�j�dt|��}d}|ddkr*d}||d	�}d
�|g|�S)z8Return one line abbreviated version of full stats stringcsg|]	}t��|���qSr)rr,)�.0�ar2rr
�
<listcomp>osz+StatsObj.get_stats_line.<locals>.<listcomp>�.z\\x20r0r�u����r)�stat_file_attrs�os�path�join�space_regex�sub�repr)r'�index�use_repr�
file_attrs�filename�nrr2r
�get_stats_linemszStatsObj.get_stats_linecs��fdd�}�ddkr�dd����d�}t|�t|j�kr#|�t|j|t|j�d��D]-\}}zt|�}WntyWzt|�}WntyT|�YnwYnw|�||�q1|S)zSet statistics from given linecstd����Nz
Bad line '%s'�rr��linerr
�error��z+StatsObj.set_stats_from_line.<locals>.errorr:�
Nr)�split�lenr;r�int�
ValueError�floatr.)r'rKrL�	linepartsr(�
val_string�valrrJr
�set_stats_from_line~s*
�
���zStatsObj.set_stats_from_linecCsd|��|��|��fS)z.Return extended string printing out statisticsz%s%s%s)�get_timestats_string�get_filestats_string�get_miscstats_stringr2rrr
�get_stats_string�s�zStatsObj.get_stats_stringcCs�g}|jdur|�d|jt�|j�f�|jdur(|�d|jt�|j�f�|js5|jdurO|jdurO|jdurA|j|j|_|�d|jt�|j�f�d�|�S)z5Return portion of statistics string dealing with timeNzStartTime %.2f (%s)
zEndTime %.2f (%s)
zElapsedTime %.2f (%s)
�)r�appendr�timetoprettyrr�inttoprettyr>)r'�timelistrrr
rX�s"
�
�

�
zStatsObj.get_timestats_stringcs�fdd�}d�t|�j��S)z9Return portion of statistics string about files and bytescsB|\}}��|�}|durdS|rd||��|�fSd||fS)z%Return zero or one line of the stringNr\z%s %s (%s)
z%s %s
)r,�get_byte_summary_string)�stat_file_pairr(�in_bytesrVr2rr
�fileline�s
�z/StatsObj.get_filestats_string.<locals>.fileliner\)r>r�stat_file_pairs)r'rdrr2r
rY�szStatsObj.get_filestats_stringcCsDd}|j}|dur|d||�|�f7}|jdur |d|j7}|S)z<Return portion of extended stat string about misc attributesr\Nz#TotalDestinationSizeChange %s (%s)
z
Errors %d
)rrar)r'�misc_string�tdscrrr
rZ�s�
zStatsObj.get_miscstats_stringcCs�|dkr
d}|}nd}|jD]*\}}||kr9t|�|}|dkr$d}n	|dkr+d}nd}d|||f|fSqt|�}|dkrF|d	Sd
||fS)z9Turn byte count into human readable string like "7.23GB" r�-r\�d�
r0r9z%s%%.%df %sz1 bytez
%s%d bytes)�byte_abbrev_listrS�round)r'�
byte_count�sign�abbrev_bytes�
abbrev_string�abbrev_count�	precisionrrr
ra�s(��z StatsObj.get_byte_summary_stringcCs&d|}dt|�}d||��|fS)z0Like get_stats_string, but add header and footerz"--------------[ %s ]--------------rhz%s
%s%s
)rPr[)r'�title�header�footerrrr
�get_stats_logstring�szStatsObj.get_stats_logstringc		Cs�dd�}|�d�D]Z}|sq	|��}t|�dkr||�|dd�\}}||jvr-||�z)zt|�}Wnty?d}Ynwt|�}||krO|�||�n|�||�Wq	tyc||�Yq	w|S)z>Initialize attributes from string, return self for conveniencecSstd|��rHrIrJrrr
rL�rMz-StatsObj.set_stats_from_string.<locals>.errorrNr9N)rOrPr$rQrRrSr.)	r'�srLrK�
line_partsr(�value_string�val1�val2rrr
�set_stats_from_string�s2
���zStatsObj.set_stats_from_stringcCs(|�d�}|�|���|��rJ�dS)z%Write statistics string to given path�wN)�open�writer[�close)r'r=�finrrr
�write_stats_to_paths
zStatsObj.write_stats_to_pathcCs(|�d�}|�|���|��rJ�|S)z5Set statistics from path, return self for convenience�r)r~r|�readr�)r'r=�fprrr
�read_stats_from_paths
zStatsObj.read_stats_from_pathcCs8t|t�sJ�|jD]}|�|�|�|�krdSq
dS)z,Return true if s has same statistics as selfNr0)�
isinstancerr;r,�r'rwr(rrr
�stats_equals
�zStatsObj.stats_equalc	Cs�|jD]}|�|d�q|D]+}|jD]%}|�|�dur#|�|d�q|�|�dur8|�||�|�|�|��qqd|_d|_|jD]}|�|�dur[|�||�|�tt|���qC|S)z9Set self's attributes to average of those in statobj_listrN)r$r.r,rrrSrP)r'�statobj_listr(�statobjrrr
�set_to_averages*

���
��zStatsObj.set_to_averagecCs(t�}|jD]}|�||�|��q|S)z2Return new StatsObj object with same stats as self)rr$r.r,r�rrr
�get_statsobj_copy,s
zStatsObj.get_statsobj_copyN)r0) r	r
r�__doc__�re�compiler?r;�stat_misc_attrs�stat_time_attrsr$rerkr)r,r.r1r3rGrWr[rXrYrZrarvr|r�r�r�r�r�rrrr
r)s@

��
	rc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�StatsDeltaProcessz0Keep track of statistics during DirDelta processcCs:t�|�tjD]}d|j|<qd|_t��|_g|_dS)z4StatsDeltaProcess initializer - zero file attributesrN)rr)r;r%r�timer�
files_changedr&rrr
r)6s



zStatsDeltaProcess.__init__cC�P|��}|jd7_|jd7_|j|7_|jd7_|�|d�dS)z(Add stats of new file path to statisticsr0snewN)�getsizerrrr�add_delta_entries_file�r'r=�filesizerrr
�add_new_file?�zStatsDeltaProcess.add_new_filecCr�)z4Add stats of file that has changed since last backupr0schangedN)r�rrrrr�r�rrr
�add_changed_fileIr�z"StatsDeltaProcess.add_changed_filecCs,|jd7_|jd7_|�|d�dS)z/Add stats of file no longer in source directoryr0sdeletedN)rrr�)r'r=rrr
�add_deleted_fileSsz"StatsDeltaProcess.add_deleted_filecCs(|��}|jd7_|j|7_dS)z7Add stats of file that hasn't changed since last backupr0N)r�rrr�rrr
�add_unchanged_fileYsz$StatsDeltaProcess.add_unchanged_filecCst��|_dS)z#End collection of data, set EndTimeN)r�rr2rrr
r�_r/zStatsDeltaProcess.closecCs$|��r|j�|��|f�dSdS�N)�isregr�r]�get_relative_path)r'r=�action_typerrr
r�cs�z(StatsDeltaProcess.add_delta_entries_filecCs|jSr�)r�r2rrr
�get_delta_entries_filegsz(StatsDeltaProcess.get_delta_entries_fileN)r	r
rr�r)r�r�r�r�r�r�r�rrrr
r�4s	

r�)r��
__future__r�builtinsrrrrr�r�r<�	duplicityr�	Exceptionrrr�rrrr
�<module>s

https://t.me/RX1948 - 2025