From 9d1b7c7f1068ce9b55ba160ebceeadd665d1bc02 Mon Sep 17 00:00:00 2001 From: Eric Lin Date: Mon, 15 Mar 2021 15:18:29 -0400 Subject: Some mypy validation fixes --- cmd2/py_bridge.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cmd2/py_bridge.py') 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""" -- cgit v1.2.1