Skip to content

RuntimeError: Not implemented mypy.types.TypeGuardedType #19412

Description

@gopidesupavan

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.

fromtypingimportAny, TextIO, TypeAlias, TypeVar, TYPE_CHECKING,
ifTYPE_CHECKING:
fromairflow.typing_compatimportTypeGuardV1EnvVar=TypeVar("V1EnvVar")
Redactable: TypeAlias=str|V1EnvVar|dict[Any, Any] |tuple[Any, ...] |list[Any]
@cachedef_get_v1_env_var_type() ->type:
try:
fromkubernetes.clientimportV1EnvVarexceptImportError:
returntype("V1EnvVar", (), {})
returnV1EnvVardef_is_v1_env_var(v: Any) ->TypeGuard[V1EnvVar]:
returnisinstance(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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions