Updated for naming

This commit is contained in:
Dimitris Zlatanidis 2023-05-13 23:25:02 +03:00
parent e242261270
commit 8d56d550e6

View file

@ -34,7 +34,7 @@ class Md5sum:
filename = source_file.split('/')[-1]
source_path = Path(path, filename)
md5 = self.read_file(source_path)
md5 = self.read_binary_file(source_path)
file_check: str = hashlib.md5(md5).hexdigest()
checksum = "".join(checksum)
@ -42,13 +42,12 @@ class Md5sum:
self.ascii.draw_checksum_error_box(filename, checksum, file_check)
self.view.question()
def read_file(self, filename: Union[str, Path]) -> bytes:
""" Reads the file. """
def read_binary_file(self, filename: Union[str, Path]) -> bytes:
try:
with open(filename, 'rb') as f:
return f.read()
except FileNotFoundError:
logger = logging.getLogger(LoggingConfig.date_time)
logger.exception(f'{self.__class__.__name__}: '
f'{self.__class__.read_file.__name__}')
f'{self.__class__.read_binary_file.__name__}')
self.errors.raise_error_message(f"No such file or directory: '{filename}'", exit_status=20)