qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/15] qapi: static typing conversion, pt5a
@ 2021-05-19 18:39 John Snow
  2021-05-19 18:39 ` [PATCH v3 01/15] qapi/parser: Don't try to handle file errors John Snow
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: John Snow @ 2021-05-19 18:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Roth, Cleber Rosa, John Snow, Eduardo Habkost, Markus Armbruster

This is part five (a), and focuses on QAPISchemaParser in parser.py.
It does not touch QAPIDoc yet, which will be covered next.

gitlab: https://gitlab.com/jsnow/qemu/-/commits/python-qapi-cleanup-pt5a

Requirements:
- Python 3.6+
- mypy >= 0.770
- pylint >= 2.6.0 (2.7.0+ when using Python 3.9+)

Every commit should pass with:
 - `isort -c qapi/`
 - `flake8 qapi/`
 - `pylint --rcfile=qapi/pylintrc qapi/`
 - `mypy --config-file=qapi/mypy.ini qapi/`

V3:

001: Commit message changed
004: Commit message changed
005/15:[0002] [FC] 'qapi/parser: Assert lexer value is a string'
        - Remove comment
015/15:[0019] [FC] 'qapi/parser: add docstrings'
        - Futz with docstrings based on review from armbru

V2:

001/21:[0024] [FC] 'qapi/parser: Don't try to handle file errors'
002/21:[down] 'qapi: Add test for nonexistent schema file'
003/21:[0008] [FC] 'qapi/source: Remove line number from QAPISourceInfo initializer'
004/21:[0003] [FC] 'qapi/parser: factor parsing routine into method'
005/21:[0002] [FC] 'qapi/parser: Assert lexer value is a string'
006/21:[down] 'qapi/parser: enforce all top-level expressions must be dict in _parse()'
007/21:[----] [--] 'qapi/parser: assert object keys are strings'
008/21:[----] [--] 'qapi/parser: Use @staticmethod where appropriate'
009/21:[down] 'qapi: add must_match helper'
010/21:[down] 'qapi/parser: Fix token membership tests when token can be None'
011/21:[0012] [FC] 'qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard'
012/21:[0019] [FC] 'qapi/parser: add type hint annotations'
013/21:[down] 'qapi/parser: Remove superfluous list comprehension'
014/21:[----] [--] 'qapi/parser: allow 'ch' variable name'
015/21:[0080] [FC] 'qapi/parser: add docstrings'

01:
  - Futzed with the commit message a lot.
  - Added new try/except to QAPISchema() instead of main().
  - Adjusted "let caller handle this error" comment
  - Adjusted test-qapi not to crash.
02:
  - New, add test for nonexistant root schema file.
03:
  - Commit message changes.
  - Rebase changes, removed _column RFC patch that preceded it.
04:
  - Commit message changes.
  - Minor rebase changes (from changed comment in 01)
05:
  - Remove assert message, replace w/ comment
06:
  - Replaces 'qapi/parser: assert get_expr returns object in outer loop'
09:
  - Renamed match_nofail() to must_match()
10:
  - Use tuple() for token membership tests
  - Add test cases to prevent regressions
11:
  - _check => _check_list_str
  - info.pragma => pragma
12:
  - Remove 'Expression' type entirely for now
  - Highlight self.tok as actively taking None type with Union[str, None]
  - Minor rebase confetti.
13:
  - Renamed commit message.
15:
  - Reworked.
  - Note that 'pos' is indeed interface as it is used by the error handlers.

John Snow (15):
  qapi/parser: Don't try to handle file errors
  qapi: Add test for nonexistent schema file
  qapi/source: Remove line number from QAPISourceInfo initializer
  qapi/parser: factor parsing routine into method
  qapi/parser: Assert lexer value is a string
  qapi/parser: enforce all top-level expressions must be dict in
    _parse()
  qapi/parser: assert object keys are strings
  qapi/parser: Use @staticmethod where appropriate
  qapi: add must_match helper
  qapi/parser: Fix token membership tests when token can be None
  qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard
  qapi/parser: add type hint annotations
  qapi/parser: Remove superfluous list comprehension
  qapi/parser: allow 'ch' variable name
  qapi/parser: add docstrings

 scripts/qapi/common.py                        |   8 +-
 scripts/qapi/main.py                          |   6 +-
 scripts/qapi/parser.py                        | 230 +++++++++++++-----
 scripts/qapi/pylintrc                         |   1 +
 scripts/qapi/schema.py                        |  11 +-
 scripts/qapi/source.py                        |  13 +-
 tests/qapi-schema/meson.build                 |   9 +-
 tests/qapi-schema/missing-array-rsqb.err      |   1 +
 tests/qapi-schema/missing-array-rsqb.json     |   1 +
 tests/qapi-schema/missing-array-rsqb.out      |   0
 .../missing-object-member-element.err         |   1 +
 .../missing-object-member-element.json        |   1 +
 .../missing-object-member-element.out         |   0
 tests/qapi-schema/missing-schema.err          |   1 +
 tests/qapi-schema/missing-schema.out          |   0
 tests/qapi-schema/non-objects.err             |   2 +-
 tests/qapi-schema/quoted-structural-chars.err |   2 +-
 tests/qapi-schema/test-qapi.py                |   3 -
 18 files changed, 209 insertions(+), 81 deletions(-)
 create mode 100644 tests/qapi-schema/missing-array-rsqb.err
 create mode 100644 tests/qapi-schema/missing-array-rsqb.json
 create mode 100644 tests/qapi-schema/missing-array-rsqb.out
 create mode 100644 tests/qapi-schema/missing-object-member-element.err
 create mode 100644 tests/qapi-schema/missing-object-member-element.json
 create mode 100644 tests/qapi-schema/missing-object-member-element.out
 create mode 100644 tests/qapi-schema/missing-schema.err
 create mode 100644 tests/qapi-schema/missing-schema.out

-- 
2.30.2




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

end of thread, other threads:[~2021-05-20 15:06 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 18:39 [PATCH v3 00/15] qapi: static typing conversion, pt5a John Snow
2021-05-19 18:39 ` [PATCH v3 01/15] qapi/parser: Don't try to handle file errors John Snow
2021-05-19 18:39 ` [PATCH v3 02/15] qapi: Add test for nonexistent schema file John Snow
2021-05-19 18:39 ` [PATCH v3 03/15] qapi/source: Remove line number from QAPISourceInfo initializer John Snow
2021-05-19 18:39 ` [PATCH v3 04/15] qapi/parser: factor parsing routine into method John Snow
2021-05-19 18:39 ` [PATCH v3 05/15] qapi/parser: Assert lexer value is a string John Snow
2021-05-19 18:39 ` [PATCH v3 06/15] qapi/parser: enforce all top-level expressions must be dict in _parse() John Snow
2021-05-19 18:39 ` [PATCH v3 07/15] qapi/parser: assert object keys are strings John Snow
2021-05-19 18:39 ` [PATCH v3 08/15] qapi/parser: Use @staticmethod where appropriate John Snow
2021-05-19 18:39 ` [PATCH v3 09/15] qapi: add must_match helper John Snow
2021-05-19 18:39 ` [PATCH v3 10/15] qapi/parser: Fix token membership tests when token can be None John Snow
2021-05-19 18:39 ` [PATCH v3 11/15] qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard John Snow
2021-05-19 18:39 ` [PATCH v3 12/15] qapi/parser: add type hint annotations John Snow
2021-05-19 18:39 ` [PATCH v3 13/15] qapi/parser: Remove superfluous list comprehension John Snow
2021-05-19 18:39 ` [PATCH v3 14/15] qapi/parser: allow 'ch' variable name John Snow
2021-05-20  9:36   ` Markus Armbruster
2021-05-20 14:54     ` John Snow
2021-05-19 18:39 ` [PATCH v3 15/15] qapi/parser: add docstrings John Snow
2021-05-20  9:27 ` [PATCH v3 00/15] qapi: static typing conversion, pt5a Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).