Skip to content
Myr

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

4 files+10 added−8 removed

modified:src/click/core.py+5 added-5 removed
48 unmodified lines
49F = t.TypeVar("F", bound=t.Callable[..., t.Any])50V = t.TypeVar("V")515253def _fast_exit(code: int) -> t.NoReturn:53def _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.5657 :param code: Exit code.
620 unmodified lines
678 return value679680 return None681682 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.685686 :param message: the error message to fail with.687 """688 raise UsageError(message, self)689690 def abort(self) -> t.NoReturn:690 def abort(self) -> "te.NoReturn":691 """Aborts the script."""692 raise Abort()693694 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)697698 def get_usage(self) -> str:
277 unmodified lines
976 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 ...982983 @typing.overload984 def main(
1948 unmodified lines
modified:src/click/parser.py+2 added-1 removed
30 unmodified lines
31from .exceptions import NoSuchOption32from .exceptions import UsageError3334if 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 CoreParameter
22 unmodified lines
62 nargs_spec = deque(nargs_spec)63 rv: t.List[t.Union[str, t.Tuple[t.Optional[str], ...], None]] = []64 spos: t.Optional[int] = None6565 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 lines
modified:src/click/types.py+1 added-1 removed
121 unmodified lines
122 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)129130 def shell_complete(
925 unmodified lines
modified:CHANGES.rst+2 added-1 removed
6 unmodified lines
78- 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`131415Version 8.0.016-------------
854 unmodified lines