From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04885C282EC for ; Sat, 8 Mar 2025 18:33:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqyyX-00081j-Cp; Sat, 08 Mar 2025 13:32:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqyyU-00081L-Ba for qemu-devel@nongnu.org; Sat, 08 Mar 2025 13:32:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqyyR-0001YK-Id for qemu-devel@nongnu.org; Sat, 08 Mar 2025 13:32:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741458749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+UJUsLgqfGSQG8M8l8fZY5IVOdIKhfNgNZkoe0rqjWo=; b=HQy0n498FqQbWUywF75pkL0hV3hLPI/OG1bcxy46uOEASb4b2scNk7xx2Gu+ICrFp6NXeP tRHoj9gTZb8hgshow6uRwPVcJYWML9QDb7oJuVfgHSM+pi7E2dhfyzapF+taIXjq/DjJqE IZ9UH9IANe6otU9hr0xKq59dMcaCjwE= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-_jHnUmlyOUu81juD9thKaQ-1; Sat, 08 Mar 2025 13:32:27 -0500 X-MC-Unique: _jHnUmlyOUu81juD9thKaQ-1 X-Mimecast-MFC-AGG-ID: _jHnUmlyOUu81juD9thKaQ_1741458746 Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2254e0b4b85so6663035ad.0 for ; Sat, 08 Mar 2025 10:32:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741458745; x=1742063545; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+UJUsLgqfGSQG8M8l8fZY5IVOdIKhfNgNZkoe0rqjWo=; b=XF6XpHBtIzcUI5RWN2In1PtLHLPWhbiSTUNlC6v4MJseWL36WI1kYmOwmUKsAZ8W+j XCDqX2Lr0OxLAzeIujclQSYR0USWvWtNi168ah3FoEkcX6lmKIVKykDeeo29anorTKOS 7fXpcpN2CSrgO73AqAHer8L74IG8+Whtz/r7Zr2VJmCwBNdCX4eFQiIQeY1Mv/NVH3Mr K6l3DsrXk27U9Zq9RITyA7ifgz3klDO6yu+9Pez1AX0gzEEOXow8cVoRE+QhAv/1KQ3d Zly5WKzliWlEFKsdkOBKnV49FeGWQ/PlgDS95qOu14NcfLSW2dzCY042GvsqSu0S0Cdw CtSA== X-Gm-Message-State: AOJu0YyalJN3Fn9Tj8bCWnEtD5cK37FgQ2vcQOl2mjHF4wV3yVNUHMFa MIat3C3aWrqdubD7KmmTwKf3b6p+P78Hk6wpkghVGLEXmux8iObNCDqRl3xkfgAI80esIFH1HjX N/8X7BjVyDeMHvYYbh0d3JWrKd8VBh7AoamwlkIe0MjHsdyjofy97r9BMFmgOj+EgTfe7+my2WO YIzni4IiTh0yI+1XpdZl9uWYYqWOozPVsCNHw= X-Gm-Gg: ASbGncuOewElYbezQg6GcNcnAZOXioI/Fq+tp8HCWaMnYFIiWoE5y8/dcyYUwfmC1gy i9DEwCaIc+JqnnuM1fTiaRcPWdXSexneSHEpPKdjskLxmq33c3JKBdGmdIoJJ6ZeyQF+F6w== X-Received: by 2002:a17:903:8cd:b0:21f:53a5:19e0 with SMTP id d9443c01a7336-2246285e46fmr77227765ad.12.1741458745263; Sat, 08 Mar 2025 10:32:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbiJsg9tOLOpcbMYSL3KS/0JJVoGyyoBjhWU+IdJlVTV4lZzIqF9kPvN7wl3GcUP57FKObwIv/i7c4YO2T9zQ= X-Received: by 2002:a17:903:8cd:b0:21f:53a5:19e0 with SMTP id d9443c01a7336-2246285e46fmr77227375ad.12.1741458744865; Sat, 08 Mar 2025 10:32:24 -0800 (PST) MIME-Version: 1.0 References: <20250305034610.960147-1-jsnow@redhat.com> <20250305034610.960147-36-jsnow@redhat.com> <878qphkq4i.fsf@pond.sub.org> In-Reply-To: <878qphkq4i.fsf@pond.sub.org> From: John Snow Date: Sat, 8 Mar 2025 13:32:12 -0500 X-Gm-Features: AQ5f1Jq5X2ujWUgYczjkN49kZaNEkDM9_QsdcoiO9wRy4g3iiQrpvSbHmmWv-NY Message-ID: Subject: Re: [PATCH 35/57] docs/qapidoc: Fix static typing on qapidoc.py To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth , =?UTF-8?B?QWxleCBCZW5uw6ll?= , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= , Peter Maydell , Thomas Huth , =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= Content-Type: multipart/alternative; boundary="000000000000e10fc3062fd8f509" Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --000000000000e10fc3062fd8f509 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 7, 2025 at 7:00=E2=80=AFAM Markus Armbruster wrote: > John Snow writes: > > > Now that the legacy code is factored out, fix up the typing on the > > remaining code in qapidoc.py. Add a type ignore to qapi_legacy.py to > > prevent the errors there from bleeding out into qapidoc.py. > > > > Signed-off-by: John Snow > > --- > > docs/sphinx/qapidoc.py | 40 ++++++++++++++++++++++------------- > > docs/sphinx/qapidoc_legacy.py | 1 + > > 2 files changed, 26 insertions(+), 15 deletions(-) > > > > diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py > > index f4abf42e7bf..5246832b68c 100644 > > --- a/docs/sphinx/qapidoc.py > > +++ b/docs/sphinx/qapidoc.py > > @@ -24,17 +24,18 @@ > > https://www.sphinx-doc.org/en/master/development/index.html > > """ > > > > +from __future__ import annotations > > + > > import os > > import sys > > -from typing import List > > +from typing import TYPE_CHECKING > > > > from docutils import nodes > > from docutils.parsers.rst import Directive, directives > > from qapi.error import QAPIError > > -from qapi.gen import QAPISchemaVisitor > > -from qapi.schema import QAPISchema > > +from qapi.schema import QAPISchema, QAPISchemaVisitor > > > > -from qapidoc_legacy import QAPISchemaGenRSTVisitor > > +from qapidoc_legacy import QAPISchemaGenRSTVisitor # type: ignore > > from sphinx import addnodes > > from sphinx.directives.code import CodeBlock > > from sphinx.errors import ExtensionError > > @@ -42,6 +43,15 @@ > > from sphinx.util.nodes import nested_parse_with_titles > > > > > > +if TYPE_CHECKING: > > + from typing import Any, List, Sequence > > + > > + from docutils.statemachine import StringList > > + > > + from sphinx.application import Sphinx > > + from sphinx.util.typing import ExtensionMetadata > > Can you briefly explain why this needs to be conditional? > No requisite, but if they aren't used outside of type hints, they don't actually need to be imported at runtime (when we use from __future__ import annotations). Improves startup speed slightly and potentially makes the plugin less porcelain at runtime. > > > + > > + > > __version__ =3D "1.0" > > > > > > @@ -53,11 +63,11 @@ class QAPISchemaGenDepVisitor(QAPISchemaVisitor): > > schema file associated with each module in the QAPI input. > > """ > > > > - def __init__(self, env, qapidir): > > + def __init__(self, env: Any, qapidir: str) -> None: > > @env is QAPIDocDirective.state.document.settings.env, i.e. something > deep in Sphinx. I assume Any is the best Sphinx lets you do here. > Will double-check, I did this a while ago. > > > self._env =3D env > > self._qapidir =3D qapidir > > > > - def visit_module(self, name): > > + def visit_module(self, name: str) -> None: > > if name !=3D "./builtin": > > qapifile =3D self._qapidir + "/" + name > > self._env.note_dependency(os.path.abspath(qapifile)) > > @@ -65,10 +75,10 @@ def visit_module(self, name): > > > > > > class NestedDirective(Directive): > > - def run(self): > > + def run(self) -> Sequence[nodes.Node]: > > raise NotImplementedError > > > > - def do_parse(self, rstlist, node): > > + def do_parse(self, rstlist: StringList, node: nodes.Node) -> None: > > """ > > Parse rST source lines and add them to the specified node > > > > @@ -93,15 +103,15 @@ class QAPIDocDirective(NestedDirective): > > } > > has_content =3D False > > > > - def new_serialno(self): > > + def new_serialno(self) -> str: > > """Return a unique new ID string suitable for use as a node's > ID""" > > env =3D self.state.document.settings.env > > return "qapidoc-%d" % env.new_serialno("qapidoc") > > > > - def transmogrify(self, schema) -> nodes.Element: > > + def transmogrify(self, schema: QAPISchema) -> nodes.Element: > > raise NotImplementedError > > > > - def legacy(self, schema) -> nodes.Element: > > + def legacy(self, schema: QAPISchema) -> nodes.Element: > > vis =3D QAPISchemaGenRSTVisitor(self) > > vis.visit_begin(schema) > > for doc in schema.docs: > > @@ -109,9 +119,9 @@ def legacy(self, schema) -> nodes.Element: > > vis.symbol(doc, schema.lookup_entity(doc.symbol)) > > else: > > vis.freeform(doc) > > - return vis.get_document_node() > > + return vis.get_document_node() # type: ignore > > This is where you call qapidoc_legacy.py, which remains untyped. Okay. > > > > > - def run(self): > > + def run(self) -> Sequence[nodes.Node]: > > env =3D self.state.document.settings.env > > qapifile =3D env.config.qapidoc_srctree + "/" + self.arguments= [0] > > qapidir =3D os.path.dirname(qapifile) > > @@ -185,7 +195,7 @@ def _highlightlang(self) -> addnodes.highlightlang: > > ) > > return node > > > > - def admonition_wrap(self, *content) -> List[nodes.Node]: > > + def admonition_wrap(self, *content: nodes.Node) -> List[nodes.Node= ]: > > title =3D "Example:" > > if "title" in self.options: > > title =3D f"{title} {self.options['title']}" > > @@ -231,7 +241,7 @@ def run(self) -> List[nodes.Node]: > > return self.admonition_wrap(*content_nodes) > > > > > > -def setup(app): > > +def setup(app: Sphinx) -> ExtensionMetadata: > > """Register qapi-doc directive with Sphinx""" > > app.add_config_value("qapidoc_srctree", None, "env") > > app.add_directive("qapi-doc", QAPIDocDirective) > > diff --git a/docs/sphinx/qapidoc_legacy.py > b/docs/sphinx/qapidoc_legacy.py > > index 679f38356b1..13520f4c26b 100644 > > --- a/docs/sphinx/qapidoc_legacy.py > > +++ b/docs/sphinx/qapidoc_legacy.py > > @@ -1,4 +1,5 @@ > > # coding=3Dutf-8 > > +# type: ignore > > # > > # QEMU qapidoc QAPI file parsing extension > > # > > Types look good to me. > > --000000000000e10fc3062fd8f509 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, Mar 7, = 2025 at 7:00=E2=80=AFAM Markus Armbruster <armbru@redhat.com> wrote:
John Snow <jsnow@redhat.com> writes:

