On Fri, Mar 15, 2024, 10:03 AM Markus Armbruster <arm...@redhat.com> wrote:

> John Snow <js...@redhat.com> writes:
>
> > This patch only adds type hints, which aren't utilized at runtime and
> > don't change the behavior of this module in any way.
> >
> > In a scant few locations, type hints are removed where no longer
> > necessary due to inference power from typing all of the rest of
> > creation; and any type hints that no longer need string quotes are
> > changed.
> >
> > Signed-off-by: John Snow <js...@redhat.com>
> > ---
> >  scripts/qapi/schema.py | 568 ++++++++++++++++++++++++++++-------------
> >  1 file changed, 396 insertions(+), 172 deletions(-)
> >
> > diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
> > index 3b8c2ebbb5f..d2faaea6eac 100644
> > --- a/scripts/qapi/schema.py
> > +++ b/scripts/qapi/schema.py
>
> [...]
>
> > @@ -1006,18 +1181,27 @@ def _def_definition(self, defn):
> >                  defn.info, "%s is already defined" %
> other_defn.describe())
> >          self._entity_dict[defn.name] = defn
> >
> > -    def lookup_entity(self, name, typ=None):
> > +    def lookup_entity(
> > +        self,
> > +        name: str,
> > +        typ: Optional[type] = None,
> > +    ) -> Optional[QAPISchemaEntity]:
>
> Optional[QAPISchemaDefinition], actually.
>

Ah! Very good catch.


> >          ent = self._entity_dict.get(name)
> >          if typ and not isinstance(ent, typ):
> >              return None
> >          return ent
>
> [...]
>
>

Reply via email to