From 929d803d86839d59880dda1000b7d984d66d5008 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Mon, 1 Apr 2019 11:00:43 -0700 Subject: [PATCH] Make Hierarchy a path-like object --- rbackup/hierarchy/hierarchy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rbackup/hierarchy/hierarchy.py b/rbackup/hierarchy/hierarchy.py index fab943d..34b3389 100644 --- a/rbackup/hierarchy/hierarchy.py +++ b/rbackup/hierarchy/hierarchy.py @@ -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.