Fixed blacklist type

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-06-05 17:38:20 +03:00
parent b8a9413cb5
commit 5dd3895a9a
2 changed files with 4 additions and 4 deletions

View file

@ -22,14 +22,14 @@ class Blacklist(Configs): # pylint: disable=[R0903]
self.toml_errors = TomlErrors() self.toml_errors = TomlErrors()
self.blacklist_file_toml: Path = Path(self.etc_path, 'blacklist.toml') self.blacklist_file_toml: Path = Path(self.etc_path, 'blacklist.toml')
def packages(self) -> tuple: def packages(self) -> list:
"""Read the blacklist file.""" """Read the blacklist file."""
packages: tuple = tuple() packages: list = []
if self.blacklist_file_toml.is_file(): if self.blacklist_file_toml.is_file():
try: try:
with open(self.blacklist_file_toml, 'rb') as black_file: with open(self.blacklist_file_toml, 'rb') as black_file:
black: dict = {k.lower(): v for k, v in tomli.load(black_file).items()} black: dict = {k.lower(): v for k, v in tomli.load(black_file).items()}
packages: tuple = black['packages'] packages: list = black['packages']
except (tomli.TOMLDecodeError, KeyError) as error: except (tomli.TOMLDecodeError, KeyError) 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

@ -8,7 +8,7 @@ class TestBlacklist(unittest.TestCase):
def test_blacklist(self) -> None: def test_blacklist(self) -> None:
"""Test blacklist packages.""" """Test blacklist packages."""
black = Blacklist() black = Blacklist()
self.assertTupleEqual((), black.packages()) self.assertListEqual([], black.packages())
if __name__ == '__main__': if __name__ == '__main__':