All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] qapi: static typing conversion, pt1.5
@ 2020-12-17  1:59 John Snow
  2020-12-17  1:59 ` [PATCH v2 01/12] qapi/commands: assert arg_type is not None John Snow
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: John Snow @ 2020-12-17  1:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Michael Roth, Markus Armbruster, Cleber Rosa,
	Marc-André Lureau, John Snow

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.

V2:

001/12:[----] [--] 'qapi/commands: assert arg_type is not None'
002/12:[----] [--] 'qapi/events: fix visit_event typing'
003/12:[0003] [FC] 'qapi/main: handle theoretical None-return from re.match()'
004/12:[----] [--] 'qapi/gen: assert that _start_if is not None in _wrap_ifcond'
005/12:[0003] [FC] 'qapi/gen: use './builtin' for the built-in module name'
006/12:[0004] [FC] 'qapi/source: Add builtin null-object sentinel'
007/12:[0024] [FC] 'qapi/schema: make QAPISourceInfo mandatory'
008/12:[----] [--] 'qapi/gen: write _genc/_genh access shims'
009/12:[----] [--] 'qapi/gen: move write method to QAPIGenC, make fname a str'
010/12:[----] [--] 'tests/qapi-schema: Add quotes to module name in test output'
011/12:[0004] [FC] 'qapi/schema: Name the builtin module "" instead of None'
012/12:[----] [--] 'qapi: enable strict-optional checks'

- This revision isn't quite complete, but due to deadlines and
  timezones, opted to send the "revision so far". It keeps some
  imperfect fixes that Markus is devising better alternatives for.

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/schema: make QAPISourceInfo mandatory
  qapi/gen: write _genc/_genh access shims
  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                      | 108 ++++++++++++-----------
 scripts/qapi/main.py                     |   2 +
 scripts/qapi/mypy.ini                    |   1 -
 scripts/qapi/schema.py                   |  35 ++++----
 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, 145 insertions(+), 109 deletions(-)

-- 
2.26.2




^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2021-01-19 16:14 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17  1:59 [PATCH v2 00/12] qapi: static typing conversion, pt1.5 John Snow
2020-12-17  1:59 ` [PATCH v2 01/12] qapi/commands: assert arg_type is not None John Snow
2020-12-17  1:59 ` [PATCH v2 02/12] qapi/events: fix visit_event typing John Snow
2020-12-17  1:59 ` [PATCH v2 03/12] qapi/main: handle theoretical None-return from re.match() John Snow
2020-12-17  1:59 ` [PATCH v2 04/12] qapi/gen: assert that _start_if is not None in _wrap_ifcond John Snow
2021-01-13 15:14   ` Markus Armbruster
2021-01-13 21:34     ` John Snow
2020-12-17  1:59 ` [PATCH v2 05/12] qapi/gen: use './builtin' for the built-in module name John Snow
2020-12-17  1:59 ` [PATCH v2 06/12] qapi/source: Add builtin null-object sentinel John Snow
2021-01-13 15:39   ` Markus Armbruster
2021-01-13 22:30     ` John Snow
2021-01-14 13:39       ` Markus Armbruster
2021-01-18 18:36         ` Eduardo Habkost
2021-01-19 10:21           ` Markus Armbruster
2021-01-19 16:10             ` Eduardo Habkost
2020-12-17  1:59 ` [PATCH v2 07/12] qapi/schema: make QAPISourceInfo mandatory John Snow
2021-01-13 16:12   ` Markus Armbruster
2021-01-13 23:04     ` John Snow
2021-01-14  0:29       ` Eduardo Habkost
2021-01-14  0:47         ` John Snow
2020-12-17  1:59 ` [PATCH v2 08/12] qapi/gen: write _genc/_genh access shims John Snow
2020-12-17  1:59 ` [PATCH v2 09/12] qapi/gen: move write method to QAPIGenC, make fname a str John Snow
2020-12-17  1:59 ` [PATCH v2 10/12] tests/qapi-schema: Add quotes to module name in test output John Snow
2020-12-17  1:59 ` [PATCH v2 11/12] qapi/schema: Name the builtin module "" instead of None John Snow
2020-12-17  1:59 ` [PATCH v2 12/12] qapi: enable strict-optional checks John Snow
2021-01-13 16:23 ` [PATCH v2 00/12] qapi: static typing conversion, pt1.5 Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.