[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/38] qapi/common.py: add type hint annotations
From: |
Eduardo Habkost |
Subject: |
Re: [PATCH v2 13/38] qapi/common.py: add type hint annotations |
Date: |
Tue, 22 Sep 2020 18:44:28 -0400 |
On Tue, Sep 22, 2020 at 05:00:36PM -0400, John Snow wrote:
> Annotations do not change runtime behavior.
> This commit *only* adds annotations.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qapi/common.py | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
> index 682e74fe65..0ce4a107e6 100644
> --- a/scripts/qapi/common.py
> +++ b/scripts/qapi/common.py
> @@ -12,6 +12,7 @@
[...]
> @@ -176,7 +179,7 @@ def gen_if(ifcond):
> return ret
>
>
> -def gen_endif(ifcond):
> +def gen_endif(ifcond: Sequence[str]) -> str:
Does this need to require a Sequence? It looks like it could be
Iterable.
I don't think this should block the patch, though, so:
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> ret = ''
> for ifc in reversed(ifcond):
> ret += mcgen('''
> @@ -185,7 +188,9 @@ def gen_endif(ifcond):
> return ret
>
>
> -def build_params(arg_type, boxed, extra=None):
> +def build_params(arg_type,
> + boxed: bool,
> + extra: Optional[str] = None) -> str:
> ret = ''
> sep = ''
> if boxed:
> --
> 2.26.2
>
--
Eduardo
[PATCH v2 14/38] qapi/common.py: Convert comments into docstrings, and elaborate, John Snow, 2020/09/22
[PATCH v2 15/38] qapi/common.py: move build_params into gen.py, John Snow, 2020/09/22