mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 08:47:49 +08:00
initial commit
This commit is contained in:
102
django/template/context.pyi
Normal file
102
django/template/context.pyi
Normal file
@@ -0,0 +1,102 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.base import (
|
||||
Origin,
|
||||
Template,
|
||||
)
|
||||
from django.template.defaulttags import CycleNode
|
||||
from django.template.library import InclusionNode
|
||||
from django.template.loader_tags import BlockContext
|
||||
from itertools import cycle
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def make_context(
|
||||
context: Any,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
**kwargs
|
||||
) -> Context: ...
|
||||
|
||||
|
||||
class BaseContext:
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __copy__(self) -> BaseContext: ...
|
||||
def __eq__(self, other: Context) -> bool: ...
|
||||
def __getitem__(self, key: Union[str, int]) -> Any: ...
|
||||
def __init__(self, dict_: Any = ...) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __setitem__(
|
||||
self,
|
||||
key: Union[str, CycleNode, InclusionNode],
|
||||
value: Any
|
||||
) -> None: ...
|
||||
def _reset_dicts(self, value: Any = ...) -> None: ...
|
||||
def flatten(self) -> Dict[str, Union[None, int, str, Dict[str, Union[Type[object], str]]]]: ...
|
||||
def get(self, key: str, otherwise: Optional[int] = ...) -> Any: ...
|
||||
def new(self, values: Any = ...) -> Context: ...
|
||||
def pop(self) -> ContextDict: ...
|
||||
def push(self, *args, **kwargs) -> ContextDict: ...
|
||||
def set_upward(self, key: str, value: Union[str, int]) -> None: ...
|
||||
def setdefault(
|
||||
self,
|
||||
key: str,
|
||||
default: Union[List[Origin], int] = ...
|
||||
) -> Union[List[Origin], int]: ...
|
||||
|
||||
|
||||
class Context:
|
||||
def __copy__(self) -> Context: ...
|
||||
def __init__(
|
||||
self,
|
||||
dict_: Any = ...,
|
||||
autoescape: bool = ...,
|
||||
use_l10n: Optional[bool] = ...,
|
||||
use_tz: None = ...
|
||||
) -> None: ...
|
||||
def bind_template(self, template: Template) -> Iterator[None]: ...
|
||||
def update(self, other_dict: Dict[str, Any]) -> ContextDict: ...
|
||||
|
||||
|
||||
class ContextDict:
|
||||
def __enter__(self) -> ContextDict: ...
|
||||
def __exit__(self, *args, **kwargs) -> None: ...
|
||||
def __init__(self, context: BaseContext, *args, **kwargs) -> None: ...
|
||||
|
||||
|
||||
class RenderContext:
|
||||
def __contains__(self, key: Union[str, CycleNode]) -> bool: ...
|
||||
def __getitem__(
|
||||
self,
|
||||
key: Union[str, CycleNode]
|
||||
) -> Union[List[Origin], BlockContext, cycle]: ...
|
||||
def __iter__(self): ...
|
||||
def get(
|
||||
self,
|
||||
key: Union[str, InclusionNode],
|
||||
otherwise: None = ...
|
||||
) -> Optional[Union[BlockContext, Template]]: ...
|
||||
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
|
||||
|
||||
|
||||
class RequestContext:
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
dict_: None = ...,
|
||||
processors: Optional[List[Callable]] = ...,
|
||||
use_l10n: None = ...,
|
||||
use_tz: None = ...,
|
||||
autoescape: bool = ...
|
||||
) -> None: ...
|
||||
def bind_template(self, template: Template) -> Iterator[None]: ...
|
||||
def new(self, values: Any = ...) -> RequestContext: ...
|
||||
Reference in New Issue
Block a user