mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
more cleanups
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict
|
||||||
|
|
||||||
SimpleCookie: Any
|
SimpleCookie: Any
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from datetime import datetime
|
|||||||
from io import BufferedReader, BytesIO
|
from io import BufferedReader, BytesIO
|
||||||
from tempfile import _TemporaryFileWrapper
|
from tempfile import _TemporaryFileWrapper
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
from typing import Any, Callable, Dict, List, Tuple, Union
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
|||||||
|
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
from .base import Variable, VariableDoesNotExist
|
from .base import Variable as Variable, VariableDoesNotExist as VariableDoesNotExist
|
||||||
from .library import Library
|
from .library import Library as Library
|
||||||
|
|
||||||
register: Any
|
register: Any
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ from django.template.base import FilterExpression, Parser, Template
|
|||||||
from django.template.context import Context
|
from django.template.context import Context
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
from .base import Node, Template, token_kwargs
|
from .base import Node, Template
|
||||||
from .exceptions import TemplateSyntaxError
|
from .exceptions import TemplateSyntaxError as TemplateSyntaxError
|
||||||
|
|
||||||
|
|
||||||
class InvalidTemplateLibrary(Exception): ...
|
class InvalidTemplateLibrary(Exception): ...
|
||||||
@@ -58,9 +58,9 @@ class TagHelperNode(Node):
|
|||||||
) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ...
|
) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ...
|
||||||
|
|
||||||
class SimpleNode(TagHelperNode):
|
class SimpleNode(TagHelperNode):
|
||||||
args: List[django.template.base.FilterExpression]
|
args: List[FilterExpression]
|
||||||
func: Callable
|
func: Callable
|
||||||
kwargs: Dict[str, django.template.base.FilterExpression]
|
kwargs: Dict[str, FilterExpression]
|
||||||
origin: django.template.base.Origin
|
origin: django.template.base.Origin
|
||||||
takes_context: Optional[bool]
|
takes_context: Optional[bool]
|
||||||
token: django.template.base.Token
|
token: django.template.base.Token
|
||||||
@@ -76,9 +76,9 @@ class SimpleNode(TagHelperNode):
|
|||||||
def render(self, context: Context) -> str: ...
|
def render(self, context: Context) -> str: ...
|
||||||
|
|
||||||
class InclusionNode(TagHelperNode):
|
class InclusionNode(TagHelperNode):
|
||||||
args: List[django.template.base.FilterExpression]
|
args: List[FilterExpression]
|
||||||
func: Callable
|
func: Callable
|
||||||
kwargs: Dict[str, django.template.base.FilterExpression]
|
kwargs: Dict[str, FilterExpression]
|
||||||
origin: django.template.base.Origin
|
origin: django.template.base.Origin
|
||||||
takes_context: Optional[bool]
|
takes_context: Optional[bool]
|
||||||
token: django.template.base.Token
|
token: django.template.base.Token
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Dict, List, Optional, Union
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.template.backends.django import Template
|
from django.template.backends.django import Template as DjangoTemplate
|
||||||
from django.template.backends.dummy import Template
|
from django.template.backends.dummy import Template as DummyTemplate
|
||||||
from django.template.backends.jinja2 import Template
|
from django.template.backends.jinja2 import Template as Jinja2Template
|
||||||
|
|
||||||
from .exceptions import TemplateDoesNotExist
|
|
||||||
|
|
||||||
|
|
||||||
def get_template(
|
def get_template(
|
||||||
template_name: str, using: Optional[str] = ...
|
template_name: str, using: Optional[str] = ...
|
||||||
) -> Union[Template, Template, Template]: ...
|
) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...
|
||||||
def select_template(
|
def select_template(
|
||||||
template_name_list: Union[List[str], str], using: Optional[str] = ...
|
template_name_list: Union[List[str], str], using: Optional[str] = ...
|
||||||
) -> Union[Template, Template, Template]: ...
|
) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...
|
||||||
def render_to_string(
|
def render_to_string(
|
||||||
template_name: Union[List[str], str],
|
template_name: Union[List[str], str],
|
||||||
context: Optional[Union[Dict[str, bool], Dict[str, str]]] = ...,
|
context: Optional[Union[Dict[str, bool], Dict[str, str]]] = ...,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
|
from django.template import Engine
|
||||||
|
|
||||||
from .filesystem import Loader as FilesystemLoader
|
from .filesystem import Loader as FilesystemLoader
|
||||||
|
|
||||||
|
|
||||||
class Loader(FilesystemLoader):
|
class Loader(FilesystemLoader):
|
||||||
dirs: None
|
dirs: None
|
||||||
engine: django.template.engine.Engine
|
engine: Engine
|
||||||
def get_dirs(self) -> Tuple: ...
|
def get_dirs(self) -> Tuple: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, Iterator, Optional
|
from typing import Dict, Iterator
|
||||||
|
|
||||||
from django.template.base import Origin
|
from django.template.base import Origin
|
||||||
from django.template.engine import Engine
|
from django.template.engine import Engine
|
||||||
@@ -7,7 +7,7 @@ from .base import Loader as BaseLoader
|
|||||||
|
|
||||||
|
|
||||||
class Loader(BaseLoader):
|
class Loader(BaseLoader):
|
||||||
engine: django.template.engine.Engine
|
engine: Engine
|
||||||
templates_dict: Dict[str, str] = ...
|
templates_dict: Dict[str, str] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, engine: Engine, templates_dict: Dict[str, str]
|
self, engine: Engine, templates_dict: Dict[str, str]
|
||||||
|
|||||||
@@ -10,36 +10,25 @@ from django.template.backends.django import Template
|
|||||||
from django.template.backends.jinja2 import Template
|
from django.template.backends.jinja2 import Template
|
||||||
from django.views.generic.base import TemplateResponseMixin
|
from django.views.generic.base import TemplateResponseMixin
|
||||||
|
|
||||||
from .loader import get_template, select_template
|
from .loader import get_template as get_template, select_template as select_template
|
||||||
|
|
||||||
|
|
||||||
class ContentNotRenderedError(Exception): ...
|
class ContentNotRenderedError(Exception): ...
|
||||||
|
|
||||||
class SimpleTemplateResponse(HttpResponse):
|
class SimpleTemplateResponse(HttpResponse):
|
||||||
closed: bool
|
closed: bool
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: SimpleCookie
|
||||||
status_code: int
|
status_code: int
|
||||||
rendering_attrs: Any = ...
|
rendering_attrs: Any = ...
|
||||||
template_name: Union[
|
template_name: Union[
|
||||||
List[str], django.template.backends.django.Template, str
|
List[str], Template, str
|
||||||
] = ...
|
] = ...
|
||||||
context_data: Optional[Dict[str, str]] = ...
|
context_data: Optional[Dict[str, str]] = ...
|
||||||
using: Optional[str] = ...
|
using: Optional[str] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
template: Union[List[str], Template, str],
|
template: Union[List[str], Template, str],
|
||||||
context: Optional[
|
context: Optional[Dict[str, Any]] = ...,
|
||||||
Union[
|
|
||||||
Dict[
|
|
||||||
str, List[Dict[str, Optional[Union[datetime, Model, str]]]]
|
|
||||||
],
|
|
||||||
Dict[str, List[str]],
|
|
||||||
Dict[str, Model],
|
|
||||||
Dict[str, TemplateResponseMixin],
|
|
||||||
Dict[str, str],
|
|
||||||
MagicMock,
|
|
||||||
]
|
|
||||||
] = ...,
|
|
||||||
content_type: Optional[str] = ...,
|
content_type: Optional[str] = ...,
|
||||||
status: Optional[int] = ...,
|
status: Optional[int] = ...,
|
||||||
charset: Optional[str] = ...,
|
charset: Optional[str] = ...,
|
||||||
@@ -50,28 +39,8 @@ class SimpleTemplateResponse(HttpResponse):
|
|||||||
) -> Union[Template, Template]: ...
|
) -> Union[Template, Template]: ...
|
||||||
def resolve_context(
|
def resolve_context(
|
||||||
self,
|
self,
|
||||||
context: Optional[
|
context: Optional[Dict[str, Any]],
|
||||||
Union[
|
) -> Optional[Dict[str, Any]]: ...
|
||||||
Dict[
|
|
||||||
str, List[Dict[str, Optional[Union[datetime, Model, str]]]]
|
|
||||||
],
|
|
||||||
Dict[str, List[str]],
|
|
||||||
Dict[str, Model],
|
|
||||||
Dict[str, TemplateResponseMixin],
|
|
||||||
Dict[str, str],
|
|
||||||
MagicMock,
|
|
||||||
]
|
|
||||||
],
|
|
||||||
) -> Optional[
|
|
||||||
Union[
|
|
||||||
Dict[str, List[Dict[str, Optional[Union[datetime, Model, str]]]]],
|
|
||||||
Dict[str, List[str]],
|
|
||||||
Dict[str, Model],
|
|
||||||
Dict[str, TemplateResponseMixin],
|
|
||||||
Dict[str, str],
|
|
||||||
MagicMock,
|
|
||||||
]
|
|
||||||
]: ...
|
|
||||||
@property
|
@property
|
||||||
def rendered_content(self) -> str: ...
|
def rendered_content(self) -> str: ...
|
||||||
def add_post_render_callback(self, callback: Callable) -> None: ...
|
def add_post_render_callback(self, callback: Callable) -> None: ...
|
||||||
@@ -89,31 +58,8 @@ class TemplateResponse(SimpleTemplateResponse):
|
|||||||
client: django.test.client.Client
|
client: django.test.client.Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: django.template.context.RequestContext
|
context: django.template.context.RequestContext
|
||||||
context_data: Optional[
|
context_data: Optional[Dict[str, Any]]
|
||||||
Union[
|
cookies: SimpleCookie
|
||||||
Dict[
|
|
||||||
str,
|
|
||||||
List[
|
|
||||||
Dict[
|
|
||||||
str,
|
|
||||||
Optional[
|
|
||||||
Union[
|
|
||||||
datetime.datetime,
|
|
||||||
django.db.models.base.Model,
|
|
||||||
str,
|
|
||||||
]
|
|
||||||
],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
],
|
|
||||||
Dict[str, List[str]],
|
|
||||||
Dict[str, django.db.models.base.Model],
|
|
||||||
Dict[str, django.views.generic.base.TemplateResponseMixin],
|
|
||||||
Dict[str, str],
|
|
||||||
unittest.mock.MagicMock,
|
|
||||||
]
|
|
||||||
]
|
|
||||||
cookies: http.cookies.SimpleCookie
|
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
redirect_chain: List[Tuple[str, int]]
|
redirect_chain: List[Tuple[str, int]]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import collections
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Tuple, Union
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.template.backends.base import BaseEngine
|
from django.template.backends.base import BaseEngine
|
||||||
|
|||||||
Reference in New Issue
Block a user