From 04bce50fb9276bc8fdb2df7dcaa4ca11ea137304 Mon Sep 17 00:00:00 2001 From: Darryl Nixon Date: Sun, 16 Jul 2023 13:35:47 -0700 Subject: [PATCH] resolve() is broken in aiopath hacky fix for now --- melamine/classes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/melamine/classes.py b/melamine/classes.py index 9e51cb0..95c8e43 100644 --- a/melamine/classes.py +++ b/melamine/classes.py @@ -1,6 +1,7 @@ import asyncio import hashlib from collections.abc import Generator +from pathlib import Path from secrets import token_bytes from typing import List from typing import Set @@ -28,7 +29,9 @@ class ShredDir(AsyncObject): """Class for tracking each directory to be shredded, and its contents.""" async def __init__(self, path: AsyncPath, recursive: bool) -> None: - self.absolute_path = await (await path.resolve()).absolute() + # https://github.com/alexdelorenzo/aiopath/issues/30 :( + resolved = AsyncPath(Path(path).resolve()) + self.absolute_path = await resolved.absolute() self.mount_point = await find_mount(self.absolute_path) self.contents = await self._get_contents(recursive) self.mount_points = set(m for m in self.enumerate_mount_points()) @@ -87,7 +90,9 @@ class ShredFile(AsyncObject): """Class for tracking each file to be shredded.""" async def __init__(self, path: AsyncPath) -> None: - self.absolute_path = await (await path.resolve()).absolute() + # https://github.com/alexdelorenzo/aiopath/issues/30 :( + resolved = AsyncPath(Path(path).resolve()) + self.absolute_path = await resolved.absolute() stat = await path.stat() self.byte_size = stat.st_size self.inode = stat.st_ino