ruff: replace asserts outside of tests with Exceptions

This commit is contained in:
Jörg Thalheim
2025-08-20 15:45:49 +02:00
parent 5be9b8383b
commit dc5485d9f1
23 changed files with 257 additions and 91 deletions

View File

@@ -3,6 +3,8 @@ import logging
from collections.abc import Sequence
from typing import Any
from clan_lib.errors import ClanError
log = logging.getLogger(__name__)
@@ -19,6 +21,8 @@ class AppendOptionAction(argparse.Action):
) -> None:
lst = getattr(namespace, self.dest)
lst.append("--option")
assert isinstance(values, list), "values must be a list"
if not values or not hasattr(values, "__getitem__"):
msg = "values must be indexable"
raise ClanError(msg)
lst.append(values[0])
lst.append(values[1])