Updated to f string

This commit is contained in:
Dimitris Zlatanidis 2023-04-27 23:33:39 +03:00
parent 45ff5edf6c
commit 6aef8d25d9
2 changed files with 10 additions and 10 deletions

View file

@ -91,8 +91,8 @@ class CheckUpdates(Configs):
from urllib3.contrib.socks import SOCKSProxyManager from urllib3.contrib.socks import SOCKSProxyManager
except (ModuleNotFoundError, ImportError): except (ModuleNotFoundError, ImportError):
logger = logging.getLogger(LoggingConfig.date) logger = logging.getLogger(LoggingConfig.date)
logger.exception('%s: %s:', self.__class__.__name__, logger.exception(f'{self.__class__.__name__}: '
self.__class__.compare_dates.__name__) f'{self.__class__.compare_dates.__name__}')
raise SystemExit() raise SystemExit()
http = SOCKSProxyManager(f'{self.proxy_address}', headers=proxy_default_headers) 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']) repo_size: int = int(repo.headers['Content-Length'])
logger = logging.getLogger(LoggingConfig.date) logger = logging.getLogger(LoggingConfig.date)
logger.info('%s: %s: %s:', self.__class__.__name__, logger.info(f'{self.__class__.__name__}: '
self.__class__.compare_dates.__name__, f'{self.__class__.compare_dates.__name__}: '
f'{local_chg_txt=}, {local_size=}, ' f'{local_chg_txt=}, {local_size=}, '
f'{repo_chg_txt=}, {repo_size=}, ' f'{repo_chg_txt=}, {repo_size=}, '
f'{local_size != repo_size=}') f'{local_size != repo_size=}')

View file

@ -123,8 +123,8 @@ class Utilities(Configs):
except FileNotFoundError: except FileNotFoundError:
logger = logging.getLogger(LoggingConfig.date) logger = logging.getLogger(LoggingConfig.date)
logger.exception('%s: %s:', self.__class__.__name__, logger.exception(f'{self.__class__.__name__}: '
self.__class__.read_packages_from_file.__name__) f'{self.__class__.read_packages_from_file.__name__}')
self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20) self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20)
def read_file(self, file: Path) -> list: def read_file(self, file: Path) -> list:
@ -134,8 +134,8 @@ class Utilities(Configs):
return f.readlines() return f.readlines()
except FileNotFoundError: except FileNotFoundError:
logger = logging.getLogger(LoggingConfig.date) logger = logging.getLogger(LoggingConfig.date)
logger.exception('%s: %s:', self.__class__.__name__, logger.exception(f'{self.__class__.__name__}: '
self.__class__.read_file.__name__) f'{self.__class__.read_file.__name__}')
self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20) 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: 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) subprocess.call(command, shell=True, stderr=stderr, stdout=stdout)
except subprocess.CalledProcessError as error: except subprocess.CalledProcessError as error:
logger = logging.getLogger(LoggingConfig.date) logger = logging.getLogger(LoggingConfig.date)
logger.exception('%s: %s:', self.__class__.__name__, logger.exception(f'{self.__class__.__name__}'
self.__class__.process.__name__) f'{self.__class__.process.__name__}')
self.errors.raise_error_message(str(error), exit_status=20) self.errors.raise_error_message(str(error), exit_status=20)
except KeyboardInterrupt: except KeyboardInterrupt:
raise SystemExit(1) raise SystemExit(1)