summaryrefslogtreecommitdiff
path: root/cmd2/py_bridge.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2021-03-15 15:18:29 -0400
committeranselor <anselor@gmail.com>2021-03-18 18:26:20 -0400
commit9d1b7c7f1068ce9b55ba160ebceeadd665d1bc02 (patch)
tree2add05f8f7f955f2ba6aafaa640afccafe8f514a /cmd2/py_bridge.py
parentf30627d5d2d0adc7db45aa26956372ea2cb3dc19 (diff)
downloadcmd2-git-9d1b7c7f1068ce9b55ba160ebceeadd665d1bc02.tar.gz
Some mypy validation fixes
Diffstat (limited to 'cmd2/py_bridge.py')
-rw-r--r--cmd2/py_bridge.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd2/py_bridge.py b/cmd2/py_bridge.py
index fd9b55fb..890363b0 100644
--- a/cmd2/py_bridge.py
+++ b/cmd2/py_bridge.py
@@ -10,16 +10,17 @@ from contextlib import (
redirect_stdout,
)
from typing import (
+ Any,
+ NamedTuple,
Optional,
)
-from .utils import (
+from .utils import ( # namedtuple_with_defaults,
StdSim,
- namedtuple_with_defaults,
)
-class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr', 'stop', 'data'])):
+class CommandResult(NamedTuple):
"""Encapsulates the results from a cmd2 app command
:stdout: str - output captured from stdout while this command is executing
@@ -56,6 +57,11 @@ class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr
not for modification.
"""
+ stdout: str = ''
+ stderr: str = ''
+ stop: bool = False
+ data: Any = None
+
def __bool__(self) -> bool:
"""Returns True if the command succeeded, otherwise False"""