Mini Shell

Direktori : /proc/self/root/opt/bakmgr/lib/python3.6/site-packages/bakmgr/api/restic/
Upload File :
Current File : //proc/self/root/opt/bakmgr/lib/python3.6/site-packages/bakmgr/api/restic/data.py

"""Restic dataclasses"""
from typing import TYPE_CHECKING
import time
import dateutil.parser

if TYPE_CHECKING:
    from .base import Restic


class Snapshot:
    """Represents a restic snapshot"""

    def __init__(self, *, restic: 'Restic', data: dict):
        self.restic = restic
        self.id = str(data['id'])
        self.tags = list(data.get('tags', []))
        self.datetime = dateutil.parser.parse(data['time'])
        self.timestamp = int(time.mktime(self.datetime.timetuple()))
        self.paths = list(data['paths'])
        self.forget = lambda: self.restic.forget(self.id)

    def __repr__(self):
        return f'Snapshot<{self.id}>'

Zerion Mini Shell 1.0