[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 50/72] scripts/qmp-shell: move get_prompt() to prompt property
From: |
John Snow |
Subject: |
[PATCH v2 50/72] scripts/qmp-shell: move get_prompt() to prompt property |
Date: |
Tue, 3 Nov 2020 19:35:40 -0500 |
Small tidying; treat "prompt" like an immutable property instead of
function/method/routine.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qmp-shell | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index cfcefb95f9da..3b86ef7d8844 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -292,10 +292,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
version = self._greeting['QMP']['version']['qemu']
print("Connected to QEMU {major}.{minor}.{micro}\n".format(**version))
- def get_prompt(self):
+ @property
+ def prompt(self):
if self._transmode:
- return "TRANS> "
- return "(QEMU) "
+ return 'TRANS> '
+ return '(QEMU) '
def read_exec_command(self, prompt):
"""
@@ -435,7 +436,7 @@ def main():
die(f"Couldn't connect to {args.qmp_server}: {err!s}")
qemu.show_banner()
- while qemu.read_exec_command(qemu.get_prompt()):
+ while qemu.read_exec_command(qemu.prompt):
pass
qemu.close()
--
2.26.2
- [PATCH v2 37/72] scripts/qmp-shell: use triple-double-quote docstring style, (continued)
- [PATCH v2 37/72] scripts/qmp-shell: use triple-double-quote docstring style, John Snow, 2020/11/03
- [PATCH v2 43/72] scripts/qmp-shell: remove if-raise-else patterns, John Snow, 2020/11/03
- [PATCH v2 41/72] scripts/qmp-shell: fix shell history exception handling, John Snow, 2020/11/03
- [PATCH v2 44/72] scripts/qmp-shell: use isinstance() instead of type(), John Snow, 2020/11/03
- [PATCH v2 45/72] scripts/qmp-shell: use argparse, John Snow, 2020/11/03
- [PATCH v2 46/72] python/qmp: Fix type of SocketAddrT, John Snow, 2020/11/03
- [PATCH v2 38/72] scripts/qmp-shell: ignore visit_Name name, John Snow, 2020/11/03
- [PATCH v2 47/72] python/qmp: add parse_address classmethod, John Snow, 2020/11/03
- [PATCH v2 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell, John Snow, 2020/11/03
- [PATCH v2 49/72] scripts/qmp-shell: Make verbose a public attribute, John Snow, 2020/11/03
- [PATCH v2 50/72] scripts/qmp-shell: move get_prompt() to prompt property,
John Snow <=
- [PATCH v2 51/72] scripts/qmp-shell: remove prompt argument from read_exec_command, John Snow, 2020/11/03
- [PATCH v2 52/72] scripts/qmp-shell: move the REPL functionality into QMPShell, John Snow, 2020/11/03
- [PATCH v2 53/72] scripts/qmp-shell: Fix "FuzzyJSON" parser, John Snow, 2020/11/03
- [PATCH v2 54/72] scripts/qmp-shell: refactor QMPCompleter, John Snow, 2020/11/03
- [PATCH v2 56/72] python/qmp: add QMPObject type alias, John Snow, 2020/11/03
- [PATCH v2 59/72] scripts/qmp-shell: unprivatize 'pretty' property, John Snow, 2020/11/03
- [PATCH v2 58/72] scripts/qmp-shell: Accept SocketAddrT instead of string, John Snow, 2020/11/03
- [PATCH v2 55/72] scripts/qmp-shell: initialize completer early, John Snow, 2020/11/03
- [PATCH v2 61/72] scripts/qmp-shell: Use context manager instead of atexit, John Snow, 2020/11/03
- [PATCH v2 62/72] scripts/qmp-shell: use logging to show warnings, John Snow, 2020/11/03