[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 34/35] WIP: 3.x ObjectDesc compat
From: |
John Snow |
Subject: |
[RFC PATCH v2 34/35] WIP: 3.x ObjectDesc compat |
Date: |
Thu, 12 Dec 2024 20:13:03 -0500 |
Signed-off-by: John Snow <jsnow@redhat.com>
---
docs/sphinx/compat.py | 7 +++++++
docs/sphinx/qapi-domain.py | 9 +++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/docs/sphinx/compat.py b/docs/sphinx/compat.py
index 5126b450a5f..b2d2d1be403 100644
--- a/docs/sphinx/compat.py
+++ b/docs/sphinx/compat.py
@@ -33,15 +33,22 @@
SOURCE_LOCATION_FIX = (5, 3, 0) <= sphinx.version_info[:3] < (6, 2, 0)
+# Alias for the return of QAPIObject.handle_signature(), which is used
+# in several places. (In the Python domain, this type is Tuple[str,
+# str] instead.)
+Signature = str
+
space_node: Callable[[str], Node]
keyword_node: Callable[[str, str], Node]
if sphinx.version_info[:3] >= (4, 0, 0):
space_node = addnodes.desc_sig_space
keyword_node = addnodes.desc_sig_keyword
+ ObjectDesc = ObjectDescription[Signature]
else:
space_node = Text
keyword_node = addnodes.desc_annotation
+ ObjectDesc = ObjectDescription
def nested_parse(directive: SphinxDirective, content_node: Element) -> None:
diff --git a/docs/sphinx/qapi-domain.py b/docs/sphinx/qapi-domain.py
index 00d32d44e1d..fcda281d45e 100644
--- a/docs/sphinx/qapi-domain.py
+++ b/docs/sphinx/qapi-domain.py
@@ -26,7 +26,9 @@
from compat import (
Field,
GroupedField,
+ ObjectDesc,
ParserFix,
+ Signature,
TypedField,
keyword_node,
nested_parse,
@@ -164,12 +166,7 @@ def since_validator(param: str) -> str:
return param
-# Alias for the return of handle_signature(), which is used in several places.
-# (In the Python domain, this is Tuple[str, str] instead.)
-Signature = str
-
-
-class QAPIObject(ParserFix, ObjectDescription[Signature]):
+class QAPIObject(ParserFix, ObjectDesc):
"""
Description of a generic QAPI object.
--
2.47.0
- [RFC PATCH v2 24/35] docs/qapi-domain: add :unstable: directive option, (continued)
- [RFC PATCH v2 24/35] docs/qapi-domain: add :unstable: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 26/35] docs/qapi-domain: add warnings for malformed field lists, John Snow, 2024/12/12
- [RFC PATCH v2 27/35] docs/qapi-domain: add type cross-refs to field lists, John Snow, 2024/12/12
- [RFC PATCH v2 25/35] docs/qapi-domain: add :ifcond: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 30/35] docs/qapi-domain: implement error context reporting fix, John Snow, 2024/12/12
- [RFC PATCH v2 28/35] docs/qapi-domain: add CSS styling, John Snow, 2024/12/12
- [RFC PATCH v2 29/35] docs/qapi-domain: warn when QAPI domain xrefs fail to resolve, John Snow, 2024/12/12
- [RFC PATCH v2 31/35] docs/qapi-domain: collapsible branches, John Snow, 2024/12/12
- [RFC PATCH v2 32/35] WIP: 3.x - XREF, John Snow, 2024/12/12
- [RFC PATCH v2 35/35] WIP: 3.x css theming for missing xref, John Snow, 2024/12/12
- [RFC PATCH v2 34/35] WIP: 3.x ObjectDesc compat,
John Snow <=
- [RFC PATCH v2 33/35] WIP: 3.x ParserFix, John Snow, 2024/12/12
- [RFC PATCH v2 21/35] docs/qapi-domain: add qapi:struct directive, John Snow, 2024/12/12