Updated for tomlkit exceptions

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-06-07 12:18:21 +03:00
parent 889f47a541
commit 5d3ed3f08f
3 changed files with 3 additions and 8 deletions

View file

@ -4,7 +4,6 @@
from pathlib import Path from pathlib import Path
import tomlkit import tomlkit
from tomlkit.exceptions import TOMLKitError
from slpkg.configs import Configs from slpkg.configs import Configs
from slpkg.toml_errors import TomlErrors 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: with open(self.blacklist_file_toml, 'r', encoding='utf-8') as file:
black: dict = tomlkit.parse(file.read()) black: dict = tomlkit.parse(file.read())
packages: list = black['PACKAGES'] packages: list = black['PACKAGES']
except (KeyError, TOMLKitError) as error: except (KeyError, tomlkit.exceptions.TOMLKitError) as error:
print() print()
self.toml_errors.raise_toml_error_message(error, self.blacklist_file_toml) self.toml_errors.raise_toml_error_message(error, self.blacklist_file_toml)

View file

@ -6,9 +6,7 @@ import platform
from typing import Any from typing import Any
from pathlib import Path from pathlib import Path
from dataclasses import dataclass from dataclasses import dataclass
import tomlkit import tomlkit
from tomlkit.exceptions import TOMLKitError
from slpkg.toml_errors import TomlErrors from slpkg.toml_errors import TomlErrors
@ -124,7 +122,7 @@ class Configs: # pylint: disable=[R0902]
proxy_username: str = config['PROXY_USERNAME'] proxy_username: str = config['PROXY_USERNAME']
proxy_password: str = config['PROXY_PASSWORD'] 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')) toml_errors.raise_toml_error_message(e, toml_file=Path('/etc/slpkg/slpkg.toml'))
blink: str = '' blink: str = ''

View file

@ -5,9 +5,7 @@
from pathlib import Path from pathlib import Path
from typing import ClassVar from typing import ClassVar
from dataclasses import dataclass from dataclasses import dataclass
import tomlkit import tomlkit
from tomlkit.exceptions import TOMLKitError
from slpkg.configs import Configs from slpkg.configs import Configs
from slpkg.utilities import Utilities from slpkg.utilities import Utilities
@ -228,7 +226,7 @@ class Repositories: # pylint: disable=[R0902]
pprkut_repo: bool = repos_config['PPRKUT']['ENABLE'] pprkut_repo: bool = repos_config['PPRKUT']['ENABLE']
pprkut_repo_mirror: str = repos_config['PPRKUT']['MIRROR'] 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) toml_errors.raise_toml_error_message(error, repositories_toml_file)
# Dictionary configurations of repositories. # Dictionary configurations of repositories.