> Now that the legacy code is factored out, fix up the typing on the
> remaining code in qapidoc.py. Add a type ignore to qapi_legacy.py to > prevent the errors there from bleeding out into qapidoc.py.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>=C2=A0 docs/sphinx/qapidoc.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 40 +++++++++= +++++++++++++-------------
>=C2=A0 docs/sphinx/qapidoc_legacy.py |=C2=A0 1 +
>=C2=A0 2 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
> index f4abf42e7bf..5246832b68c 100644
> --- a/docs/sphinx/qapidoc.py
> +++ b/docs/sphinx/qapidoc.py
> @@ -24,17 +24,18 @@
>=C2=A0 https://www.sphinx-doc.org/en/= master/development/index.html
>=C2=A0 """
>=C2=A0
> +from __future__ import annotations
> +
>=C2=A0 import os
>=C2=A0 import sys
> -from typing import List
> +from typing import TYPE_CHECKING
>=C2=A0
>=C2=A0 from docutils import nodes
>=C2=A0 from docutils.parsers.rst import Directive, directives
>=C2=A0 from qapi.error import QAPIError
> -from qapi.gen import QAPISchemaVisitor
> -from qapi.schema import QAPISchema
> +from qapi.schema import QAPISchema, QAPISchemaVisitor
>=C2=A0
> -from qapidoc_legacy import QAPISchemaGenRSTVisitor
> +from qapidoc_legacy import QAPISchemaGenRSTVisitor=C2=A0 # type: igno= re
>=C2=A0 from sphinx import addnodes
>=C2=A0 from sphinx.directives.code import CodeBlock
>=C2=A0 from sphinx.errors import ExtensionError
> @@ -42,6 +43,15 @@
>=C2=A0 from sphinx.util.nodes import nested_parse_with_titles
>=C2=A0
>=C2=A0
> +if TYPE_CHECKING:
> +=C2=A0 =C2=A0 from typing import Any, List, Sequence
> +
> +=C2=A0 =C2=A0 from docutils.statemachine import StringList
> +
> +=C2=A0 =C2=A0 from sphinx.application import Sphinx
> +=C2=A0 =C2=A0 from sphinx.util.typing import ExtensionMetadata

Can you briefly explain why this needs to be conditional?
<= div>
No requisite, but if they aren't used outside of typ= e hints, they don't actually need to be imported at runtime (when we us= e from __future__ import annotations). Improves startup speed slightly and = potentially makes the plugin less porcelain at runtime.
=C2=A0

> +
> +
>=C2=A0 __version__ =3D "1.0"
>=C2=A0
>=C2=A0
> @@ -53,11 +63,11 @@ class QAPISchemaGenDepVisitor(QAPISchemaVisitor):<= br> >=C2=A0 =C2=A0 =C2=A0 schema file associated with each module in the QAP= I input.
>=C2=A0 =C2=A0 =C2=A0 """
>=C2=A0
> -=C2=A0 =C2=A0 def __init__(self, env, qapidir):
> +=C2=A0 =C2=A0 def __init__(self, env: Any, qapidir: str) -> None:<= br>
@env is QAPIDocDirective.state.document.settings.env, i.e. something
deep in Sphinx.=C2=A0 I assume Any is the best Sphinx lets you do here.
=

