On 9/22/20 6:44 PM, John Snow wrote:
based-on: <20200922223525.4085762-1-js...@redhat.com>
[PATCH 00/26] qapi: static typing conversion, pt5
Hi, this series adds static type hints to the QAPI module.
This is the final part, part six!
Part 6 (Everything):
https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt6
Note: I have rebased and updated the pt6 branch. I am currently working
on respinning pt2, which now contains the introspect.py patches that
were formerly in pt1.
Thanks,
--js
- Requires Python 3.6+
- Requires mypy 0.770 or newer (for type analysis only)
- Requires pylint 2.6.0 or newer (for lint checking only)
This part of the series focuses on schema.py.
Type hints are added in patches that add *only* type hints and change no
other behavior. Any necessary changes to behavior to accommodate typing
are split out into their own tiny patches.
Every commit should pass with:
- flake8 qapi/
- pylint --rcfile=qapi/pylintrc qapi/
- mypy --config-file=qapi/mypy.ini qapi/
John Snow (25):
qapi/schema: add Visitable mixin
qapi/schema.py: Move meta-type into class instances
qapi/schema.py: add assert in stub methods
qapi/schema.py: constrain QAPISchemaObjectType base type
qapi/schema.py: constrain QAPISchemaObjectTypeMember arg_type type
qapi/schema.py: constrain QAPISchemaEvent arg_type type
qapi/schema.py: constrain tag_member type
qapi/schema.py: Allow alternate_type to assert
qapi/schema.py: remove superfluous assert
qapi/schema.py: Add assertion to ifcond property
qapi/schema.py: Constrain type of QAPISchemaObjectType members field
qapi/schema.py: remove 'and' from non-bool rvalue expressions
qapi/schema.py: Test type of self.ret_type instead of local temp
qapi/schema.py: Assert variants of an object are also objects
qapi/schema.py: add type hint annotations
qapi/schema.py: enable checking
qapi: Disable similarity checks in pylint entirely
qapi/schema.py: Add pylint warning suppressions
qapi/schema.py: Convert several methods to classmethods
qapi/schema.py: Replace one-letter variable names
qapi/schema.py: disable pylint line limit
qapi/schema.py: Ignore unused argument for check()
qapi/schema.py: enable pylint checks
qapi/schema.py: Add module docstring
qapi/schema.py: Use python3 style super()
scripts/qapi/mypy.ini | 6 -
scripts/qapi/pylintrc | 6 +-
scripts/qapi/schema.py | 848 +++++++++++++++++++++++++++--------------
3 files changed, 557 insertions(+), 303 deletions(-)