fix typing that wasn't available in Python 3.6.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 5a74def · Browse files · 4 files·+10 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+10 added−8 removed
- other:+10 added−8 removed
Provenance
- Commit
5295f04- Tree
62dfa1b- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
5a74def
4 files changed+10 added−8 removed
modified:src/click/core.py+5 added-5 removed
48 unmodified lines49 F = t.TypeVar("F", bound=t.Callable[..., t.Any])50 V = t.TypeVar("V")51 52 53-def _fast_exit(code: int) -> t.NoReturn:53+def _fast_exit(code: int) -> "te.NoReturn":54 """Low-level exit that skips Python's cleanup but speeds up exit by55 about 10ms for things like shell completion.56 57 :param code: Exit code.620 unmodified lines678 return value679 680 return None681 682- def fail(self, message: str) -> t.NoReturn:682+ def fail(self, message: str) -> "te.NoReturn":683 """Aborts the execution of the program with a specific error684 message.685 686 :param message: the error message to fail with.687 """688 raise UsageError(message, self)689 690- def abort(self) -> t.NoReturn:690+ def abort(self) -> "te.NoReturn":691 """Aborts the script."""692 raise Abort()693 694- def exit(self, code: int = 0) -> t.NoReturn:694+ def exit(self, code: int = 0) -> "te.NoReturn":695 """Exits the application with a given exit code."""696 raise Exit(code)697 698 def get_usage(self) -> str:277 unmodified lines976 prog_name: t.Optional[str] = None,977 complete_var: t.Optional[str] = None,978 standalone_mode: "te.Literal[True]" = True,979 **extra: t.Any,980- ) -> t.NoReturn:980+ ) -> "te.NoReturn":981 ...982 983 @typing.overload984 def main(1948 unmodified linesmodified:src/click/parser.py+2 added-1 removed
30 unmodified lines31 from .exceptions import NoSuchOption32 from .exceptions import UsageError33 34 if t.TYPE_CHECKING:35+ import typing_extensions as te36 from .core import Argument as CoreArgument37 from .core import Context38 from .core import Option as CoreOption39 from .core import Parameter as CoreParameter22 unmodified lines62 nargs_spec = deque(nargs_spec)63 rv: t.List[t.Union[str, t.Tuple[t.Optional[str], ...], None]] = []64 spos: t.Optional[int] = None65 65- def _fetch(c: t.Deque[V]) -> t.Optional[V]:66+ def _fetch(c: "te.Deque[V]") -> t.Optional[V]:67 try:68 if spos is None:69 return c.popleft()70 else:457 unmodified linesmodified:src/click/types.py+1 added-1 removed
121 unmodified lines122 self,123 message: str,124 param: t.Optional["Parameter"] = None,125 ctx: t.Optional["Context"] = None,126- ) -> t.NoReturn:126+ ) -> "t.NoReturn":127 """Helper method to fail with an invalid value message."""128 raise BadParameter(message, ctx=ctx, param=param)129 130 def shell_complete(925 unmodified linesmodified:CHANGES.rst+2 added-1 removed
6 unmodified lines7 8 - Mark top-level names as exported so type checking understand imports9 in user projects. :issue:`1879`10 - Annotate ``Context.obj`` as ``Any`` so type checking allows all11- operations on the arbitrary object. :issue:`11+ operations on the arbitrary object. :issue:`1885`12+- Fix some types that weren't available in Python 3.6.0. :issue:`1882`13 14 15 Version 8.0.016 -------------854 unmodified lines