diff options
author | Martijn Pieters <mj@zopatista.com> | 2022-11-08 19:44:29 +0000 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2023-01-19 16:33:27 -0800 |
commit | a1093bbe0dae00eea8342247a0c2739b07a6acd8 (patch) | |
tree | 25c1680557687164f30ff08c5fa0e1e1693fac66 /src/click/types.py | |
parent | a6c7ee060b02eaa62fd15264a669220914cfad4c (diff) | |
download | click-a1093bbe0dae00eea8342247a0c2739b07a6acd8.tar.gz |
Types: don't leave generic types without a parameter
Enable `disallow_any_generics` and provide type information for missing parameters for type hints.
Diffstat (limited to 'src/click/types.py')
-rw-r--r-- | src/click/types.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/click/types.py b/src/click/types.py index d948c70..1b04e37 100644 --- a/src/click/types.py +++ b/src/click/types.py @@ -397,7 +397,7 @@ class DateTime(ParamType): class _NumberParamTypeBase(ParamType): - _number_class: t.ClassVar[t.Type] + _number_class: t.ClassVar[t.Type[t.Any]] def convert( self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] @@ -702,8 +702,8 @@ class File(ParamType): lazy = self.resolve_lazy_flag(value) if lazy: - f: t.IO = t.cast( - t.IO, + f: t.IO[t.Any] = t.cast( + t.IO[t.Any], LazyFile( value, self.mode, self.encoding, self.errors, atomic=self.atomic ), @@ -794,7 +794,7 @@ class Path(ParamType): readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, - path_type: t.Optional[t.Type] = None, + path_type: t.Optional[t.Type[t.Any]] = None, executable: bool = False, ): self.exists = exists @@ -944,7 +944,7 @@ class Tuple(CompositeParamType): :param types: a list of types that should be used for the tuple items. """ - def __init__(self, types: t.Sequence[t.Union[t.Type, ParamType]]) -> None: + def __init__(self, types: t.Sequence[t.Union[t.Type[t.Any], ParamType]]) -> None: self.types = [convert_type(ty) for ty in types] def to_info_dict(self) -> t.Dict[str, t.Any]: |