From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Michael Roth" <michael.roth@amd.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH v2 3/4] qapi: rename 'special_features' to 'features'
Date: Wed, 13 Nov 2024 14:20:40 +0100 [thread overview]
Message-ID: <87ed3fgthz.fsf@pond.sub.org> (raw)
In-Reply-To: <20241018101724.1221152-4-berrange@redhat.com> ("Daniel P. Berrangé"'s message of "Fri, 18 Oct 2024 11:17:23 +0100")
Daniel P. Berrangé <berrange@redhat.com> writes:
> This updates the QAPI code generation to refer to 'features' instead
> of 'special_features', in preparation for generalizing their exposure.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> scripts/qapi/commands.py | 4 ++--
> scripts/qapi/gen.py | 6 +++---
> scripts/qapi/types.py | 10 +++++-----
> scripts/qapi/visit.py | 14 +++++++-------
> 4 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
> index 79951a841f..d629d2d97e 100644
> --- a/scripts/qapi/commands.py
> +++ b/scripts/qapi/commands.py
> @@ -25,7 +25,7 @@
> QAPIGenC,
> QAPISchemaModularCVisitor,
> build_params,
> - gen_special_features,
> + gen_features,
> ifcontext,
> )
> from .schema import (
> @@ -298,7 +298,7 @@ def gen_register_command(name: str,
> ''',
> name=name, c_name=c_name(name),
> opts=' | '.join(options) or 0,
> - feats=gen_special_features(features))
> + feats=gen_features(features))
> return ret
>
>
> diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
> index c53ca72950..aba1a982f6 100644
> --- a/scripts/qapi/gen.py
> +++ b/scripts/qapi/gen.py
> @@ -41,10 +41,10 @@
> from .source import QAPISourceInfo
>
>
> -def gen_special_features(features: Sequence[QAPISchemaFeature]) -> str:
> - special_features = [f"1u << {c_enum_const('qapi', feat.name)}"
> +def gen_features(features: Sequence[QAPISchemaFeature]) -> str:
> + features = [f"1u << {c_enum_const('qapi', feat.name)}"
> for feat in features if feat.is_special()]
pycodestyle gripes
scripts/qapi/gen.py:46:25: E127 continuation line over-indented for visual indent
More seriously, mypy gripes
scripts/qapi/gen.py:45: error: List comprehension has incompatible type List[str]; expected List[QAPISchemaFeature] [misc]
here, and ...
> - return ' | '.join(special_features) or '0'
> + return ' | '.join(features) or '0'
scripts/qapi/gen.py:47: error: Argument 1 to "join" of "str" has incompatible type "List[QAPISchemaFeature]"; expected "Iterable[str]" [arg-type]
This is due to your assignment to parameter @feature. Use a new
variable instead.
>
>
> class QAPIGen:
[...]
next prev parent reply other threads:[~2024-11-13 13:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 10:17 [PATCH v2 0/4] qapi: generalize special features Daniel P. Berrangé
2024-10-18 10:17 ` [PATCH v2 1/4] qapi: cope with feature names containing a '-' Daniel P. Berrangé
2024-10-18 10:17 ` [PATCH v2 2/4] qapi: change 'unsigned special_features' to 'uint64_t features' Daniel P. Berrangé
2024-10-21 5:50 ` Philippe Mathieu-Daudé
2024-10-18 10:17 ` [PATCH v2 3/4] qapi: rename 'special_features' to 'features' Daniel P. Berrangé
2024-10-21 5:50 ` Philippe Mathieu-Daudé
2024-11-13 13:20 ` Markus Armbruster [this message]
2024-10-18 10:17 ` [PATCH v2 4/4] qapi: expose all schema features to code Daniel P. Berrangé
2024-11-14 12:48 ` Markus Armbruster
2024-11-14 13:25 ` Daniel P. Berrangé
2024-11-15 7:47 ` Markus Armbruster
2024-11-15 18:30 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ed3fgthz.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).