summary refs log tree commit diff stats
path: root/scripts/qapi/commands.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-02-15 21:17:51 -0500
committerMarkus Armbruster <armbru@redhat.com>2021-02-18 17:10:29 +0100
commit2184bca7b17559107032ba4fd8fc6f65345276ed (patch)
tree8ce7e157281f96233f1fa60adc95a50207ee8286 /scripts/qapi/commands.py
parent91416a4254015e1e3f602f2b241b9ddb7879c10b (diff)
downloadfocaccia-qemu-2184bca7b17559107032ba4fd8fc6f65345276ed.tar.gz
focaccia-qemu-2184bca7b17559107032ba4fd8fc6f65345276ed.zip
qapi: Replace List[str] with Sequence[str] for ifcond
It does happen to be a list (as of now), but we can describe it in more
general terms with no loss in accuracy to allow tuples and other
constructs.

In the future, we can write "ifcond: Sequence[str] = ()" as a default
parameter, which we could not do safely with a Mutable type like a List.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-2-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/commands.py')
-rw-r--r--scripts/qapi/commands.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 54af519f44..0a75a9371b 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -17,6 +17,7 @@ from typing import (
     Dict,
     List,
     Optional,
+    Sequence,
     Set,
 )
 
@@ -297,7 +298,7 @@ void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds)
     def visit_command(self,
                       name: str,
                       info: Optional[QAPISourceInfo],
-                      ifcond: List[str],
+                      ifcond: Sequence[str],
                       features: List[QAPISchemaFeature],
                       arg_type: Optional[QAPISchemaObjectType],
                       ret_type: Optional[QAPISchemaType],