Make Hierarchy a path-like object
This commit is contained in:
parent
e58c6b7c27
commit
929d803d86
@ -6,6 +6,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
|
from os import PathLike
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# ========== Logging Setup ===========
|
# ========== Logging Setup ===========
|
||||||
@ -18,7 +19,7 @@ METADATA_WRITE = "wb"
|
|||||||
|
|
||||||
|
|
||||||
# ========== Classes ==========
|
# ========== Classes ==========
|
||||||
class Hierarchy:
|
class Hierarchy(PathLike):
|
||||||
"""A class for organizing the backup root hierarchy.
|
"""A class for organizing the backup root hierarchy.
|
||||||
|
|
||||||
Upon creation of a Hierarchy object, it is up to the caller
|
Upon creation of a Hierarchy object, it is up to the caller
|
||||||
@ -53,6 +54,9 @@ class Hierarchy:
|
|||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
def __fspath__(self):
|
||||||
|
return str(self._path)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
"""Return the base directory of this hierarchy.
|
"""Return the base directory of this hierarchy.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user