Make Hierarchy a path-like object

This commit is contained in:
Eric Torres 2019-04-01 11:00:43 -07:00
parent e58c6b7c27
commit 929d803d86

View File

@ -6,6 +6,7 @@
import logging
import pickle
from os import PathLike
from pathlib import Path
# ========== Logging Setup ===========
@ -18,7 +19,7 @@ METADATA_WRITE = "wb"
# ========== Classes ==========
class Hierarchy:
class Hierarchy(PathLike):
"""A class for organizing the backup root hierarchy.
Upon creation of a Hierarchy object, it is up to the caller
@ -53,6 +54,9 @@ class Hierarchy:
except TypeError as e:
raise e
def __fspath__(self):
return str(self._path)
@property
def path(self):
"""Return the base directory of this hierarchy.