From 6aef8d25d9c40a103780ac27bd92179606f21976 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 27 Apr 2023 23:33:39 +0300 Subject: [PATCH] Updated to f string --- slpkg/check_updates.py | 8 ++++---- slpkg/utilities.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index 51738b43..f83334b5 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -91,8 +91,8 @@ class CheckUpdates(Configs): from urllib3.contrib.socks import SOCKSProxyManager except (ModuleNotFoundError, ImportError): logger = logging.getLogger(LoggingConfig.date) - logger.exception('%s: %s:', self.__class__.__name__, - self.__class__.compare_dates.__name__) + logger.exception(f'{self.__class__.__name__}: ' + f'{self.__class__.compare_dates.__name__}') raise SystemExit() http = SOCKSProxyManager(f'{self.proxy_address}', headers=proxy_default_headers) @@ -107,8 +107,8 @@ class CheckUpdates(Configs): repo_size: int = int(repo.headers['Content-Length']) logger = logging.getLogger(LoggingConfig.date) - logger.info('%s: %s: %s:', self.__class__.__name__, - self.__class__.compare_dates.__name__, + logger.info(f'{self.__class__.__name__}: ' + f'{self.__class__.compare_dates.__name__}: ' f'{local_chg_txt=}, {local_size=}, ' f'{repo_chg_txt=}, {repo_size=}, ' f'{local_size != repo_size=}') diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 2217183d..506197e3 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -123,8 +123,8 @@ class Utilities(Configs): except FileNotFoundError: logger = logging.getLogger(LoggingConfig.date) - logger.exception('%s: %s:', self.__class__.__name__, - self.__class__.read_packages_from_file.__name__) + logger.exception(f'{self.__class__.__name__}: ' + f'{self.__class__.read_packages_from_file.__name__}') self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20) def read_file(self, file: Path) -> list: @@ -134,8 +134,8 @@ class Utilities(Configs): return f.readlines() except FileNotFoundError: logger = logging.getLogger(LoggingConfig.date) - logger.exception('%s: %s:', self.__class__.__name__, - self.__class__.read_file.__name__) + logger.exception(f'{self.__class__.__name__}: ' + f'{self.__class__.read_file.__name__}') self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20) def process(self, command: str, stderr=None, stdout=None) -> None: @@ -144,8 +144,8 @@ class Utilities(Configs): subprocess.call(command, shell=True, stderr=stderr, stdout=stdout) except subprocess.CalledProcessError as error: logger = logging.getLogger(LoggingConfig.date) - logger.exception('%s: %s:', self.__class__.__name__, - self.__class__.process.__name__) + logger.exception(f'{self.__class__.__name__}' + f'{self.__class__.process.__name__}') self.errors.raise_error_message(str(error), exit_status=20) except KeyboardInterrupt: raise SystemExit(1)