diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2018-08-15 20:20:34 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2018-08-15 20:20:34 +0100 |
| commit | c146b54c7fdbd926ee8fc4369699e3480d54f6fa (patch) | |
| tree | 99f97a391fc6fc79cb366adcf79434981955b16e /scripts/qapi/common.py | |
| parent | 1d746ee95d4d7deb1460006f8c01c430dcb50b9f (diff) | |
| parent | cb9ec42f33c07cd07d2e2971422bf7636c761202 (diff) | |
| download | focaccia-qemu-c146b54c7fdbd926ee8fc4369699e3480d54f6fa.tar.gz focaccia-qemu-c146b54c7fdbd926ee8fc4369699e3480d54f6fa.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-08-15' into staging
Miscellaneous patches for 2018-08-15 # gpg: Signature made Wed 15 Aug 2018 07:15:31 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-misc-2018-08-15: monitor: fix oob command leak tests: fix crumple/recursive leak qapi: Fix some pycodestyle-3 complaints tests: change /0.15/* tests to /qmp/* qmp-shell: learn to send commands with quoted arguments Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/qapi/common.py')
| -rw-r--r-- | scripts/qapi/common.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 9230a2a3e8..02c5c6767a 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -884,12 +884,12 @@ def check_keys(expr_elem, meta, required, optional=[]): if key not in required and key not in optional: raise QAPISemError(info, "Unknown key '%s' in %s '%s'" % (key, meta, name)) - if (key == 'gen' or key == 'success-response') and value is not False: + if key in ['gen', 'success-response'] and value is not False: raise QAPISemError(info, "'%s' of %s '%s' should only use false value" % (key, meta, name)) - if (key == 'boxed' or key == 'allow-oob' or - key == 'allow-preconfig') and value is not True: + if (key in ['boxed', 'allow-oob', 'allow-preconfig'] + and value is not True): raise QAPISemError(info, "'%s' of %s '%s' should only use true value" % (key, meta, name)) @@ -1845,12 +1845,12 @@ def camel_to_upper(value): return c_fun_str new_name = '' - l = len(c_fun_str) - for i in range(l): + length = len(c_fun_str) + for i in range(length): c = c_fun_str[i] # When c is upper and no '_' appears before, do more checks if c.isupper() and (i > 0) and c_fun_str[i - 1] != '_': - if i < l - 1 and c_fun_str[i + 1].islower(): + if i < length - 1 and c_fun_str[i + 1].islower(): new_name += '_' elif c_fun_str[i - 1].isdigit(): new_name += '_' @@ -1863,6 +1863,7 @@ def c_enum_const(type_name, const_name, prefix=None): type_name = prefix return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper() + if hasattr(str, 'maketrans'): c_name_trans = str.maketrans('.-', '__') else: @@ -1912,6 +1913,7 @@ def c_name(name, protect=True): return 'q_' + name return name + eatspace = '\033EATSPACE.' pointer_suffix = ' *' + eatspace @@ -1922,6 +1924,7 @@ def genindent(count): ret += ' ' return ret + indent_level = 0 |