1""" 2QAPI domain extension. 3""" 4 5from __future__ import annotations 6 7from typing import ( 8 TYPE_CHECKING, 9 AbstractSet, 10 Any, 11 Dict, 12 Tuple, 13) 14 15from sphinx.domains import Domain, ObjType 16from sphinx.util import logging 17 18 19if TYPE_CHECKING: 20 from sphinx.application import Sphinx 21 22logger = logging.getLogger(__name__) 23 24 25class QAPIDomain(Domain): 26 """QAPI language domain.""" 27 28 name = "qapi" 29 label = "QAPI" 30 31 object_types: Dict[str, ObjType] = {} 32 directives = {} 33 roles = {} 34 initial_data: Dict[str, Dict[str, Tuple[Any]]] = {} 35 indices = [] 36 37 def merge_domaindata( 38 self, docnames: AbstractSet[str], otherdata: Dict[str, Any] 39 ) -> None: 40 pass 41 42 def resolve_any_xref(self, *args: Any, **kwargs: Any) -> Any: 43 # pylint: disable=unused-argument 44 return [] 45 46 47def setup(app: Sphinx) -> Dict[str, Any]: 48 app.setup_extension("sphinx.directives") 49 app.add_domain(QAPIDomain) 50 51 return { 52 "version": "1.0", 53 "env_version": 1, 54 "parallel_read_safe": True, 55 "parallel_write_safe": True, 56 } 57