summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/__init__.py
diff options
context:
space:
mode:
authorJohn Snow2021-05-19 20:39:47 +0200
committerMarkus Armbruster2021-05-20 11:28:28 +0200
commit03386200b90c68953e217baedd3716cdee9ed169 (patch)
tree23903345582e9b0da7f83e0686cd2dac0f23320b /scripts/qapi/__init__.py
parentqapi/parser: Fix token membership tests when token can be None (diff)
downloadqemu-03386200b90c68953e217baedd3716cdee9ed169.tar.gz
qemu-03386200b90c68953e217baedd3716cdee9ed169.tar.xz
qemu-03386200b90c68953e217baedd3716cdee9ed169.zip
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>
Diffstat (limited to 'scripts/qapi/__init__.py')
0 files changed, 0 insertions, 0 deletions