summaryrefslogtreecommitdiff
path: root/cmd2/py_bridge.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2021-01-31 22:29:57 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2021-01-31 22:29:57 -0500
commitf456b802754c3d1095b488d670bebba21018d823 (patch)
treebf7011f585a8a35ab4cc7ff98aaeebed4de87f84 /cmd2/py_bridge.py
parent918200c02d392c17862fff81bbf58820ed15c725 (diff)
downloadcmd2-git-f456b802754c3d1095b488d670bebba21018d823.tar.gz
Add black for automatic code format
Diffstat (limited to 'cmd2/py_bridge.py')
-rw-r--r--cmd2/py_bridge.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/cmd2/py_bridge.py b/cmd2/py_bridge.py
index a9b8641d..6f2160c6 100644
--- a/cmd2/py_bridge.py
+++ b/cmd2/py_bridge.py
@@ -9,9 +9,7 @@ from contextlib import (
redirect_stderr,
redirect_stdout,
)
-from typing import (
- Optional,
-)
+from typing import Optional
from .utils import (
StdSim,
@@ -55,6 +53,7 @@ class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr
Named tuples are immutable. The contents are there for access,
not for modification.
"""
+
def __bool__(self) -> bool:
"""Returns True if the command succeeded, otherwise False"""
@@ -69,6 +68,7 @@ class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr
class PyBridge:
"""Provides a Python API wrapper for application commands."""
+
def __init__(self, cmd2_app):
self._cmd2_app = cmd2_app
self.cmd_echo = False
@@ -117,8 +117,10 @@ class PyBridge:
self.stop = stop or self.stop
# Save the output. If stderr is empty, set it to None.
- result = CommandResult(stdout=copy_cmd_stdout.getvalue(),
- stderr=copy_stderr.getvalue() if copy_stderr.getvalue() else None,
- stop=stop,
- data=self._cmd2_app.last_result)
+ result = CommandResult(
+ stdout=copy_cmd_stdout.getvalue(),
+ stderr=copy_stderr.getvalue() if copy_stderr.getvalue() else None,
+ stop=stop,
+ data=self._cmd2_app.last_result,
+ )
return result