from qemu import qmp
-class QMPCompleter(list):
- def complete(self, text, state):
- for cmd in self:
+class QMPCompleter:
+ # NB: Python 3.9+ will probably allow us to subclass list[str] directly,
+ # but pylint as of today does not know that List[str] is simply 'list'.
+ def __init__(self) -> None:
+ self._matches: List[str] = []
+
+ def append(self, value: str) -> None:
+ return self._matches.append(value)
+
+ def complete(self, text: str, state: int) -> Optional[str]:
+ for cmd in self._matches:
if cmd.startswith(text):
if state == 0:
return cmd