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
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)

View file

@ -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 = ''

View file

@ -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.