mask mypy warning

The newest mypy produces the following warning:

src/ahriman/application/handlers/search.py:43: error: Non-overlapping identity check (left operand type: "Union[_DefaultFactory[Any], Literal[_MISSING_TYPE.MISSING]]", right operand type: "Type[List[Any]]")  [comparison-overlap]

which is more likely caused by updated dataclass models to protoocol (however decorators are still calllable). This commit masks problematic line from checking
This commit is contained in:
Evgenii Alekseev 2023-02-09 22:46:08 +02:00
parent 125da217d3
commit 82322f7a6c
2 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class Search(Handler):
""" """
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture" ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
SORT_FIELDS = {field.name for field in fields(AURPackage) if field.default_factory is not list} SORT_FIELDS = {field.name for field in fields(AURPackage) if field.default_factory is not list} # type: ignore
@classmethod @classmethod
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *, def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,

View File

@ -131,9 +131,10 @@ def test_disallow_auto_architecture_run() -> None:
assert not Search.ALLOW_AUTO_ARCHITECTURE_RUN assert not Search.ALLOW_AUTO_ARCHITECTURE_RUN
def test_sort_fields() -> None: def test_sort_fields(aur_package_ahriman: AURPackage) -> None:
""" """
must store valid field list which are allowed to be used for sorting must store valid field list which are allowed to be used for sorting
""" """
expected = {field.name for field in dataclasses.fields(AURPackage)} expected = {field.name for field in dataclasses.fields(AURPackage)}
assert all(field in expected for field in Search.SORT_FIELDS) assert all(field in expected for field in Search.SORT_FIELDS)
assert all(not isinstance(getattr(aur_package_ahriman, field), list) for field in Search.SORT_FIELDS)