Stray await

This commit is contained in:
Darryl Nixon 2023-07-16 13:37:58 -07:00
parent 04bce50fb9
commit efce306977

View file

@ -3,7 +3,6 @@ import hashlib
from collections.abc import Generator from collections.abc import Generator
from pathlib import Path from pathlib import Path
from secrets import token_bytes from secrets import token_bytes
from typing import List
from typing import Set from typing import Set
from typing import Union from typing import Union
@ -40,7 +39,7 @@ class ShredDir(AsyncObject):
stat = await path.stat() stat = await path.stat()
self.inode = stat.st_ino self.inode = stat.st_ino
async def _get_contents(self, recursive: bool) -> List: async def _get_contents(self, recursive: bool) -> Set:
tasks = [] tasks = []
async for subpath in self.absolute_path.glob("*"): async for subpath in self.absolute_path.glob("*"):
if await subpath.is_dir(): if await subpath.is_dir():
@ -52,8 +51,8 @@ class ShredDir(AsyncObject):
else: else:
logger.warning(f"Subdirectory found: {subpath}, skipping (see -r/--recursive))") logger.warning(f"Subdirectory found: {subpath}, skipping (see -r/--recursive))")
elif subpath.is_file(): elif subpath.is_file():
tasks.append(await ShredFile(subpath)) tasks.append(ShredFile(subpath))
return await asyncio.gather(*tasks) return set(await asyncio.gather(*tasks))
def enumerate_mount_points(self) -> Generator: def enumerate_mount_points(self) -> Generator:
for item in self.contents: for item in self.contents: