[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 00/12] qapi: static typing conversion, pt1.5
From: |
John Snow |
Subject: |
[PATCH 00/12] qapi: static typing conversion, pt1.5 |
Date: |
Mon, 14 Dec 2020 18:53:15 -0500 |
Hi, this patchset enables strict optional checking in mypy for
everything we have typed so far.
In general, this patchset seeks to eliminate Optional[T] in favor of T
wherever possible. Optional types used for object properties,
function/method parameters and return values where we expect, in most
cases, to be non-None is troublesome as it requires peppering the code
with assertions about state. If and whenever possible, prefer using
non-Optional types.
Ironing out these issues allows us to be even stricter with our type
checking, which improves consistency in subclass interface types and
should make review a little nicer.
This series is based on (but does not require) the 'qapi: sphinx-autodoc
for qapi module' series.
John Snow (12):
qapi/commands: assert arg_type is not None
qapi/events: fix visit_event typing
qapi/main: handle theoretical None-return from re.match()
qapi/gen: assert that _start_if is not None in _wrap_ifcond
qapi/gen: use './builtin' for the built-in module name
qapi/source: Add builtin null-object sentinel
qapi/gen: write _genc/_genh access shims
qapi/schema: make QAPISourceInfo mandatory
qapi/gen: move write method to QAPIGenC, make fname a str
tests/qapi-schema: Add quotes to module name in test output
qapi/schema: Name the builtin module "" instead of None
qapi: enable strict-optional checks
scripts/qapi/commands.py | 11 ++-
scripts/qapi/events.py | 14 +--
scripts/qapi/gen.py | 107 ++++++++++++-----------
scripts/qapi/main.py | 3 +-
scripts/qapi/mypy.ini | 1 -
scripts/qapi/schema.py | 33 +++----
scripts/qapi/source.py | 20 ++++-
scripts/qapi/types.py | 11 +--
scripts/qapi/visit.py | 8 +-
tests/qapi-schema/comments.out | 4 +-
tests/qapi-schema/doc-good.out | 4 +-
tests/qapi-schema/empty.out | 4 +-
tests/qapi-schema/event-case.out | 4 +-
tests/qapi-schema/include-repetition.out | 8 +-
tests/qapi-schema/include-simple.out | 6 +-
tests/qapi-schema/indented-expr.out | 4 +-
tests/qapi-schema/qapi-schema-test.out | 8 +-
tests/qapi-schema/test-qapi.py | 2 +-
18 files changed, 143 insertions(+), 109 deletions(-)
--
2.26.2