mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 13:04:47 +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
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ from datetime import datetime
|
||||
from io import BufferedReader, BytesIO
|
||||
from tempfile import _TemporaryFileWrapper
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django.core.files.base import ContentFile
|
||||
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.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 .base import Variable, VariableDoesNotExist
|
||||
from .library import Library
|
||||
from .base import Variable as Variable, VariableDoesNotExist as VariableDoesNotExist
|
||||
from .library import Library as Library
|
||||
|
||||
register: Any
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ from django.template.base import FilterExpression, Parser, Template
|
||||
from django.template.context import Context
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Node, Template, token_kwargs
|
||||
from .exceptions import TemplateSyntaxError
|
||||
from .base import Node, Template
|
||||
from .exceptions import TemplateSyntaxError as TemplateSyntaxError
|
||||
|
||||
|
||||
class InvalidTemplateLibrary(Exception): ...
|
||||
@@ -58,9 +58,9 @@ class TagHelperNode(Node):
|
||||
) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ...
|
||||
|
||||
class SimpleNode(TagHelperNode):
|
||||
args: List[django.template.base.FilterExpression]
|
||||
args: List[FilterExpression]
|
||||
func: Callable
|
||||
kwargs: Dict[str, django.template.base.FilterExpression]
|
||||
kwargs: Dict[str, FilterExpression]
|
||||
origin: django.template.base.Origin
|
||||
takes_context: Optional[bool]
|
||||
token: django.template.base.Token
|
||||
@@ -76,9 +76,9 @@ class SimpleNode(TagHelperNode):
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class InclusionNode(TagHelperNode):
|
||||
args: List[django.template.base.FilterExpression]
|
||||
args: List[FilterExpression]
|
||||
func: Callable
|
||||
kwargs: Dict[str, django.template.base.FilterExpression]
|
||||
kwargs: Dict[str, FilterExpression]
|
||||
origin: django.template.base.Origin
|
||||
takes_context: Optional[bool]
|
||||
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.template.backends.django import Template
|
||||
from django.template.backends.dummy import Template
|
||||
from django.template.backends.jinja2 import Template
|
||||
|
||||
from .exceptions import TemplateDoesNotExist
|
||||
from django.template.backends.django import Template as DjangoTemplate
|
||||
from django.template.backends.dummy import Template as DummyTemplate
|
||||
from django.template.backends.jinja2 import Template as Jinja2Template
|
||||
|
||||
|
||||
def get_template(
|
||||
template_name: str, using: Optional[str] = ...
|
||||
) -> Union[Template, Template, Template]: ...
|
||||
) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...
|
||||
def select_template(
|
||||
template_name_list: Union[List[str], str], using: Optional[str] = ...
|
||||
) -> Union[Template, Template, Template]: ...
|
||||
) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...
|
||||
def render_to_string(
|
||||
template_name: Union[List[str], str],
|
||||
context: Optional[Union[Dict[str, bool], Dict[str, str]]] = ...,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from django.template import Engine
|
||||
|
||||
from .filesystem import Loader as FilesystemLoader
|
||||
|
||||
|
||||
class Loader(FilesystemLoader):
|
||||
dirs: None
|
||||
engine: django.template.engine.Engine
|
||||
engine: Engine
|
||||
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.engine import Engine
|
||||
@@ -7,7 +7,7 @@ from .base import Loader as BaseLoader
|
||||
|
||||
|
||||
class Loader(BaseLoader):
|
||||
engine: django.template.engine.Engine
|
||||
engine: Engine
|
||||
templates_dict: Dict[str, str] = ...
|
||||
def __init__(
|
||||
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.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 SimpleTemplateResponse(HttpResponse):
|
||||
closed: bool
|
||||
cookies: http.cookies.SimpleCookie
|
||||
cookies: SimpleCookie
|
||||
status_code: int
|
||||
rendering_attrs: Any = ...
|
||||
template_name: Union[
|
||||
List[str], django.template.backends.django.Template, str
|
||||
List[str], Template, str
|
||||
] = ...
|
||||
context_data: Optional[Dict[str, str]] = ...
|
||||
using: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
template: Union[List[str], Template, str],
|
||||
context: 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,
|
||||
]
|
||||
] = ...,
|
||||
context: Optional[Dict[str, Any]] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Optional[int] = ...,
|
||||
charset: Optional[str] = ...,
|
||||
@@ -50,28 +39,8 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
) -> Union[Template, Template]: ...
|
||||
def resolve_context(
|
||||
self,
|
||||
context: 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,
|
||||
]
|
||||
],
|
||||
) -> 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,
|
||||
]
|
||||
]: ...
|
||||
context: Optional[Dict[str, Any]],
|
||||
) -> Optional[Dict[str, Any]]: ...
|
||||
@property
|
||||
def rendered_content(self) -> str: ...
|
||||
def add_post_render_callback(self, callback: Callable) -> None: ...
|
||||
@@ -89,31 +58,8 @@ class TemplateResponse(SimpleTemplateResponse):
|
||||
client: django.test.client.Client
|
||||
closed: bool
|
||||
context: django.template.context.RequestContext
|
||||
context_data: Optional[
|
||||
Union[
|
||||
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
|
||||
context_data: Optional[Dict[str, Any]]
|
||||
cookies: SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
redirect_chain: List[Tuple[str, int]]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import collections
|
||||
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.template.backends.base import BaseEngine
|
||||
|
||||
Reference in New Issue
Block a user