mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi/schema: add type narrowing to lookup_type()
This function is a bit hard to type as-is; mypy needs some assertions to assist with the type narrowing. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240315152301.3621858-11-armbru@redhat.com>
This commit is contained in:
parent
9bda6c7d11
commit
10755a9536
1 changed files with 3 additions and 1 deletions
|
@ -989,7 +989,9 @@ class QAPISchema:
|
|||
return ent
|
||||
|
||||
def lookup_type(self, name):
|
||||
return self.lookup_entity(name, QAPISchemaType)
|
||||
typ = self.lookup_entity(name, QAPISchemaType)
|
||||
assert typ is None or isinstance(typ, QAPISchemaType)
|
||||
return typ
|
||||
|
||||
def resolve_type(self, name, info, what):
|
||||
typ = self.lookup_type(name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue