diff --git a/src/pip/_internal/metadata/importlib/_compat.py b/src/pip/_internal/metadata/importlib/_compat.py index e03005e07fc..2bc6bfd27ef 100644 --- a/src/pip/_internal/metadata/importlib/_compat.py +++ b/src/pip/_internal/metadata/importlib/_compat.py @@ -1,5 +1,5 @@ import importlib.metadata -from typing import Optional, Protocol +from typing import Any, Optional, Protocol, cast class BasePath(Protocol): @@ -38,4 +38,4 @@ def get_dist_name(dist: importlib.metadata.Distribution) -> str: The ``name`` attribute is only available in Python 3.10 or later. We are targeting exactly that, but Mypy does not know this. """ - return dist.name # type: ignore[attr-defined] + return cast(Any, dist).name