diff --git a/rbackup/struct/hierarchy.py b/rbackup/struct/hierarchy.py index b52369d..5701958 100644 --- a/rbackup/struct/hierarchy.py +++ b/rbackup/struct/hierarchy.py @@ -47,10 +47,7 @@ class Hierarchy(PathLike): :param dest: the root directory of the backup hierarchy :type dest: str or path-like object """ - try: - self._path = Path(dest).resolve() - except TypeError as e: - raise e + self._path = Path(dest).resolve() def __fspath__(self): return str(self._path) @@ -85,7 +82,7 @@ class Hierarchy(PathLike): def gen_metadata(self): """Generate metadata for this repository. - After this method is called, the data necessary for this repository has been created. + After this method is called, the data necessary for this hierarchy has been created. """ raise NotImplementedError("This method must be called in a child class.") diff --git a/rbackup/struct/repository.py b/rbackup/struct/repository.py index 7a37f4a..5d5d163 100644 --- a/rbackup/struct/repository.py +++ b/rbackup/struct/repository.py @@ -38,11 +38,11 @@ class Repository(Hierarchy): Attributes ---------- - * path (inherited from Hierarchy) - * name (inherited from Hierarchy) - * metadata_path (inherited from Hierarchy) - * snapshots - a list of snapshots stored in this repository - * snapshot_dir - the snapshot storage location of this repository + * Repository.path (inherited from Hierarchy) + * Repository.name (inherited from Hierarchy) + * Repository.metadata_path (inherited from Hierarchy) + * Repository.snapshots - a list of snapshots stored in this repository + * Repository.snapshot_dir - the snapshot storage location of this repository Methods ------- @@ -170,6 +170,12 @@ class Repository(Hierarchy): """ return not self.snapshots + def gen_metadata(self): + """Generate metadata for this repository. + After this method is called, the data necessary for this snapshot has been created. + """ + pass + def create_snapshot(self, name=None): """Create a new snapshot in this repository. diff --git a/rbackup/struct/snapshot.py b/rbackup/struct/snapshot.py index 959e99f..2b9403c 100644 --- a/rbackup/struct/snapshot.py +++ b/rbackup/struct/snapshot.py @@ -16,10 +16,10 @@ class Snapshot(Hierarchy): """Hierarchy for a single snapshot. Attributes ---------- - * path (inherited from Hierarchy) - * name (inherited from Hierarchy) - * metadata_path (inherited from Hierarchy) - * pkg_dir + * Snapshot.path (inherited from Hierarchy) + * Snapshot.name (inherited from Hierarchy) + * Snapshot.metadata_path (inherited from Hierarchy) + * Snapshot.pkg_dir Methods ------- @@ -44,6 +44,12 @@ class Snapshot(Hierarchy): """ return self.path / "pkg" + def gen_metadata(self): + """Generate metadata for this repository. + After this method is called, the data necessary for this snapshot has been created. + """ + pass + # ========== Functions ========== if __name__ == "__main__":