Add stubs for chevron package (#7139)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Fares Ahmed
2022-02-05 21:38:19 +02:00
committed by GitHub
parent c42bfc5710
commit 62e33cbbd5
6 changed files with 42 additions and 0 deletions

1
stubs/chevron/METADATA.toml Executable file
View File

@@ -0,0 +1 @@
version = "0.14.*"

View File

@@ -0,0 +1,5 @@
from .main import cli_main as cli_main, main as main
from .renderer import render as render
from .tokenizer import ChevronError as ChevronError
__all__ = ["main", "render", "cli_main", "ChevronError"]

7
stubs/chevron/chevron/main.pyi Executable file
View File

@@ -0,0 +1,7 @@
from _typeshed import StrOrBytesPath
from typing import Any
_OpenFile = StrOrBytesPath | int
def main(template: _OpenFile, data: _OpenFile | None = ..., **kwargs: Any) -> str: ...
def cli_main() -> None: ...

View File

@@ -0,0 +1 @@
version: str

View File

@@ -0,0 +1,17 @@
from _typeshed import StrPath, SupportsRead
from typing import Any, MutableSequence, Sequence
g_token_cache: dict[str, list[tuple[str, str]]] # undocumented
def render(
template: SupportsRead[str] | str | Sequence[tuple[str, str]] = ...,
data: dict[str, Any] = ...,
partials_path: StrPath | None = ...,
partials_ext: str = ...,
partials_dict: dict[str, str] = ...,
padding: str = ...,
def_ldel: str | None = ...,
def_rdel: str | None = ...,
scopes: MutableSequence[int] | None = ...,
warn: bool = ...,
) -> str: ...

View File

@@ -0,0 +1,11 @@
from typing import Iterator
class ChevronError(SyntaxError): ...
def grab_literal(template: str, l_del: str | None) -> tuple[str, str]: ... # undocumented
def l_sa_check(template: str, literal: str, is_standalone: bool) -> bool | None: ... # undocumented
def r_sa_check(template: str, tag_type: str, is_standalone: bool) -> bool: ... # undocumented
def parse_tag(template: str, l_del: str | None, r_del: str | None) -> tuple[tuple[str, str], str]: ... # undocumented
def tokenize(
template: str, def_ldel: str | None = ..., def_rdel: str | None = ...
) -> Iterator[tuple[str, str]]: ... # undocumented