Skip to content

Commit

Permalink
qapi/expr.py: Modify check_keys to accept any Collection
Browse files Browse the repository at this point in the history
This is a minor adjustment that lets parameters @required and
@optional take tuple arguments, in particular ().  Later patches will
make use of that.

(Iterable would also have worked, but Iterable also includes things like
generator expressions which are consumed upon iteration, which would
require a rewrite to make sure that each input was only traversed
once. Collection implies the "can re-iterate" property.)

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210421182032.3521476-10-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
  • Loading branch information
jnsnow authored and Markus Armbruster committed Apr 30, 2021
1 parent 7a783ce commit 538cd41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/qapi/expr.py
Expand Up @@ -102,7 +102,7 @@ def pprint(elems):
"%s misses key%s %s"
% (source, 's' if len(missing) > 1 else '',
pprint(missing)))
allowed = set(required + optional)
allowed = set(required) | set(optional)
unknown = set(value) - allowed
if unknown:
raise QAPISemError(
Expand Down

0 comments on commit 538cd41

Please sign in to comment.