Will double-check, I did this a while ago.=
=C2=A0

>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._env =3D env
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._qapidir =3D qapidir
>=C2=A0
> -=C2=A0 =C2=A0 def visit_module(self, name):
> +=C2=A0 =C2=A0 def visit_module(self, name: str) -> None:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if name !=3D "./builtin":<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 qapifile =3D self._qap= idir + "/" + name
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._env.note_depende= ncy(os.path.abspath(qapifile))
> @@ -65,10 +75,10 @@ def visit_module(self, name):
>=C2=A0
>=C2=A0
>=C2=A0 class NestedDirective(Directive):
> -=C2=A0 =C2=A0 def run(self):
> +=C2=A0 =C2=A0 def run(self) -> Sequence[nodes.Node]:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raise NotImplementedError
>=C2=A0
> -=C2=A0 =C2=A0 def do_parse(self, rstlist, node):
> +=C2=A0 =C2=A0 def do_parse(self, rstlist: StringList, node: nodes.Nod= e) -> None:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 """
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Parse rST source lines and add them = to the specified node
>=C2=A0
> @@ -93,15 +103,15 @@ class QAPIDocDirective(NestedDirective):
>=C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 has_content =3D False
>=C2=A0
> -=C2=A0 =C2=A0 def new_serialno(self):
> +=C2=A0 =C2=A0 def new_serialno(self) -> str:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 """Return a unique ne= w ID string suitable for use as a node's ID"""
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 env =3D self.state.document.settings= .env
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return "qapidoc-%d" % env.= new_serialno("qapidoc")
>=C2=A0
> -=C2=A0 =C2=A0 def transmogrify(self, schema) -> nodes.Element:
> +=C2=A0 =C2=A0 def transmogrify(self, schema: QAPISchema) -> nodes.= Element:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raise NotImplementedError
>=C2=A0
> -=C2=A0 =C2=A0 def legacy(self, schema) -> nodes.Element:
> +=C2=A0 =C2=A0 def legacy(self, schema: QAPISchema) -> nodes.Elemen= t:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vis =3D QAPISchemaGenRSTVisitor(self= )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vis.visit_begin(schema)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for doc in schema.docs:
> @@ -109,9 +119,9 @@ def legacy(self, schema) -> nodes.Element:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vis.symb= ol(doc, schema.lookup_entity(doc.symbol))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vis.free= form(doc)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 return vis.get_document_node()
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return vis.get_document_node()=C2=A0 # ty= pe: ignore

