Skip to content
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

Improve django.template #210

Merged
merged 5 commits into from
Nov 10, 2023
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
5 changes: 3 additions & 2 deletions django-stubs/template/loader.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from typing import Any

from django.http.request import HttpRequest
from django.template.base import Template
from django.template.exceptions import ( # noqa: F401
TemplateDoesNotExist as TemplateDoesNotExist,
)

from . import engines as engines # noqa: F401

def get_template(template_name: str, using: str | None = ...) -> Any: ...
def get_template(template_name: str, using: str | None = ...) -> Template: ...
def select_template(
template_name_list: list[str] | str, using: str | None = ...
) -> Any: ...
) -> Template: ...
def render_to_string(
template_name: list[str] | str,
context: dict[str, Any] | None = ...,
Expand Down
10 changes: 6 additions & 4 deletions django-stubs/template/utils.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import collections
from collections.abc import Iterator
from pathlib import Path
from typing import Any

from django.core.exceptions import ImproperlyConfigured
Expand All @@ -7,10 +8,11 @@ from django.template.backends.base import BaseEngine
class InvalidTemplateEngineError(ImproperlyConfigured): ...

class EngineHandler:
templates: collections.OrderedDict[Any, Any]
def __init__(self, templates: list[dict[str, Any]] = ...) -> None: ...
@property
def templates(self) -> dict[str, dict[str, Any]]: ...
def __getitem__(self, alias: str) -> BaseEngine: ...
def __iter__(self) -> Any: ...
def __iter__(self) -> Iterator[BaseEngine]: ...
def all(self) -> list[BaseEngine]: ...

def get_app_template_dirs(dirname: str) -> tuple[Any, ...]: ...
def get_app_template_dirs(dirname: str) -> tuple[Path, ...]: ...