Remove deprecated "processed" attributes

This commit is contained in:
Darryl Nixon 2023-07-16 10:39:38 -07:00
parent e60812c136
commit b96ad00679

View file

@ -17,7 +17,6 @@ class ShredDir:
def __init__(self, path: Path) -> None: def __init__(self, path: Path) -> None:
self.absolute_path = path.resolve() self.absolute_path = path.resolve()
self.processed = False
self.contents = self._get_contents() self.contents = self._get_contents()
self.byte_size = sum(item.byte_size for item in self.contents) self.byte_size = sum(item.byte_size for item in self.contents)
self.mount_point = find_mount(self.absolute_path) self.mount_point = find_mount(self.absolute_path)
@ -59,16 +58,12 @@ class ShredFile:
def __init__(self, path: Path) -> None: def __init__(self, path: Path) -> None:
self.absolute_path = path.resolve() self.absolute_path = path.resolve()
self.byte_size = path.stat().st_size self.byte_size = path.stat().st_size
self.processed = False
self.mount_point = find_mount(self.absolute_path) self.mount_point = find_mount(self.absolute_path)
self.fs_handler = None self.fs_handler = None
self.hardlinks = None self.hardlinks = None
async def shred(self, hash: bool = False, dryrun: bool = False) -> Union[bool, bytes]: async def shred(self, hash: bool = False, dryrun: bool = False) -> Union[bool, bytes]:
"""Shred the file with a single file descriptor.""" """Shred the file with a single file descriptor."""
if not self.processed:
logger.error(f"File {self.absolute_path} tried to shred early.")
return False
try: try:
logger.info(f"Shredding file: {self.absolute_path}") logger.info(f"Shredding file: {self.absolute_path}")