Skip to content

Add stubs for chevron package #7139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stubs/chevron/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "0.14.*"
5 changes: 5 additions & 0 deletions stubs/chevron/chevron/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions stubs/chevron/chevron/main.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
1 change: 1 addition & 0 deletions stubs/chevron/chevron/metadata.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: str
17 changes: 17 additions & 0 deletions stubs/chevron/chevron/renderer.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
11 changes: 11 additions & 0 deletions stubs/chevron/chevron/tokenizer.pyi
Original file line number Diff line number Diff line change
@@ -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