[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 00/14] qapi: static typing conversion, pt3
From: |
John Snow |
Subject: |
[PATCH 00/14] qapi: static typing conversion, pt3 |
Date: |
Tue, 22 Sep 2020 17:17:48 -0400 |
based-on: <20200922211313.4082880-1-jsnow@redhat.com>
[PATCH 00/16] qapi: static typing conversion, pt2
Hi, this series adds static type hints to the QAPI module.
This is part three!
Part 3: https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt3
Everything: https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt6
- 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 just doc.py ... which, err, Peter
Maydell is getting rid of soon. Oh well. This is posted for reference;
and simply as context and pre-requisite for later patches.
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 (14):
qapi/doc.py: stash long temporary locals in named locals
qapi/doc.py: avoid unnecessary keyword arguments
qapi/doc.py: Add assertion on section.member
qapi/doc.py: assert correct types in member_func callbacks
qapi/doc.py: Assert no suffix given for enum members
qapi/doc.py: Add type hint annotations
qapi/doc.py: enable mypy checks
qapi/doc.py: Add generic texi_member callback
qapi/doc.py: Remove one-letter variables
qapi/gen.py: Add __bool__ dunder method to QAPIGen
qapi/doc.py: Don't use private attributes of QAPIGen property
qapi/doc.py: Assert tag member is Enum type
qapi/doc.py: Assert type of object variant
qapi/doc.py: enable pylint checks
scripts/qapi/doc.py | 189 ++++++++++++++++++++++++++++--------------
scripts/qapi/gen.py | 3 +
scripts/qapi/mypy.ini | 5 --
scripts/qapi/pylintrc | 3 +-
4 files changed, 133 insertions(+), 67 deletions(-)
--
2.26.2
- [PATCH 00/14] qapi: static typing conversion, pt3,
John Snow <=
- [PATCH 01/14] qapi/doc.py: stash long temporary locals in named locals, John Snow, 2020/09/22
- [PATCH 02/14] qapi/doc.py: avoid unnecessary keyword arguments, John Snow, 2020/09/22
- [PATCH 03/14] qapi/doc.py: Add assertion on section.member, John Snow, 2020/09/22
- [PATCH 07/14] qapi/doc.py: enable mypy checks, John Snow, 2020/09/22
- [PATCH 10/14] qapi/gen.py: Add __bool__ dunder method to QAPIGen, John Snow, 2020/09/22