def should_retain(self, dataset: str, parsed_snapshot_name: ParsedSnapshotName): delete_before = self.idealized_now - self.periodic_snapshot_task.lifetime return idealized_datetime(parsed_snapshot_name.datetime) >= delete_before
def __init__(self, now: datetime, periodic_snapshot_task: PeriodicSnapshotTask): self.idealized_now = idealized_datetime(now) self.periodic_snapshot_task = periodic_snapshot_task