Closed
Description
Bug Report
Getting error RuntimeError: ('Not implemented', <class 'mypy.types.TypeGuardedType'>)
(A clear and concise description of what the bug is.)
To Reproduce
Interestingly i cant reproduce with the below one.
from typing import Any, TextIO, TypeAlias, TypeVar, TYPE_CHECKING,
if TYPE_CHECKING:
from airflow.typing_compat import TypeGuard
V1EnvVar = TypeVar("V1EnvVar")
Redactable: TypeAlias = str | V1EnvVar | dict[Any, Any] | tuple[Any, ...] | list[Any]
@cache
def _get_v1_env_var_type() -> type:
try:
from kubernetes.client import V1EnvVar
except ImportError:
return type("V1EnvVar", (), {})
return V1EnvVar
def _is_v1_env_var(v: Any) -> TypeGuard[V1EnvVar]:
return isinstance(v, _get_v1_env_var_type())
But when i execute the https://github.com/apache/airflow/blob/main/task-sdk/src/airflow/sdk/execution_time/secrets_masker.py am getting the runtime error.
Traceback (most recent call last):
File "/usr/local/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "mypy/build.py", line 2062, in wrap_context
File "mypy/build.py", line 2391, in finish_passes
File "mypy/build.py", line 2424, in _patch_indirect_dependencies
File "mypy/indirection.py", line 35, in find_modules
File "mypy/indirection.py", line 46, in _visit
File "mypy/types.py", line 276, in accept
RuntimeError: ('Not implemented', <class 'mypy.types.TypeGuardedType'>)
task-sdk/src/airflow/sdk/execution_time/secrets_masker.py: : note: use --pdb to drop into pdb
Expected Behavior
Actual Behavior
Your Environment
- Mypy version used: 1.16.1
- Mypy command-line flags: mypy task-sdk/src/airflow/sdk/execution_time/secrets_masker.py
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.10