John Snow <js...@redhat.com> writes: > Annotations do not change runtime behavior. > This commit *only* adds annotations. > > Signed-off-by: John Snow <js...@redhat.com> > Reviewed-by: Eduardo Habkost <ehabk...@redhat.com> > Reviewed-by: Cleber Rosa <cr...@redhat.com> > Tested-by: Cleber Rosa <cr...@redhat.com> > --- > scripts/qapi/mypy.ini | 5 --- > scripts/qapi/visit.py | 73 +++++++++++++++++++++++++++++++++---------- > 2 files changed, 56 insertions(+), 22 deletions(-) > > diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini > index 83f19813553..74fc6c82153 100644 > --- a/scripts/qapi/mypy.ini > +++ b/scripts/qapi/mypy.ini > @@ -28,8 +28,3 @@ check_untyped_defs = False > disallow_untyped_defs = False > disallow_incomplete_defs = False > check_untyped_defs = False > - > -[mypy-qapi.visit] > -disallow_untyped_defs = False > -disallow_incomplete_defs = False > -check_untyped_defs = False > diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py > index e54694e23db..14d4f0b261f 100644 > --- a/scripts/qapi/visit.py > +++ b/scripts/qapi/visit.py > @@ -13,6 +13,8 @@ > See the COPYING file in the top-level directory. > """ > > +from typing import List, Optional > + > from .common import ( > c_enum_const, > c_name, > @@ -22,10 +24,20 @@ > mcgen, > ) > from .gen import QAPISchemaModularCVisitor, ifcontext > -from .schema import QAPISchemaEnumType, QAPISchemaObjectType > +from .schema import ( > + QAPISchema, > + QAPISchemaEnumMember, > + QAPISchemaEnumType, > + QAPISchemaFeature, > + QAPISchemaObjectType, > + QAPISchemaObjectTypeMember, > + QAPISchemaType, > + QAPISchemaVariants, > +) > +from .source import QAPISourceInfo > > > -def gen_visit_decl(name, scalar=False): > +def gen_visit_decl(name: str, scalar: bool = False) -> str:
More abuse of review to learn: even through we initialize with False, we still need the type hint? > c_type = c_name(name) + ' *' > if not scalar: > c_type += '*' [...]