|
| 1 | +# File generated with docstub |
| 2 | + |
| 3 | +import enum |
| 4 | +import keyword |
| 5 | +import logging |
| 6 | +from collections.abc import Generator, Iterable, Sequence |
| 7 | +from dataclasses import dataclass |
| 8 | +from pathlib import Path |
| 9 | +from textwrap import indent |
| 10 | +from typing import Any, Final |
| 11 | + |
| 12 | +import lark |
| 13 | +import lark.visitors |
| 14 | +from _typeshed import Incomplete |
| 15 | + |
| 16 | +from ._utils import DocstubError |
| 17 | + |
| 18 | +logger: Final |
| 19 | + |
| 20 | +grammar_path: Final |
| 21 | + |
| 22 | +with grammar_path.open() as file: |
| 23 | + _grammar: Final |
| 24 | + |
| 25 | +_lark: Final |
| 26 | + |
| 27 | +def flatten_recursive(iterable: Iterable[Iterable | str]) -> Generator[str]: ... |
| 28 | +def insert_between(iterable: Iterable, *, sep: Any) -> list[Any]: ... |
| 29 | + |
| 30 | +class TermKind(enum.StrEnum): |
| 31 | + |
| 32 | + NAME = enum.auto() |
| 33 | + LITERAL = enum.auto() |
| 34 | + SYNTAX = enum.auto() |
| 35 | + |
| 36 | +class Term(str): |
| 37 | + |
| 38 | + __slots__: Final |
| 39 | + |
| 40 | + def __new__( |
| 41 | + cls, value: str, *, kind: TermKind | str, pos: tuple[int, int] | None = ... |
| 42 | + ) -> None: ... |
| 43 | + def __repr__(self) -> str: ... |
| 44 | + def __getnewargs_ex__(self) -> tuple[tuple[Any, ...], dict[str, Any]]: ... |
| 45 | + |
| 46 | +@dataclass(slots=True) |
| 47 | +class Expr: |
| 48 | + |
| 49 | + rule: str |
| 50 | + children: list[Expr | Term] |
| 51 | + |
| 52 | + @property |
| 53 | + def terms(self) -> list[Term]: ... |
| 54 | + @property |
| 55 | + def names(self) -> list[Term]: ... |
| 56 | + def __iter__(self) -> Generator[Expr | Term]: ... |
| 57 | + def format_tree(self) -> str: ... |
| 58 | + def __repr__(self) -> str: ... |
| 59 | + def __str__(self) -> str: ... |
| 60 | + def as_code(self) -> str: ... |
| 61 | + |
| 62 | +BLACKLISTED_QUALNAMES: Final |
| 63 | + |
| 64 | +class BlacklistedQualname(DocstubError): |
| 65 | + pass |
| 66 | + |
| 67 | +class DoctypeTransformer(lark.visitors.Transformer): |
| 68 | + def start(self, tree: lark.Tree) -> Expr: ... |
| 69 | + def qualname(self, tree: lark.Tree) -> Term: ... |
| 70 | + def ELLIPSES(self, token: lark.Token) -> Term: ... |
| 71 | + def union(self, tree: lark.Tree) -> Expr: ... |
| 72 | + def subscription(self, tree: lark.Tree) -> Expr: ... |
| 73 | + def natlang_literal(self, tree: lark.Tree) -> Expr: ... |
| 74 | + def literal_item(self, tree: lark.Tree) -> Term: ... |
| 75 | + def natlang_container(self, tree: lark.Tree) -> Expr: ... |
| 76 | + def natlang_array(self, tree: lark.Tree) -> Expr: ... |
| 77 | + def array_name(self, tree: lark.Tree) -> Term: ... |
| 78 | + def dtype(self, tree: lark.Tree) -> Expr: ... |
| 79 | + def shape(self, tree: lark.Tree) -> lark.visitors._DiscardType: ... |
| 80 | + def optional_info(self, tree: lark.Tree) -> lark.visitors._DiscardType: ... |
| 81 | + def extra_info(self, tree: lark.Tree) -> lark.visitors._DiscardType: ... |
| 82 | + def _format_subscription( |
| 83 | + self, sequence: Sequence[str], rule: str = ... |
| 84 | + ) -> Expr: ... |
| 85 | + |
| 86 | +_transformer: Final |
| 87 | + |
| 88 | +def parse_doctype(doctype: str) -> Expr: ... |
0 commit comments