Skip to content

Commit

Permalink
dependencies/detect: use casting instead of type ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Dec 6, 2023
1 parent df635b5 commit 32325a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mesonbuild/dependencies/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .. import mlog

if T.TYPE_CHECKING:
from typing_extensions import TypedDict
from typing_extensions import Literal, TypedDict

from ..environment import Environment
from ..interpreter.kwargs import Dependency as DependencyKw
Expand Down Expand Up @@ -105,9 +105,11 @@ def get_dep_identifier(name: str, kwargs: DependencyKw) -> DependencyCacheKey:
continue
# Mypy doesn't (yet) understand iterating a TypedDict, and doesn't know that k is valid
if isinstance(v, list):
nkwargs[k] = tuple(v) # type: ignore[literal-required]
k = T.cast("Literal['cmake_args', 'cmake_module_path', 'components', 'modules', 'optional_modules']", k)
nkwargs[k] = tuple(v)
else:
nkwargs[k] = v # type: ignore[literal-required]
k = T.cast("Literal['name', 'cmake_package_version', 'language', 'main', 'method', 'private_headers', 'static', 'embed']", k)
nkwargs[k] = v

return DependencyCacheKey(name, **nkwargs)

Expand Down

0 comments on commit 32325a6

Please sign in to comment.