|
35 | 35 | from .exceptions import CompletionError |
36 | 36 | from .rich_utils import Cmd2SimpleTable |
37 | 37 | from .types import ( |
38 | | - ChoicesProviderUnbound, |
39 | | - CmdOrSet, |
40 | | - CompleterUnbound, |
| 38 | + CmdOrSetT, |
| 39 | + UnboundChoicesProvider, |
| 40 | + UnboundCompleter, |
41 | 41 | ) |
42 | 42 |
|
43 | 43 | if TYPE_CHECKING: # pragma: no cover |
@@ -214,7 +214,7 @@ def complete( |
214 | 214 | endidx: int, |
215 | 215 | tokens: Sequence[str], |
216 | 216 | *, |
217 | | - cmd_set: CommandSet | None = None, |
| 217 | + cmd_set: CommandSet[Any] | None = None, |
218 | 218 | ) -> Completions: |
219 | 219 | """Complete text using argparse metadata. |
220 | 220 |
|
@@ -469,7 +469,7 @@ def _handle_last_token( |
469 | 469 | consumed_arg_values: dict[str, list[str]], |
470 | 470 | used_flags: set[str], |
471 | 471 | skip_remaining_flags: bool, |
472 | | - cmd_set: CommandSet | None, |
| 472 | + cmd_set: CommandSet[Any] | None, |
473 | 473 | ) -> Completions: |
474 | 474 | """Perform final completion step handling positionals and flags.""" |
475 | 475 | # Check if we are completing a flag name. This check ignores strings with a length of one, like '-'. |
@@ -734,11 +734,11 @@ def _choices_to_items(self, arg_state: _ArgumentState) -> list[CompletionItem]: |
734 | 734 |
|
735 | 735 | def _prepare_callable_params( |
736 | 736 | self, |
737 | | - to_call: ChoicesProviderUnbound[CmdOrSet] | CompleterUnbound[CmdOrSet], |
| 737 | + to_call: UnboundChoicesProvider[CmdOrSetT] | UnboundCompleter[CmdOrSetT], |
738 | 738 | arg_state: _ArgumentState, |
739 | 739 | text: str, |
740 | 740 | consumed_arg_values: dict[str, list[str]], |
741 | | - cmd_set: CommandSet | None, |
| 741 | + cmd_set: CommandSet[Any] | None, |
742 | 742 | ) -> tuple[list[Any], dict[str, Any]]: |
743 | 743 | """Resolve the instance and arguments required to call a choices/completer function.""" |
744 | 744 | args: list[Any] = [] |
@@ -769,7 +769,7 @@ def _complete_arg( |
769 | 769 | arg_state: _ArgumentState, |
770 | 770 | consumed_arg_values: dict[str, list[str]], |
771 | 771 | *, |
772 | | - cmd_set: CommandSet | None = None, |
| 772 | + cmd_set: CommandSet[Any] | None = None, |
773 | 773 | ) -> Completions: |
774 | 774 | """Completion routine for an argparse argument. |
775 | 775 |
|
|
0 commit comments