mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-10-25 23:27:38 +08:00
fifth iteration
This commit is contained in:
1 parent
8cc446150c
commit
a13d4c352a
124 files changed
+1455
-5681
No files matched your search
@@ -1,19 +1,17 @@
|
||||
from datetime import date
|
||||
from io import BufferedRandom, BufferedReader, BytesIO, StringIO
|
||||
from tempfile import _TemporaryFileWrapper
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.core.handlers.base import BaseHandler
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.dispatch.dispatcher import Signal
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.request import HttpRequest, QueryDict
|
||||
from django.http.response import (HttpResponse, HttpResponseBase,
|
||||
HttpResponseRedirect)
|
||||
from django.template.base import Template
|
||||
from django.template.context import Context
|
||||
from django.test.utils import ContextList
|
||||
|
||||
|
||||
class RedirectCycleError(Exception):
|
||||
@@ -37,27 +35,7 @@ class ClientHandler(BaseHandler):
|
||||
) -> None: ...
|
||||
def __call__(self, environ: Dict[str, Any]) -> HttpResponseBase: ...
|
||||
|
||||
def encode_multipart(
|
||||
boundary: str,
|
||||
data: Union[
|
||||
Dict[str, Union[List[int], List[str], int]],
|
||||
Dict[str, Union[List[int], int, str]],
|
||||
Dict[str, Union[List[str], int, str]],
|
||||
Dict[str, Union[Tuple[str, str, str], int, str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Tuple[_TemporaryFileWrapper, _TemporaryFileWrapper],
|
||||
str,
|
||||
_TemporaryFileWrapper,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[BufferedReader, str]],
|
||||
Dict[str, Union[BytesIO, StringIO, _TemporaryFileWrapper]],
|
||||
Dict[str, BufferedRandom],
|
||||
Dict[str, SimpleUploadedFile],
|
||||
],
|
||||
) -> bytes: ...
|
||||
def encode_multipart(boundary: str, data: Dict[str, Any]) -> bytes: ...
|
||||
def encode_file(boundary: str, key: str, file: Any) -> List[bytes]: ...
|
||||
|
||||
class RequestFactory:
|
||||
@@ -70,42 +48,14 @@ class RequestFactory:
|
||||
def get(
|
||||
self,
|
||||
path: str,
|
||||
data: Optional[
|
||||
Union[
|
||||
Dict[str, Union[Tuple[str, str, str], str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, date],
|
||||
str,
|
||||
]
|
||||
] = ...,
|
||||
data: Optional[Union[Dict[str, date], QueryDict, str]] = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
) -> Union[WSGIRequest, HttpResponseBase]: ...
|
||||
def post(
|
||||
self,
|
||||
path: str,
|
||||
data: Optional[
|
||||
Union[
|
||||
Dict[str, Union[List[int], List[str], int]],
|
||||
Dict[str, Union[List[int], int, str]],
|
||||
Dict[str, Union[List[str], int, str]],
|
||||
Dict[str, Union[Tuple[str, str, str], int, str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Tuple[_TemporaryFileWrapper, _TemporaryFileWrapper],
|
||||
str,
|
||||
_TemporaryFileWrapper,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[BufferedReader, str]],
|
||||
Dict[str, Union[BytesIO, StringIO, _TemporaryFileWrapper]],
|
||||
Dict[str, BufferedRandom],
|
||||
Dict[str, SimpleUploadedFile],
|
||||
bytes,
|
||||
str,
|
||||
]
|
||||
] = ...,
|
||||
data: Any = ...,
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
@@ -181,13 +131,7 @@ class Client(RequestFactory):
|
||||
def get(
|
||||
self,
|
||||
path: str,
|
||||
data: Optional[
|
||||
Union[
|
||||
Dict[str, Union[Tuple[str, str, str], str]],
|
||||
Dict[str, Union[int, str]],
|
||||
str,
|
||||
]
|
||||
] = ...,
|
||||
data: Optional[Union[Dict[str, Union[int, str]], QueryDict, str]] = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
@@ -195,28 +139,7 @@ class Client(RequestFactory):
|
||||
def post(
|
||||
self,
|
||||
path: str,
|
||||
data: Optional[
|
||||
Union[
|
||||
Dict[str, Union[List[int], List[str], int]],
|
||||
Dict[str, Union[List[int], int, str]],
|
||||
Dict[str, Union[List[str], int, str]],
|
||||
Dict[str, Union[Tuple[str, str, str], int, str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Tuple[_TemporaryFileWrapper, _TemporaryFileWrapper],
|
||||
str,
|
||||
_TemporaryFileWrapper,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[BufferedReader, str]],
|
||||
Dict[str, Union[BytesIO, StringIO, _TemporaryFileWrapper]],
|
||||
Dict[str, BufferedRandom],
|
||||
Dict[str, SimpleUploadedFile],
|
||||
bytes,
|
||||
str,
|
||||
]
|
||||
] = ...,
|
||||
data: Any = ...,
|
||||
content_type: str = ...,
|
||||
follow: bool = ...,
|
||||
secure: bool = ...,
|
||||
|
||||
@@ -6,9 +6,7 @@ from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
|
||||
Type, Union)
|
||||
from unittest.runner import TextTestResult
|
||||
|
||||
from django.contrib.staticfiles.handlers import StaticFilesHandler
|
||||
from django.core.handlers.wsgi import WSGIHandler
|
||||
from django.core.management.commands.dumpdata import ProxyModelWarning
|
||||
from django.core.servers.basehttp import WSGIRequestHandler
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.base import Model
|
||||
@@ -17,9 +15,8 @@ from django.forms.fields import EmailField
|
||||
from django.http.response import HttpResponse, HttpResponseBase
|
||||
from django.template.context import Context
|
||||
from django.test.html import Element
|
||||
from django.test.utils import (CaptureQueriesContext, modify_settings,
|
||||
override_settings)
|
||||
from django.utils.deprecation import RemovedInDjango30Warning
|
||||
from django.test.utils import (CaptureQueriesContext, ContextList,
|
||||
modify_settings, override_settings)
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
|
||||
@@ -146,15 +143,7 @@ class SimpleTestCase(unittest.TestCase):
|
||||
) -> Optional[_GeneratorContextManager]: ...
|
||||
def assertWarnsMessage(
|
||||
self,
|
||||
expected_warning: Type[
|
||||
Union[
|
||||
DeprecationWarning,
|
||||
RuntimeWarning,
|
||||
UserWarning,
|
||||
ProxyModelWarning,
|
||||
RemovedInDjango30Warning,
|
||||
]
|
||||
],
|
||||
expected_warning: Type[Exception],
|
||||
expected_message: str,
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
@@ -206,13 +195,11 @@ class TransactionTestCase(SimpleTestCase):
|
||||
self,
|
||||
qs: Union[Iterator[Any], List[Model], QuerySet, RawQuerySet],
|
||||
values: Union[
|
||||
List[Optional[str]],
|
||||
List[Tuple[Any, Any]],
|
||||
List[Tuple[Model, Model]],
|
||||
List[Tuple[Model, int, int]],
|
||||
List[Tuple[str, Type[Model], int]],
|
||||
List[None],
|
||||
List[Tuple[str, str]],
|
||||
List[date],
|
||||
List[int],
|
||||
List[str],
|
||||
Set[str],
|
||||
QuerySet,
|
||||
],
|
||||
@@ -275,19 +262,14 @@ class LiveServerThread(threading.Thread):
|
||||
port: int = ...
|
||||
is_ready: threading.Event = ...
|
||||
error: Optional[django.core.exceptions.ImproperlyConfigured] = ...
|
||||
static_handler: Type[
|
||||
Union[
|
||||
django.contrib.staticfiles.handlers.StaticFilesHandler,
|
||||
django.test.testcases._StaticFilesHandler,
|
||||
]
|
||||
] = ...
|
||||
static_handler: Type[django.core.handlers.wsgi.WSGIHandler] = ...
|
||||
connections_override: Dict[
|
||||
str, django.db.backends.sqlite3.base.DatabaseWrapper
|
||||
] = ...
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
static_handler: Type[Union[StaticFilesHandler, _StaticFilesHandler]],
|
||||
static_handler: Type[WSGIHandler],
|
||||
connections_override: Dict[str, DatabaseWrapper] = ...,
|
||||
port: int = ...,
|
||||
) -> None: ...
|
||||
|
||||
+4
-143
@@ -65,143 +65,7 @@ class TestContextDecorator:
|
||||
class override_settings(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
options: Union[
|
||||
Dict[str, Dict[str, Callable]],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Callable, Dict[str, Union[Dict[str, bool], bool]]
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str, Union[Dict[str, Union[Dict[str, bool], bool]], int]
|
||||
],
|
||||
Dict[
|
||||
str, Union[Dict[str, Union[Dict[str, bool], bool]], str]
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[Callable, Dict[str, int], str]],
|
||||
Dict[str, Union[Dict[str, int], int, str]],
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[str, List[Dict[str, Union[Dict[Any, Any], bool, str]]]],
|
||||
Dict[
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, List[Tuple[str, Dict[str, str]]]],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, List[str]], str]],
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, int], bool, str]],
|
||||
Dict[str, Union[Dict[str, str], str]],
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, List[unittest.mock.Mock]],
|
||||
Dict[str, Optional[Union[List[str], bool]]],
|
||||
Dict[str, Optional[Union[bool, str]]],
|
||||
Dict[str, Tuple[Tuple[str, str], Tuple[str, str]]],
|
||||
Dict[str, Type[Any]],
|
||||
Dict[str, Union[Callable, bool]],
|
||||
Dict[str, Union[Dict[int, None], bool]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Dict[str, Optional[str]]], List[Tuple[str, str]], str
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, Optional[str]], List[str]]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Dict[str, Union[List[str], bool, str]]], int
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[Callable, str]],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
Dict[str, Union[int, str]],
|
||||
],
|
||||
],
|
||||
bool,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, Union[Dict[str, str], str]], List[str], int, str],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Dict[str, Union[Dict[str, List[Any]], List[Any], bool, str]]
|
||||
],
|
||||
List[str],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Dict[str, Union[Dict[str, List[str]], List[str], bool, str]]
|
||||
],
|
||||
List[Union[Tuple[str, str], str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Union[Dict[str, Tuple[str]], List[str], str]]],
|
||||
List[str],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[List[Dict[str, Union[List[Any], bool, str]]], int]],
|
||||
Dict[str, Union[List[int], List[str], str]],
|
||||
Dict[str, Union[Tuple[str], str]],
|
||||
Dict[str, Union[float, str]],
|
||||
Dict[str, bytes],
|
||||
] = ...
|
||||
options: Dict[str, Any] = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder] = ...
|
||||
def enable(self) -> None: ...
|
||||
@@ -217,9 +81,7 @@ class modify_settings(override_settings):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder]
|
||||
operations: List[
|
||||
Tuple[str, Union[Dict[str, List[str]], Dict[str, str]]]
|
||||
] = ...
|
||||
operations: List[Tuple[str, Dict[str, Union[List[str], str]]]] = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def save_options(self, test_func: Type[SimpleTestCase]) -> None: ...
|
||||
options: Dict[str, List[Union[Tuple[str, str], str]]] = ...
|
||||
@@ -262,9 +124,8 @@ class CaptureQueriesContext:
|
||||
class ignore_warnings(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
ignore_kwargs: Union[
|
||||
Dict[str, Type[django.utils.deprecation.RemovedInDjango30Warning]],
|
||||
Dict[str, str],
|
||||
ignore_kwargs: Dict[
|
||||
str, Union[Type[django.utils.deprecation.RemovedInDjango30Warning], str]
|
||||
] = ...
|
||||
filter_func: Callable = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
|
||||
Reference in new issue
Block a user