Skip to content

python-qapi-cleanup-pt3 (2021-04-20)

qapi: static typing conversion, pt3

Hi, this series adds static types to the QAPI module. This is part three, and it focuses on expr.py.

Environment:

  • Python >= 3.6, <= 3.8 *
  • mypy >= 0.770
  • pylint >= 2.6.0
  • flake8
  • isort

Every commit should pass with (from ./scripts/):

  • flake8 qapi/
  • pylint --rcfile=qapi/pylintrc qapi/
  • mypy --config-file=qapi/mypy.ini qapi/
  • pushd qapi && isort -c . && popd

V5:

001/17:[----] [--] 'qapi/expr: Comment cleanup'
002/19: -DROPPED-  'flake8: Enforce shorter line length for comments and docstrings'
002/17:[----] [--] 'qapi/expr.py: Remove 'info' argument from nested check_if_str'
003/17:[----] [--] 'qapi/expr.py: Check for dict instead of OrderedDict'
004/17:[0006] [FC] 'qapi/expr.py: constrain incoming expression types'
005/17:[----] [--] 'qapi/expr.py: Add assertion for union type 'check_dict''
006/17:[----] [--] 'qapi/expr.py: move string check upwards in check_type'
007/17:[down]      'qapi/expr.py: Check type of union and alternate 'data' member'
008/19: -MERGED- ^ 'qapi: add tests for invalid 'data' field type'
009/19: -MERGED- ^ 'qapi/expr.py: Check type of 'data' member'
008/17:[0004] [FC] 'qapi/expr.py: Add casts in a few select cases'
009/17:[----] [--] 'qapi/expr.py: Modify check_keys to accept any Collection'
010/17:[----] [-C] 'qapi/expr.py: add type hint annotations'
011/17:[0013] [FC] 'qapi/expr.py: Consolidate check_if_str calls in check_if'
012/17:[----] [--] 'qapi/expr.py: Remove single-letter variable'
013/17:[----] [--] 'qapi/expr.py: enable pylint checks'
014/17:[down]      'qapi/expr: Only explicitly prohibit 'Kind' nor 'List' for type names'
015/17:[0006] [FC] 'qapi/expr.py: Add docstrings'
016/17:[down]      'qapi/expr: [RFC] docstring diff'
017/17:[down]      'qapi/expr: Update authorship and copyright information'
017/19: -DROPPED-  'qapi/expr.py: Use tuples instead of lists for static data'
018/19: -DROPPED-  'qapi/expr.py: move related checks inside check_xxx functions'
019/19: -DROPPED-  'qapi/expr.py: Use an expression checker dispatch table'
  • Dropped what was 02, 18, 19.
  • Merged what was 08, 09 into what is now 07.
  • 04: Expanded comment for _JSONObject type alias.
  • 07: "New", combines the fix and the test patches from the previous series into one patch.
  • 08: Fixed spelling of "Checked" from "Asserted"
  • 11: Reverted back to Python2 style string interpolation
  • 14: New, fix the code to reflect the docs for Kind/List reservations.
  • 15: Many, many docstring changes. (Too many to list!)
  • 17: New, update copyright/authorship. (Could be folded into 15 if desired, as that's what I'm claiming credit for.)
Edited by John Snow

Merge request reports

Loading