diff --git a/pyproject.toml b/pyproject.toml index 9b173bbe2b..d3c6d940ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ test = [ "coverage >=6.2,<7.0", "pytest-xdist >=1.32.0,<4.0.0", "pytest-sugar >=0.9.4,<0.10.0", - "mypy ==0.910", + "mypy ==0.971", "black >=22.3.0,<23.0.0", "isort >=5.0.6,<6.0.0", "rich >=10.11.0,<14.0.0", diff --git a/typer/_typing.py b/typer/_typing.py index d906e2227d..bfa8114fcb 100644 --- a/typer/_typing.py +++ b/typer/_typing.py @@ -4,14 +4,13 @@ import sys from os import PathLike -from typing import ( # type: ignore +from typing import ( TYPE_CHECKING, AbstractSet, Any, ClassVar, Dict, Generator, - Iterable, List, Mapping, NewType, diff --git a/typer/completion.py b/typer/completion.py index 2712d08da4..c42ad95b81 100644 --- a/typer/completion.py +++ b/typer/completion.py @@ -1,6 +1,6 @@ import os import sys -from typing import Any, Dict, Tuple +from typing import Any, MutableMapping, Tuple import click @@ -120,7 +120,7 @@ def completion_init() -> None: # This is only called in new Command method, only used by Click 8.x+ def shell_complete( cli: click.BaseCommand, - ctx_args: Dict[str, Any], + ctx_args: MutableMapping[str, Any], prog_name: str, complete_var: str, instruction: str, diff --git a/typer/core.py b/typer/core.py index c0776368a6..0c73784c23 100644 --- a/typer/core.py +++ b/typer/core.py @@ -9,6 +9,7 @@ Callable, Dict, List, + MutableMapping, Optional, Sequence, TextIO, @@ -634,7 +635,7 @@ def _typer_format_options( def _typer_main_shell_completion( self: click.core.Command, *, - ctx_args: Dict[str, Any], + ctx_args: MutableMapping[str, Any], prog_name: str, complete_var: Optional[str] = None, ) -> None: @@ -696,7 +697,7 @@ def format_options( def _main_shell_completion( self, - ctx_args: Dict[str, Any], + ctx_args: MutableMapping[str, Any], prog_name: str, complete_var: Optional[str] = None, ) -> None: @@ -758,7 +759,7 @@ def format_options( def _main_shell_completion( self, - ctx_args: Dict[str, Any], + ctx_args: MutableMapping[str, Any], prog_name: str, complete_var: Optional[str] = None, ) -> None: diff --git a/typer/main.py b/typer/main.py index aa39e82849..9de5f5960d 100644 --- a/typer/main.py +++ b/typer/main.py @@ -51,7 +51,7 @@ def except_hook( - exc_type: Type[BaseException], exc_value: BaseException, tb: TracebackType + exc_type: Type[BaseException], exc_value: BaseException, tb: Optional[TracebackType] ) -> None: exception_config: Union[DeveloperExceptionConfig, None] = getattr( exc_value, _typer_developer_exception_attr_name, None