From: Markus Armbruster <[email protected]> Commit 060b5a9323 (qapi: Dumb down QAPISchema.lookup_entity()) accidentally relaxed QAPISchema.lookup_entity()'s return type to QAPISchemaEntity. Tighten it back to QAPISchemaDefinition, and rename the method to .lookup_defn().
Signed-off-by: Markus Armbruster <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> --- docs/sphinx/qapidoc.py | 2 +- scripts/qapi/schema.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 54a32e45f7ed..31d09ed6343e 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -512,7 +512,7 @@ def transmogrify(self, schema: QAPISchema) -> nodes.Element: modules.add(module_source) if doc.symbol: - ent = schema.lookup_entity(doc.symbol) + ent = schema.lookup_defn(doc.symbol) assert isinstance(ent, QAPISchemaDefinition) vis.visit_entity(ent) else: diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 8d88b40de2e1..9c9e257a8fd5 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -1184,11 +1184,11 @@ def _def_definition(self, defn: QAPISchemaDefinition) -> None: defn.info, "%s is already defined" % other_defn.describe()) self._entity_dict[defn.name] = defn - def lookup_entity(self, name: str) -> Optional[QAPISchemaEntity]: + def lookup_defn(self, name: str) -> Optional[QAPISchemaDefinition]: return self._entity_dict.get(name) def lookup_type(self, name: str) -> Optional[QAPISchemaType]: - typ = self.lookup_entity(name) + typ = self.lookup_defn(name) if isinstance(typ, QAPISchemaType): return typ return None @@ -1324,7 +1324,7 @@ def _make_implicit_object_type( return None # See also QAPISchemaObjectTypeMember.describe() name = 'q_obj_%s-%s' % (name, role) - typ = self.lookup_entity(name) + typ = self.lookup_defn(name) if typ: assert isinstance(typ, QAPISchemaObjectType) # The implicit object type has multiple users. This can -- 2.56.0.116.g6de20f6092dc
