Hi! This branch has some comical name like python-qapi-cleanup-pt6-v2 but, simply, it finishes what I started and statically types all of the QAPI generator code.
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/1074124051 Patch 1 is an actual fix, Patch 2 is a minor patch for pylint with no runtime effect, Patches 3-15 fix individual typing issues that have some runtime effect. Patch 16 adds typing information, Patch 17 removes the schema.py exemption from the mypy conf, Patches 18-19 are optional. Most of the patches (expect 16) are very small. I'm sure we'll need to rework parts of this, but hey, gotta start somewhere. --js John Snow (19): qapi/schema: fix QAPISchemaEntity.__repr__() qapi/schema: add pylint suppressions qapi/schema: name QAPISchemaInclude entities qapi/schema: declare type for QAPISchemaObjectTypeMember.type qapi/schema: make c_type() and json_type() abstract methods qapi/schema: adjust type narrowing for mypy's benefit qapi/introspect: assert schema.lookup_type did not fail qapi/schema: add static typing and assertions to lookup_type() qapi/schema: assert info is present when necessary qapi/schema: make QAPISchemaArrayType.element_type non-Optional qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type qapi/schema: split "checked" field into "checking" and "checked" qapi/schema: fix typing for QAPISchemaVariants.tag_member qapi/schema: assert QAPISchemaVariants are QAPISchemaObjectType qapi/parser: demote QAPIExpression to Dict[str, Any] qapi/schema: add type hints qapi/schema: turn on mypy strictness qapi/schema: remove unnecessary asserts qapi/schema: refactor entity lookup helpers docs/sphinx/qapidoc.py | 2 +- scripts/qapi/mypy.ini | 5 - scripts/qapi/parser.py | 3 +- scripts/qapi/pylintrc | 5 - scripts/qapi/schema.py | 723 ++++++++++++++++++++++++++++------------- 5 files changed, 498 insertions(+), 240 deletions(-) -- 2.41.0