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

import os
from os import getenv
from typing import Any, TYPE_CHECKING
from docutils import nodes
from sphinx.builders import Builder
from sphinx.util.i18n import CatalogInfo
from sphinx.util.tags import Tags
from sphinx.util.template import SphinxRenderer
from collections.abc import Generator, Iterable
from docutils.nodes import Element
from sphinx.application import Sphinx

"""The MessageCatalogBuilder class."""
if TYPE_CHECKING:
    ...
logger = ...
class Message:
    """An entry of translatable message."""
    def __init__(self, text: str, locations: list[tuple[str, int]], uuids: list[str]) -> None:
        ...
    


class Catalog:
    """Catalog of translatable messages."""
    def __init__(self) -> None:
        ...
    
    def add(self, msg: str, origin: Element | MsgOrigin) -> None:
        ...
    
    def __iter__(self) -> Generator[Message, None, None]:
        ...
    


class MsgOrigin:
    """
    Origin holder for Catalog message origin.
    """
    def __init__(self, source: str, line: int) -> None:
        ...
    


class GettextRenderer(SphinxRenderer):
    def __init__(self, template_path: list[str | os.PathLike[str]] | None = ..., outdir: str | os.PathLike[str] | None = ...) -> None:
        ...
    
    def render(self, filename: str, context: dict[str, Any]) -> str:
        ...
    


class I18nTags(Tags):
    """Dummy tags module for I18nBuilder.

    To translate all text inside of only nodes, this class
    always returns True value even if no tags are defined.
    """
    def eval_condition(self, condition: Any) -> bool:
        ...
    


class I18nBuilder(Builder):
    """
    General i18n builder.
    """
    name = ...
    versioning_method = ...
    use_message_catalog = ...
    def init(self) -> None:
        ...
    
    def get_target_uri(self, docname: str, typ: str | None = ...) -> str:
        ...
    
    def get_outdated_docs(self) -> set[str]:
        ...
    
    def prepare_writing(self, docnames: set[str]) -> None:
        ...
    
    def compile_catalogs(self, catalogs: set[CatalogInfo], message: str) -> None:
        ...
    
    def write_doc(self, docname: str, doctree: nodes.document) -> None:
        ...
    


if source_date_epoch := getenv('SOURCE_DATE_EPOCH') is not None:
    timestamp = ...
else:
    timestamp = ...
ctime = ...
def should_write(filepath: str, new_content: str) -> bool:
    ...

class MessageCatalogBuilder(I18nBuilder):
    """
    Builds gettext-style message catalogs (.pot files).
    """
    name = ...
    epilog = ...
    def init(self) -> None:
        ...
    
    def build(self, docnames: Iterable[str] | None, summary: str | None = ..., method: str = ...) -> None:
        ...
    
    def finish(self) -> None:
        ...
    


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