This is where you call qapidoc_legacy.py, which remains untyped.=C2=A0 Okay= .

>=C2=A0
> -=C2=A0 =C2=A0 def run(self):
> +=C2=A0 =C2=A0 def run(self) -> Sequence[nodes.Node]:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 env =3D self.state.document.settings= .env
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 qapifile =3D env.config.qapidoc_srct= ree + "/" + self.arguments[0]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 qapidir =3D os.path.dirname(qapifile= )
> @@ -185,7 +195,7 @@ def _highlightlang(self) -> addnodes.highlightl= ang:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return node
>=C2=A0
> -=C2=A0 =C2=A0 def admonition_wrap(self, *content) -> List[nodes.No= de]:
> +=C2=A0 =C2=A0 def admonition_wrap(self, *content: nodes.Node) -> L= ist[nodes.Node]:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 title =3D "Example:"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if "title" in self.options= :
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 title =3D f"{titl= e} {self.options['title']}"
> @@ -231,7 +241,7 @@ def run(self) -> List[nodes.Node]:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return self.admonition_wrap(*content= _nodes)
>=C2=A0
>=C2=A0
> -def setup(app):
> +def setup(app: Sphinx) -> ExtensionMetadata:
>=C2=A0 =C2=A0 =C2=A0 """Register qapi-doc directive with= Sphinx"""
>=C2=A0 =C2=A0 =C2=A0 app.add_config_value("qapidoc_srctree", = None, "env")
>=C2=A0 =C2=A0 =C2=A0 app.add_directive("qapi-doc", QAPIDocDir= ective)
> diff --git a/docs/sphinx/qapidoc_legacy.py b/docs/sphinx/qapidoc_legac= y.py
> index 679f38356b1..13520f4c26b 100644
> --- a/docs/sphinx/qapidoc_legacy.py
> +++ b/docs/sphinx/qapidoc_legacy.py
> @@ -1,4 +1,5 @@
>=C2=A0 # coding=3Dutf-8
> +# type: ignore
>=C2=A0 #
>=C2=A0 # QEMU qapidoc QAPI file parsing extension
>=C2=A0 #

Types look good to me.

--000000000000e10fc3062fd8f509--