From 559d63dea9666c8a91636feb574e4fe4ce1951dd Mon Sep 17 00:00:00 2001 From: Darryl Nixon Date: Sun, 16 Jul 2023 11:22:17 -0700 Subject: [PATCH] Potential fix for async init returning coro --- melamine/classes.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/melamine/classes.py b/melamine/classes.py index 3e407a5..921ca97 100644 --- a/melamine/classes.py +++ b/melamine/classes.py @@ -30,7 +30,17 @@ async def get_all_hardlinks(paths: Set[Path]) -> None: return paths -class ShredDir: +class AsyncObject(object): + async def __new__(cls, *a, **kw): + instance = super().__new__(cls) + await instance.__init__(*a, **kw) + return instance + + async def __init__(self): + pass + + +class ShredDir(AsyncObject): """Class for tracking each directory to be shredded, and its contents.""" async def __init__(self, path: Path) -> None: @@ -70,7 +80,7 @@ class ShredDir: return hash(self.absolute_path) -class ShredFile: +class ShredFile(AsyncObject): """Class for tracking each file to be shredded.""" async def __init__(self, path: Path) -> None: