mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 00:37:11 +08:00
enable 6 more test folders
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Optional
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
from django.template.base import Parser, Token
|
||||
from django.template.context import Context
|
||||
|
||||
@@ -32,9 +32,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
|
||||
def get_form_class(self) -> Type[AuthenticationForm]: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[str, str], HttpRequest, MultiValueDict]]]: ...
|
||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(
|
||||
self, **kwargs: Any
|
||||
) -> Dict[str, Union[AuthenticationForm, LoginView, Site, RequestSite, str]]: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
|
||||
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||
next_page: Any = ...
|
||||
|
||||
@@ -7,4 +7,4 @@ class Redirect(models.Model):
|
||||
site_id: int
|
||||
site: Any = ...
|
||||
old_path: str = ...
|
||||
new_path: str = ...
|
||||
new_path: str = ...
|
||||
|
||||
@@ -23,5 +23,5 @@ class Feed:
|
||||
def feed_extra_kwargs(self, obj: None) -> Dict[Any, Any]: ...
|
||||
def item_extra_kwargs(self, item: Model) -> Dict[Any, Any]: ...
|
||||
def get_object(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> None: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Model]: ...
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
def get_feed(self, obj: None, request: WSGIRequest) -> SyndicationFeed: ...
|
||||
|
||||
@@ -3,7 +3,8 @@ from io import BytesIO
|
||||
from typing import Any, Dict
|
||||
from wsgiref import simple_server
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.handlers.wsgi import WSGIRequest, WSGIHandler
|
||||
from django.core.wsgi import get_wsgi_application as get_wsgi_application
|
||||
|
||||
class WSGIServer(simple_server.WSGIServer):
|
||||
request_queue_size: int = ...
|
||||
@@ -31,3 +32,5 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
|
||||
requestline: str = ...
|
||||
request_version: str = ...
|
||||
def handle(self) -> None: ...
|
||||
|
||||
def get_internal_wsgi_application() -> WSGIHandler: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Type, Union
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Dict, List, Optional, Type, Union, Protocol
|
||||
|
||||
from django.contrib.sessions.serializers import PickleSerializer
|
||||
|
||||
@@ -11,38 +11,30 @@ def b64_decode(s: bytes) -> bytes: ...
|
||||
def base64_hmac(salt: str, value: Union[bytes, str], key: Union[bytes, str]) -> str: ...
|
||||
def get_cookie_signer(salt: str = ...) -> TimestampSigner: ...
|
||||
|
||||
class Serializer(Protocol):
|
||||
def dumps(self, obj: Any) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Any: ...
|
||||
|
||||
class JSONSerializer:
|
||||
def dumps(self, obj: Union[Dict[str, Union[int, str]], List[str], str]) -> bytes: ...
|
||||
def dumps(self, obj: Any) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[int, str]]: ...
|
||||
|
||||
def dumps(
|
||||
obj: Union[Dict[str, Union[datetime, str]], List[str], str],
|
||||
key: None = ...,
|
||||
salt: str = ...,
|
||||
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
|
||||
compress: bool = ...,
|
||||
obj: Any, key: None = ..., salt: str = ..., serializer: Type[Serializer] = ..., compress: bool = ...
|
||||
) -> str: ...
|
||||
def loads(
|
||||
s: str,
|
||||
key: None = ...,
|
||||
salt: str = ...,
|
||||
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
|
||||
max_age: Optional[int] = ...,
|
||||
) -> Union[Dict[str, Union[datetime, str]], Dict[str, Union[int, str]], List[str], str]: ...
|
||||
s: str, key: None = ..., salt: str = ..., serializer: Type[Serializer] = ..., max_age: Optional[int] = ...
|
||||
) -> Any: ...
|
||||
|
||||
class Signer:
|
||||
key: str = ...
|
||||
sep: str = ...
|
||||
salt: Any = ...
|
||||
salt: str = ...
|
||||
def __init__(self, key: Optional[Union[bytes, str]] = ..., sep: str = ..., salt: Optional[str] = ...) -> None: ...
|
||||
def signature(self, value: Union[bytes, str]) -> str: ...
|
||||
def sign(self, value: str) -> str: ...
|
||||
def unsign(self, signed_value: str) -> str: ...
|
||||
|
||||
class TimestampSigner(Signer):
|
||||
key: str
|
||||
salt: str
|
||||
sep: str
|
||||
def timestamp(self) -> str: ...
|
||||
def sign(self, value: str) -> str: ...
|
||||
def unsign(self, value: str, max_age: Optional[int] = ...) -> str: ...
|
||||
def unsign(self, value: str, max_age: Optional[Union[int, timedelta]] = ...) -> str: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ from django.urls import ResolverMatch
|
||||
|
||||
class BadHeaderError(ValueError): ...
|
||||
|
||||
class HttpResponseBase:
|
||||
class HttpResponseBase(Iterable[AnyStr]):
|
||||
status_code: int = ...
|
||||
cookies: SimpleCookie = ...
|
||||
reason_phrase: str = ...
|
||||
@@ -60,7 +60,7 @@ class HttpResponseBase:
|
||||
def seekable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def writelines(self, lines: Iterable[object]): ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||
|
||||
class HttpResponse(HttpResponseBase):
|
||||
client: Client
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from enum import Enum
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Tuple, Type, Union
|
||||
|
||||
from django.template.context import Context
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.context import Context as Context
|
||||
from django.template.engine import Engine
|
||||
from django.template.library import Library
|
||||
from django.template.loaders.base import Loader
|
||||
@@ -58,11 +59,9 @@ class Template:
|
||||
engine: Optional[Engine] = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def render(self, context: Context) -> Any: ...
|
||||
def render(self, context: Union[Context, Dict[str, Any]], request: Optional[HttpRequest] = ...) -> Any: ...
|
||||
def compile_nodelist(self) -> NodeList: ...
|
||||
def get_exception_info(
|
||||
self, exception: Exception, token: Token
|
||||
) -> Dict[str, Union[List[Tuple[int, SafeText]], int, str]]: ...
|
||||
def get_exception_info(self, exception: Exception, token: Token) -> Dict[str, Any]: ...
|
||||
|
||||
def linebreak_iter(template_source: str) -> Iterator[int]: ...
|
||||
|
||||
@@ -141,7 +140,7 @@ class Variable:
|
||||
translate: bool = ...
|
||||
message_context: Optional[str] = ...
|
||||
def __init__(self, var: Union[Dict[Any, Any], str]) -> None: ...
|
||||
def resolve(self, context: Union[Dict[str, Dict[str, Union[int, str]]], Context, int, str]) -> Any: ...
|
||||
def resolve(self, context: Union[Mapping[str, Mapping[str, Any]], Context, int, str]) -> Any: ...
|
||||
|
||||
class Node:
|
||||
must_be_first: bool = ...
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
from datetime import _date, datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
||||
from datetime import date as _date, datetime, time as _time
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Variable as Variable, VariableDoesNotExist as VariableDoesNotExist
|
||||
from .library import Library as Library
|
||||
from django.utils.html import escape as escape
|
||||
|
||||
register: Any
|
||||
|
||||
@@ -14,7 +11,7 @@ def addslashes(value: str) -> str: ...
|
||||
def capfirst(value: str) -> str: ...
|
||||
def escapejs_filter(value: str) -> SafeText: ...
|
||||
def json_script(value: Dict[str, str], element_id: SafeText) -> SafeText: ...
|
||||
def floatformat(text: Optional[Union[Decimal, float, str]], arg: Union[int, str] = ...) -> str: ...
|
||||
def floatformat(text: Optional[Any], arg: Union[int, str] = ...) -> str: ...
|
||||
def iriencode(value: str) -> str: ...
|
||||
def linenumbers(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
def lower(value: str) -> str: ...
|
||||
@@ -43,41 +40,20 @@ def linebreaksbr(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
def safe(value: str) -> SafeText: ...
|
||||
def safeseq(value: List[str]) -> List[SafeText]: ...
|
||||
def striptags(value: str) -> str: ...
|
||||
def dictsort(
|
||||
value: Union[
|
||||
Dict[str, int],
|
||||
List[Dict[str, Dict[str, Union[int, str]]]],
|
||||
List[Dict[str, str]],
|
||||
List[Tuple[str, str]],
|
||||
List[int],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
arg: Union[int, str],
|
||||
) -> Union[List[Dict[str, Dict[str, Union[int, str]]]], List[Dict[str, str]], List[Tuple[str, str]], str]: ...
|
||||
def dictsortreversed(
|
||||
value: Union[Dict[str, int], List[Dict[str, Union[int, str]]], List[Tuple[str, str]], List[int], int, str],
|
||||
arg: Union[int, str],
|
||||
) -> Union[List[Dict[str, Union[int, str]]], List[Tuple[str, str]], str]: ...
|
||||
def first(value: Union[List[int], List[str], str]) -> Union[int, str]: ...
|
||||
def dictsort(value: Any, arg: Union[int, str]) -> Any: ...
|
||||
def dictsortreversed(value: Any, arg: Union[int, str]) -> Any: ...
|
||||
def first(value: Any) -> Any: ...
|
||||
def join(value: Any, arg: str, autoescape: bool = ...) -> Any: ...
|
||||
def last(value: List[str]) -> str: ...
|
||||
def length(value: Any) -> int: ...
|
||||
def length_is(
|
||||
value: Optional[Union[List[Callable], Tuple[str, str], int, str]], arg: Union[SafeText, int]
|
||||
) -> Union[bool, str]: ...
|
||||
def length_is(value: Optional[Any], arg: Union[SafeText, int]) -> Union[bool, str]: ...
|
||||
def random(value: List[str]) -> str: ...
|
||||
def slice_filter(value: Any, arg: str) -> Any: ...
|
||||
def unordered_list(
|
||||
value: Union[Iterator[Any], List[Union[List[Union[List[Union[List[str], str]], str]], str]]], autoescape: bool = ...
|
||||
) -> SafeText: ...
|
||||
def add(
|
||||
value: Union[List[int], Tuple[int, int], _date, int, str],
|
||||
arg: Union[List[int], Tuple[int, int], timedelta, int, str],
|
||||
) -> Union[List[int], Tuple[int, int, int, int], _date, int, str]: ...
|
||||
def get_digit(value: Union[int, str], arg: int) -> Union[int, str]: ...
|
||||
def unordered_list(value: Any, autoescape: bool = ...) -> Any: ...
|
||||
def add(value: Any, arg: Any) -> Any: ...
|
||||
def get_digit(value: Any, arg: int) -> Any: ...
|
||||
def date(value: Optional[Union[_date, datetime, str]], arg: Optional[str] = ...) -> str: ...
|
||||
def time(value: Optional[Union[datetime, str]], arg: Optional[str] = ...) -> str: ...
|
||||
def time(value: Optional[Union[datetime, _time, str]], arg: Optional[str] = ...) -> str: ...
|
||||
def timesince_filter(value: Optional[_date], arg: Optional[_date] = ...) -> str: ...
|
||||
def timeuntil_filter(value: Optional[_date], arg: Optional[_date] = ...) -> str: ...
|
||||
def default(value: Optional[Union[int, str]], arg: Union[int, str]) -> Union[int, str]: ...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from collections import namedtuple
|
||||
from datetime import date
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
from django.template.base import FilterExpression, Parser, Token
|
||||
from django.template.context import RequestContext, Context
|
||||
from django.template.context import Context
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Node, NodeList
|
||||
@@ -153,9 +153,13 @@ class WidthRatioNode(Node):
|
||||
|
||||
class WithNode(Node):
|
||||
nodelist: NodeList = ...
|
||||
extra_context: Dict[str, Union[FilterExpression, str]] = ...
|
||||
extra_context: Dict[str, Any] = ...
|
||||
def __init__(
|
||||
self, var: Optional[str], name: Optional[str], nodelist: NodeList, extra_context: Optional[Dict[str, Any]] = ...
|
||||
self,
|
||||
var: Optional[str],
|
||||
name: Optional[str],
|
||||
nodelist: Union[NodeList, Sequence[Node]],
|
||||
extra_context: Optional[Dict[str, Any]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence
|
||||
|
||||
from django.template.base import Origin
|
||||
from django.template.library import Library
|
||||
@@ -7,6 +7,8 @@ from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Template
|
||||
|
||||
_Loader = Any
|
||||
|
||||
class Engine:
|
||||
template_context_processors: Tuple[Callable]
|
||||
template_loaders: List[Loader]
|
||||
@@ -16,7 +18,7 @@ class Engine:
|
||||
autoescape: bool = ...
|
||||
context_processors: Union[List[str], Tuple[str]] = ...
|
||||
debug: bool = ...
|
||||
loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]] = ...
|
||||
loaders: Sequence[_Loader] = ...
|
||||
string_if_invalid: str = ...
|
||||
file_charset: str = ...
|
||||
libraries: Dict[str, str] = ...
|
||||
@@ -29,7 +31,7 @@ class Engine:
|
||||
app_dirs: bool = ...,
|
||||
context_processors: Optional[Union[List[str], Tuple[str]]] = ...,
|
||||
debug: bool = ...,
|
||||
loaders: Optional[Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]]] = ...,
|
||||
loaders: Optional[Sequence[_Loader]] = ...,
|
||||
string_if_invalid: str = ...,
|
||||
file_charset: str = ...,
|
||||
libraries: Optional[Dict[str, str]] = ...,
|
||||
@@ -40,12 +42,8 @@ class Engine:
|
||||
def get_default() -> Engine: ...
|
||||
def get_template_builtins(self, builtins: List[str]) -> List[Library]: ...
|
||||
def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ...
|
||||
def get_template_loaders(
|
||||
self, template_loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]]
|
||||
) -> List[Loader]: ...
|
||||
def find_template_loader(
|
||||
self, loader: Union[List[Union[Dict[str, str], str]], Tuple[str, List[str]], str]
|
||||
) -> Loader: ...
|
||||
def get_template_loaders(self, template_loaders: Sequence[_Loader]) -> List[Loader]: ...
|
||||
def find_template_loader(self, loader: _Loader) -> Loader: ...
|
||||
def find_template(
|
||||
self, name: str, dirs: None = ..., skip: Optional[List[Origin]] = ...
|
||||
) -> Tuple[Template, Origin]: ...
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List, Optional, Dict
|
||||
|
||||
from django.template.base import Origin, Template
|
||||
from django.template.engine import Engine
|
||||
|
||||
class Loader:
|
||||
engine: Any = ...
|
||||
get_template_cache: Dict[str, Any] = ...
|
||||
def __init__(self, engine: Engine) -> None: ...
|
||||
def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ...
|
||||
def get_template_sources(self, template_name: Any) -> None: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Any, Callable, Optional, Type
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
class RemovedInDjango30Warning(PendingDeprecationWarning): ...
|
||||
@@ -25,9 +26,9 @@ class DeprecationInstanceCheck(type):
|
||||
deprecation_warning: Type[Warning]
|
||||
def __instancecheck__(self, instance: Any): ...
|
||||
|
||||
GetResponseCallable = Callable[[WSGIRequest], HttpResponse]
|
||||
GetResponseCallable = Callable[[HttpRequest], HttpResponse]
|
||||
|
||||
class MiddlewareMixin:
|
||||
get_response: Optional[GetResponseCallable] = ...
|
||||
def __init__(self, get_response: Optional[GetResponseCallable] = ...) -> None: ...
|
||||
def __call__(self, request: WSGIRequest) -> HttpResponse: ...
|
||||
def __call__(self, request: HttpRequest) -> HttpResponse: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from django import http
|
||||
logger = ... # type: Any
|
||||
|
||||
class ContextMixin:
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, object]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
||||
|
||||
class View:
|
||||
http_method_names = ... # type: List[str]
|
||||
|
||||
@@ -18,7 +18,7 @@ class SingleObjectMixin(ContextMixin):
|
||||
def get_queryset(self) -> models.query.QuerySet: ...
|
||||
def get_slug_field(self) -> str: ...
|
||||
def get_context_object_name(self, obj: Any) -> Optional[str]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, object]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
||||
|
||||
class BaseDetailView(SingleObjectMixin, View):
|
||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
||||
|
||||
@@ -21,7 +21,7 @@ class FormMixin(ContextMixin):
|
||||
def get_success_url(self) -> str: ...
|
||||
def form_valid(self, form: Form) -> HttpResponse: ...
|
||||
def form_invalid(self, form: Form) -> HttpResponse: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, object]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
||||
|
||||
class ModelFormMixin(FormMixin, SingleObjectMixin):
|
||||
fields = ... # type: Optional[List[str]]
|
||||
@@ -33,7 +33,7 @@ class ModelFormMixin(FormMixin, SingleObjectMixin):
|
||||
|
||||
class ProcessFormView(View):
|
||||
def render_to_response(self, context: Dict[str, object], **response_kwargs: object) -> HttpResponse: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, object]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
||||
def get_form(self, form_class: Type[Form] = None) -> Form: ...
|
||||
def form_valid(self, form: Form) -> HttpResponse: ...
|
||||
def form_invalid(self, form: Form) -> HttpResponse: ...
|
||||
|
||||
@@ -29,7 +29,7 @@ class MultipleObjectMixin(ContextMixin):
|
||||
def get_paginate_orphans(self) -> int: ...
|
||||
def get_allow_empty(self) -> bool: ...
|
||||
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, object]: ...
|
||||
def get_context_data(self, **kwargs: object) -> Dict[str, Any]: ...
|
||||
|
||||
class BaseListView(MultipleObjectMixin, View):
|
||||
object_list = ... # type: QuerySet
|
||||
|
||||
Reference in New Issue
Block a user