Daniel P. Berrangé <berra...@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é <berra...@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:

[...]


Reply via email to