General cleanup
This commit is contained in:
parent
5dd315a447
commit
2f94b6821c
@ -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
|
||||
|
||||
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.")
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user