File: //usr/lib/python3/dist-packages/duplicity/__pycache__/progress.cpython-310.pyc
o
b�aQ6 � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZmZ ddlZ ddl
Z
ddlZddlZddl
Z
ddlmZ ddlmZ dd lmZ dadaG d
d� de j�ZG dd
� d
e�Zdd� ZG dd� dej�ZdS )a�
Functions to compute progress of compress & upload files
The heuristics try to infer the ratio between the amount of data collected
by the deltas and the total size of the changing files. It also infers the
compression and encryption ration of the raw deltas before sending them to
the backend.
With the inferred ratios, the heuristics estimate the percentage of completion
and the time left to transfer all the (yet unknown) amount of data to send.
This is a forecast based on gathered evidence.
� )�absolute_import)�division)�object)�datetime� timedeltaN)�config)�log)�utilc s^ e Zd ZdZedd� �Zdd� Zg df� fdd� Zd d
� Zdd� Z d
d� Z
� fdd�Z� ZS )�Snapshotz�
A convenience class for storing snapshots in a space/timing efficient manner
Stores up to 10 consecutive progress snapshots, one for each volume
c
C s� t � } tjdurHtjjdkrHztdtjj d�}t�|�} |� � W | S t
yG } zt�d�
t�|��tjj� t � } W Y d}~| S d}~ww | S )z9
De-serializes cached data it if present
N� z%s/progress�rzBWarning, cannot read stored progress info from previous backup: {})r
r �restart� start_vol�open�archive_dir_path�name�pickle�load�close� Exceptionr �Warn�formatr �uexc�WarningCode�cannot_stat)�snapshot�
progressfd�e� r �4/usr/lib/python3/dist-packages/duplicity/progress.py�
unmarshall<