[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/42] scripts/qmp-shell: make QMPCompleter returns explicit
From: |
John Snow |
Subject: |
[PATCH 12/42] scripts/qmp-shell: make QMPCompleter returns explicit |
Date: |
Mon, 7 Jun 2021 16:06:19 -0400 |
This function returns None when it doesn't find a match; do that
explicitly.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qmp-shell | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index ea6a87e0b3..8d84467b53 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -83,10 +83,10 @@ class QMPCompleter(list):
def complete(self, text, state):
for cmd in self:
if cmd.startswith(text):
- if not state:
+ if state == 0:
return cmd
- else:
- state -= 1
+ state -= 1
+ return None
class QMPShellError(Exception):
--
2.31.1
- [PATCH 00/42] python: move qmp-shell into qemu.qmp package, John Snow, 2021/06/07
- [PATCH 02/42] scripts/qmp-shell: Apply flake8 rules, John Snow, 2021/06/07
- [PATCH 12/42] scripts/qmp-shell: make QMPCompleter returns explicit,
John Snow <=
- [PATCH 05/42] scripts/qmp-shell: fix connect method signature, John Snow, 2021/06/07
- [PATCH 01/42] scripts/qmp-shell: apply isort rules, John Snow, 2021/06/07
- [PATCH 04/42] scripts/qmp-shell: fix exception handling, John Snow, 2021/06/07
- [PATCH 06/42] scripts/qmp-shell: remove shadowed variable from _print(), John Snow, 2021/06/07
- [PATCH 07/42] scripts/qmp-shell: use @classmethod where appropriate, John Snow, 2021/06/07
- [PATCH 03/42] scripts/qmp-shell: fix show_banner signature, John Snow, 2021/06/07
- [PATCH 21/42] scripts/qmp-shell: remove prompt argument from read_exec_command, John Snow, 2021/06/07
- [PATCH 08/42] scripts/qmp-shell: Use python3-style super(), John Snow, 2021/06/07
- [PATCH 11/42] scripts/qmp-shell: ignore visit_Name name, John Snow, 2021/06/07
- [PATCH 09/42] scripts/qmp-shell: declare verbose in __init__, John Snow, 2021/06/07