summaryrefslogtreecommitdiff
path: root/cmd2/argparse_custom.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2021-02-22 15:58:48 -0500
committerGitHub <noreply@github.com>2021-02-22 15:58:48 -0500
commit97f14b266e038a5d4acf7841d538cf37f066d328 (patch)
treef5734a89a0f8739546158f3215656e333dcf31c6 /cmd2/argparse_custom.py
parent9c60ac6f3169f9df37e6c5166844fb9cf5f6766d (diff)
parentfa0b55c51a4810dc1f89e616a4adb92fa9e31c6c (diff)
downloadcmd2-git-97f14b266e038a5d4acf7841d538cf37f066d328.tar.gz
Merge pull request #1060 from python-cmd2/mypy
Start making small changes to fix mypy warnings
Diffstat (limited to 'cmd2/argparse_custom.py')
-rw-r--r--cmd2/argparse_custom.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py
index d3f819b2..2c71dec3 100644
--- a/cmd2/argparse_custom.py
+++ b/cmd2/argparse_custom.py
@@ -203,6 +203,7 @@ from argparse import (
from typing import (
Any,
Callable,
+ NoReturn,
Optional,
Tuple,
Type,
@@ -264,7 +265,7 @@ class CompletionItem(str):
return super().__new__(cls, value)
# noinspection PyUnusedLocal
- def __init__(self, value: object, desc: str = '', *args, **kwargs) -> None:
+ def __init__(self, value: object, desc: str = '', *args) -> None:
"""
CompletionItem Initializer
@@ -273,7 +274,7 @@ class CompletionItem(str):
:param args: args for str __init__
:param kwargs: kwargs for str __init__
"""
- super().__init__(*args, **kwargs)
+ super().__init__(*args)
self.description = desc
@@ -340,7 +341,7 @@ orig_actions_container_add_argument = argparse._ActionsContainer.add_argument
def _add_argument_wrapper(
self,
*args,
- nargs: Union[int, str, Tuple[int], Tuple[int, int], None] = None,
+ nargs: Union[int, str, Tuple[int], Tuple[int, int], Tuple[int, float], None] = None,
choices_provider: Optional[Callable] = None,
completer: Optional[Callable] = None,
suppress_tab_hint: bool = False,
@@ -812,7 +813,7 @@ class Cmd2ArgumentParser(argparse.ArgumentParser):
return super().add_subparsers(**kwargs)
- def error(self, message: str) -> None:
+ def error(self, message: str) -> NoReturn:
"""Custom override that applies custom formatting to the error message"""
lines = message.split('\n')
linum = 0