qemu-patch-raspberry4/scripts/qapi
John Snow 03386200b9 qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard
TypeGuards wont exist in Python proper until 3.10. Ah well. We can hack
up our own by declaring this function to return the type we claim it
checks for and using this to safely downcast object -> List[str].

In so doing, I bring this function under _pragma so it can use the
'info' object in its closure. Having done this, _pragma also now no
longer needs to take a 'self' parameter, so drop it.

To help with line-length, and with the context evident from its new
scope, rename the function to the shorter check_list_str().

Signed-off-by: John Snow <jsnow@redhat.com>

Message-Id: <20210519183951.3946870-12-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2021-05-20 11:28:28 +02:00
..
.flake8 qapi: delint using flake8 2020-10-10 11:37:47 +02:00
.isort.cfg qapi: enforce import order/styling with isort 2020-10-10 11:37:47 +02:00
__init__.py qapi-gen: New common driver for code and doc generators 2018-03-02 13:14:09 -06:00
commands.py qapi: Implement deprecated-input=reject for QMP command arguments 2021-03-19 16:05:11 +01:00
common.py qapi: add must_match helper 2021-05-20 11:28:28 +02:00
error.py qapi/error: Add type hints 2021-04-30 12:59:54 +02:00
events.py qapi: Implement deprecated-output=hide for QMP event data 2021-03-19 15:43:33 +01:00
expr.py qapi/expr: Update authorship and copyright information 2021-04-30 12:59:54 +02:00
gen.py qapi: Replace List[str] with Sequence[str] for ifcond 2021-02-18 17:10:29 +01:00
introspect.py qapi/introspect.py: set _gen_tree's default ifcond argument to () 2021-02-18 19:51:14 +01:00
main.py qapi: add must_match helper 2021-05-20 11:28:28 +02:00
mypy.ini qapi/error.py: enable mypy checks 2021-04-30 12:59:54 +02:00
parser.py qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard 2021-05-20 11:28:28 +02:00
pylintrc qapi/error.py: enable pylint checks 2021-04-30 12:59:54 +02:00
schema.py qapi/parser: Don't try to handle file errors 2021-05-20 11:28:27 +02:00
source.py qapi/source: Remove line number from QAPISourceInfo initializer 2021-05-20 11:28:27 +02:00
types.py qapi: Replace List[str] with Sequence[str] for ifcond 2021-02-18 17:10:29 +01:00
visit.py qapi: Implement deprecated-input=reject for QMP command arguments 2021-03-19 16:05:11 +01:00