[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell
From: |
John Snow |
Subject: |
[PULL 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell |
Date: |
Fri, 18 Jun 2021 19:04:31 -0400 |
It's less useful, but it makes the initialization methods LSP
consistent, which quiets a mypy complaint.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-19-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qmp-shell | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 5317dcd516..de5fa189f0 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -322,8 +322,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
class HMPShell(QMPShell):
- def __init__(self, address):
- super().__init__(address)
+ def __init__(self, address, pretty=False):
+ super().__init__(address, pretty)
self.__cpu_index = 0
def __cmd_completion(self):
@@ -421,12 +421,9 @@ def main():
if args.qmp_server is None:
parser.error("QMP socket or TCP address must be specified")
- qemu: QMPShell
+ shell_class = HMPShell if args.hmp else QMPShell
try:
- if args.hmp:
- qemu = HMPShell(args.qmp_server)
- else:
- qemu = QMPShell(args.qmp_server, args.pretty)
+ qemu = shell_class(args.qmp_server, args.pretty)
except qmp.QMPBadPortError:
parser.error(f"Bad port number: {args.qmp_server}")
return # pycharm doesn't know error() is noreturn
--
2.31.1
- [PULL 27/72] scripts/qemu-ga-client: add mypy type hints, (continued)
- [PULL 27/72] scripts/qemu-ga-client: add mypy type hints, John Snow, 2021/06/18
- [PULL 26/72] python/qmp: Correct type of QMPReturnValue, John Snow, 2021/06/18
- [PULL 28/72] scripts/qemu-ga-client: move to python/qemu/qmp/qemu_ga_client.py, John Snow, 2021/06/18
- [PULL 36/72] scripts/qmp-shell: remove shadowed variable from _print(), John Snow, 2021/06/18
- [PULL 19/72] python/qmp: add fuse command to 'qom' tools, John Snow, 2021/06/18
- [PULL 37/72] scripts/qmp-shell: use @classmethod where appropriate, John Snow, 2021/06/18
- [PULL 10/72] scripts/qom-fuse: Apply pylint rules, John Snow, 2021/06/18
- [PULL 21/72] scripts/qemu-ga-client: apply (most) flake8 rules, John Snow, 2021/06/18
- [PULL 29/72] python/qemu-ga-client: add entry point, John Snow, 2021/06/18
- [PULL 33/72] scripts/qmp-shell: fix show_banner signature, John Snow, 2021/06/18
- [PULL 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell,
John Snow <=
- [PULL 44/72] scripts/qmp-shell: fix shell history exception handling, John Snow, 2021/06/18
- [PULL 46/72] scripts/qmp-shell: use isinstance() instead of type(), John Snow, 2021/06/18
- [PULL 43/72] scripts/qmp-shell: rename one and two-letter variables, John Snow, 2021/06/18
- [PULL 49/72] scripts/qmp-shell: Make verbose a public attribute, John Snow, 2021/06/18
- [PULL 31/72] scripts/qmp-shell: apply isort rules, John Snow, 2021/06/18
- [PULL 39/72] scripts/qmp-shell: declare verbose in __init__, John Snow, 2021/06/18
- [PULL 40/72] scripts/qmp-shell: use triple-double-quote docstring style, John Snow, 2021/06/18
- [PULL 41/72] scripts/qmp-shell: ignore visit_Name name, John Snow, 2021/06/18
- [PULL 42/72] scripts/qmp-shell: make QMPCompleter returns explicit, John Snow, 2021/06/18
- [PULL 50/72] scripts/qmp-shell: move get_prompt() to prompt property, John Snow, 2021/06/18