From 5d3ed3f08f494a159d83866f5c7e3b8de271fd22 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 7 Jun 2024 12:18:21 +0300 Subject: [PATCH] Updated for tomlkit exceptions Signed-off-by: Dimitris Zlatanidis --- slpkg/blacklist.py | 3 +-- slpkg/configs.py | 4 +--- slpkg/repositories.py | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index ad5d404c..ffc60c3c 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -4,7 +4,6 @@ from pathlib import Path import tomlkit -from tomlkit.exceptions import TOMLKitError from slpkg.configs import Configs from slpkg.toml_errors import TomlErrors @@ -27,7 +26,7 @@ class Blacklist(Configs): # pylint: disable=[R0903] with open(self.blacklist_file_toml, 'r', encoding='utf-8') as file: black: dict = tomlkit.parse(file.read()) packages: list = black['PACKAGES'] - except (KeyError, TOMLKitError) as error: + except (KeyError, tomlkit.exceptions.TOMLKitError) as error: print() self.toml_errors.raise_toml_error_message(error, self.blacklist_file_toml) diff --git a/slpkg/configs.py b/slpkg/configs.py index 0926cef1..8f888aa5 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -6,9 +6,7 @@ import platform from typing import Any from pathlib import Path from dataclasses import dataclass - import tomlkit -from tomlkit.exceptions import TOMLKitError from slpkg.toml_errors import TomlErrors @@ -124,7 +122,7 @@ class Configs: # pylint: disable=[R0902] proxy_username: str = config['PROXY_USERNAME'] proxy_password: str = config['PROXY_PASSWORD'] - except (KeyError, TOMLKitError) as e: + except (KeyError, tomlkit.exceptions.TOMLKitError) as e: toml_errors.raise_toml_error_message(e, toml_file=Path('/etc/slpkg/slpkg.toml')) blink: str = '' diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 4babdc5e..119b2acc 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -5,9 +5,7 @@ from pathlib import Path from typing import ClassVar from dataclasses import dataclass - import tomlkit -from tomlkit.exceptions import TOMLKitError from slpkg.configs import Configs from slpkg.utilities import Utilities @@ -228,7 +226,7 @@ class Repositories: # pylint: disable=[R0902] pprkut_repo: bool = repos_config['PPRKUT']['ENABLE'] pprkut_repo_mirror: str = repos_config['PPRKUT']['MIRROR'] - except (KeyError, TOMLKitError) as error: + except (KeyError, tomlkit.exceptions.TOMLKitError) as error: toml_errors.raise_toml_error_message(error, repositories_toml_file) # Dictionary configurations of repositories.