"""
This type stub file was generated by pyright.
"""

import re
from __future__ import annotations
from typing import Any, TYPE_CHECKING, cast
from docutils import nodes
from docutils.nodes import Element, Node
from sphinx import addnodes
from sphinx.errors import NoUri
from sphinx.locale import __
from sphinx.transforms import SphinxTransform
from sphinx.util import logging
from sphinx.util.docutils import SphinxTranslator
from sphinx.util.nodes import find_pending_xref_condition, process_only_nodes
from collections.abc import Sequence
from sphinx.addnodes import pending_xref
from sphinx.application import Sphinx
from sphinx.domains import Domain

"""Docutils transforms used by Sphinx."""
if TYPE_CHECKING:
    ...
logger = ...
class SphinxPostTransform(SphinxTransform):
    """A base class of post-transforms.

    Post transforms are invoked to modify the document to restructure it for outputting.
    They resolve references, convert images, do special transformation for each output
    formats and so on.  This class helps to implement these post transforms.
    """
    builders: tuple[str, ...] = ...
    formats: tuple[str, ...] = ...
    def apply(self, **kwargs: Any) -> None:
        ...
    
    def is_supported(self) -> bool:
        """Check this transform working for current builder."""
        ...
    
    def run(self, **kwargs: Any) -> None:
        """Main method of post transforms.

        Subclasses should override this method instead of ``apply()``.
        """
        ...
    


class ReferencesResolver(SphinxPostTransform):
    """
    Resolves cross-references on doctrees.
    """
    default_priority = ...
    def run(self, **kwargs: Any) -> None:
        ...
    
    def resolve_anyref(self, refdoc: str, node: pending_xref, contnode: Element) -> Element | None:
        """Resolve reference generated by the "any" role."""
        ...
    
    def warn_missing_reference(self, refdoc: str, typ: str, target: str, node: pending_xref, domain: Domain | None) -> None:
        ...
    
    def find_pending_xref_condition(self, node: pending_xref, conditions: Sequence[str]) -> list[Node] | None:
        ...
    


class OnlyNodeTransform(SphinxPostTransform):
    default_priority = ...
    def run(self, **kwargs: Any) -> None:
        ...
    


class SigElementFallbackTransform(SphinxPostTransform):
    """Fallback various desc_* nodes to inline if translator does not support them."""
    default_priority = ...
    def run(self, **kwargs: Any) -> None:
        ...
    
    def fallback(self, node_type: Any) -> None:
        """Translate nodes of type *node_type* to docutils inline nodes.

        The original node type name is stored as a string in a private
        ``_sig_node_type`` attribute if the latter did not exist.
        """
        ...
    


class PropagateDescDomain(SphinxPostTransform):
    """Add the domain name of the parent node as a class in each desc_signature node."""
    default_priority = ...
    def run(self, **kwargs: Any) -> None:
        ...
    


def setup(app: Sphinx) -> dict[str, Any]:
    ...

