Potential fix for async init returning coro

This commit is contained in:
Darryl Nixon 2023-07-16 11:22:17 -07:00
parent d8b3fb7f17
commit 559d63dea9

View file

@ -30,7 +30,17 @@ async def get_all_hardlinks(paths: Set[Path]) -> None:
return paths 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.""" """Class for tracking each directory to be shredded, and its contents."""
async def __init__(self, path: Path) -> None: async def __init__(self, path: Path) -> None:
@ -70,7 +80,7 @@ class ShredDir:
return hash(self.absolute_path) return hash(self.absolute_path)
class ShredFile: class ShredFile(AsyncObject):
"""Class for tracking each file to be shredded.""" """Class for tracking each file to be shredded."""
async def __init__(self, path: Path) -> None: async def __init__(self, path: Path) -> None: