diff options
author | Markus Armbruster <armbru@redhat.com> | 2019-09-14 17:35:02 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-09-24 14:07:23 +0200 |
commit | 6955397677859ada5a65f430edee8035fb4e4b7c (patch) | |
tree | 983dee49cb725edddf2dae2621146dda7440e697 /scripts | |
parent | dc234189f8d1b129785a5933c15a4b2fb89d7e1b (diff) |
qapi: Clean up around check_known_keys()
All callers pass a dict argument to @keys, except check_keys() passes
a dict's .keys(). Drop .keys() there, and rename parameter @keys to
@value.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190914153506.2151-16-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qapi/common.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 4d4e0be770..3c3154a039 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1011,18 +1011,18 @@ def check_struct(expr, info): check_name(info, "Feature of struct %s" % name, f['name']) -def check_known_keys(info, source, keys, required, optional): +def check_known_keys(info, source, value, required, optional): def pprint(elems): return ', '.join("'" + e + "'" for e in sorted(elems)) - missing = set(required) - set(keys) + missing = set(required) - set(value) if missing: raise QAPISemError(info, "Key%s %s %s missing from %s" % ('s' if len(missing) > 1 else '', pprint(missing), 'are' if len(missing) > 1 else 'is', source)) allowed = set(required + optional) - unknown = set(keys) - allowed + unknown = set(value) - allowed if unknown: raise QAPISemError(info, "Unknown key%s %s in %s\nValid keys are %s." % ('s' if len(unknown) > 1 else '', pprint(unknown), @@ -1035,7 +1035,7 @@ def check_keys(expr, info, meta, required, optional=[]): raise QAPISemError(info, "'%s' key must have a string value" % meta) required = required + [meta] source = "%s '%s'" % (meta, name) - check_known_keys(info, source, expr.keys(), required, optional) + check_known_keys(info, source, expr, required, optional) for (key, value) in expr.items(): if key in ['gen', 'success-response'] and value is not False: raise QAPISemError(info, |