third iteration of stubs

This commit is contained in:
Maxim Kurnikov
2018-08-11 00:19:50 +03:00
parent fa718b8e55
commit c6bceb19f4
216 changed files with 16306 additions and 3006 deletions

View File

@@ -3,6 +3,7 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import QueryDict
from django.test.client import FakePayload
from django.utils.datastructures import ImmutableList, MultiValueDict
@@ -12,9 +13,14 @@ class InputStreamExhausted(Exception): ...
class MultiPartParser:
def __init__(
self,
META: Dict[str, Any],
input_data: Union[WSGIRequest, StringIO, BytesIO],
upload_handlers: Union[ImmutableList, List[Any]],
META: Dict[
str,
Union[
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
],
],
input_data: Union[BytesIO, StringIO, WSGIRequest],
upload_handlers: Union[List[Any], ImmutableList],
encoding: Optional[str] = ...,
) -> None: ...
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
@@ -37,10 +43,10 @@ class LazyStream:
def unget(self, bytes: bytes) -> None: ...
class ChunkIter:
flo: Union[django.core.handlers.wsgi.WSGIRequest, _io.BytesIO] = ...
flo: Union[_io.BytesIO, django.core.handlers.wsgi.WSGIRequest] = ...
chunk_size: int = ...
def __init__(
self, flo: Union[WSGIRequest, BytesIO], chunk_size: int = ...
self, flo: Union[BytesIO, WSGIRequest], chunk_size: int = ...
) -> None: ...
def __next__(self) -> bytes: ...
def __iter__(self): ...
@@ -57,4 +63,23 @@ class BoundaryIter:
class Parser:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __iter__(self) -> Iterator[Tuple[str, LazyStream, LazyStream]]: ...
def __iter__(
self
) -> Iterator[
Tuple[
str,
Dict[
str,
Tuple[
str,
Union[
Dict[Any, Any],
Dict[str, Union[bytes, str]],
Dict[str, bytes],
Dict[str, str],
],
],
],
LazyStream,
]
]: ...

View File

@@ -2,6 +2,7 @@ from io import BytesIO
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
from django.core.handlers.wsgi import WSGIRequest
from django.test.client import FakePayload
from django.utils.datastructures import MultiValueDict
RAISE_ERROR: Any
@@ -16,10 +17,10 @@ class HttpRequest:
get_host: Callable
sensitive_post_parameters: str
session: django.contrib.sessions.backends.db.SessionStore
GET: Union[Dict[str, str], django.http.request.QueryDict] = ...
POST: Union[Dict[str, str], django.http.request.QueryDict] = ...
GET: Dict[str, str] = ...
POST: Dict[str, str] = ...
COOKIES: Dict[str, str] = ...
META: Dict[str, Union[str, int]] = ...
META: Dict[str, Union[int, str]] = ...
FILES: django.utils.datastructures.MultiValueDict = ...
path: str = ...
path_info: str = ...
@@ -55,7 +56,14 @@ class HttpRequest:
def upload_handlers(self, upload_handlers: Any) -> None: ...
upload_handlers: Any = ...
def parse_file_upload(
self, META: Dict[str, Any], post_data: Union[WSGIRequest, BytesIO]
self,
META: Dict[
str,
Union[
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
],
],
post_data: Union[BytesIO, WSGIRequest],
) -> Tuple[QueryDict, MultiValueDict]: ...
@property
def body(self) -> bytes: ...
@@ -70,15 +78,15 @@ class QueryDict(MultiValueDict):
encoding: Any = ...
def __init__(
self,
query_string: Optional[Union[str, bytes]] = ...,
query_string: Optional[Union[bytes, str]] = ...,
mutable: bool = ...,
encoding: Optional[str] = ...,
) -> None: ...
@classmethod
def fromkeys(
cls,
iterable: Union[int, List[bytes], str, List[str]],
value: Union[str, bytes] = ...,
iterable: Union[List[bytes], List[str], int, str],
value: Union[bytes, str] = ...,
mutable: bool = ...,
encoding: Optional[str] = ...,
) -> QueryDict: ...
@@ -87,7 +95,7 @@ class QueryDict(MultiValueDict):
@encoding.setter
def encoding(self, value: Any) -> None: ...
def __setitem__(
self, key: str, value: Optional[Union[str, int]]
self, key: str, value: Optional[Union[int, str]]
) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __copy__(self) -> QueryDict: ...
@@ -97,9 +105,9 @@ class QueryDict(MultiValueDict):
self, key: str, default_list: None = ...
) -> List[str]: ...
def appendlist(
self, key: Union[str, bytes], value: Union[str, bytes, List[str]]
self, key: Union[bytes, str], value: Union[List[str], bytes, str]
) -> None: ...
def pop(self, key: str, *args: Any) -> Optional[Union[str, List[str]]]: ...
def pop(self, key: str, *args: Any) -> Optional[Union[List[str], str]]: ...
def popitem(self) -> Any: ...
def clear(self) -> None: ...
def setdefault(self, key: str, default: str = ...) -> str: ...
@@ -107,7 +115,7 @@ class QueryDict(MultiValueDict):
def urlencode(self, safe: Optional[str] = ...) -> str: ...
def bytes_to_text(
s: Optional[Union[str, bytes, int]], encoding: str
) -> Optional[Union[str, int]]: ...
s: Optional[Union[bytes, int, str]], encoding: str
) -> Optional[Union[int, str]]: ...
def split_domain_port(host: str) -> Tuple[str, str]: ...
def validate_host(host: str, allowed_hosts: Union[str, List[str]]) -> bool: ...
def validate_host(host: str, allowed_hosts: Union[List[str], str]) -> bool: ...

View File

@@ -1,11 +1,11 @@
from datetime import datetime
from io import BufferedReader, BytesIO
from io import BufferedReader, BytesIO, TextIOWrapper
from tempfile import _TemporaryFileWrapper
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from uuid import UUID
from django.core.files.base import ContentFile
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.functional import SimpleLazyObject
class BadHeaderError(ValueError): ...
@@ -32,7 +32,7 @@ class HttpResponseBase:
def serialize_headers(self) -> bytes: ...
__bytes__: Any = ...
def __setitem__(
self, header: Union[str, bytes], value: Union[str, bytes, int]
self, header: Union[bytes, str], value: Union[bytes, int, str]
) -> None: ...
def __delitem__(self, header: str) -> None: ...
def __getitem__(self, header: str) -> str: ...
@@ -40,14 +40,14 @@ class HttpResponseBase:
__contains__: Any = ...
def items(self): ...
def get(
self, header: str, alternate: Optional[Union[str, Tuple]] = ...
) -> Optional[Union[str, Tuple]]: ...
self, header: str, alternate: Optional[Union[Tuple, str]] = ...
) -> Optional[Union[Tuple, str]]: ...
def set_cookie(
self,
key: str,
value: str = ...,
max_age: Optional[int] = ...,
expires: Optional[Union[str, datetime]] = ...,
expires: Optional[Union[datetime, str]] = ...,
path: str = ...,
domain: Optional[str] = ...,
secure: Optional[bool] = ...,
@@ -61,9 +61,7 @@ class HttpResponseBase:
def delete_cookie(
self, key: str, path: str = ..., domain: Optional[str] = ...
) -> None: ...
def make_bytes(
self, value: Union[int, SimpleLazyObject, bytes, str]
) -> bytes: ...
def make_bytes(self, value: Union[bytes, int, str]) -> bytes: ...
def close(self) -> None: ...
def write(self, content: str) -> Any: ...
def flush(self) -> None: ...
@@ -83,11 +81,8 @@ class HttpResponse(HttpResponseBase):
csrf_cookie_set: bool
json: functools.partial
redirect_chain: List[Tuple[str, int]]
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
resolver_match: Union[
django.utils.functional.SimpleLazyObject,
django.urls.resolvers.ResolverMatch,
]
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
resolver_match: django.urls.resolvers.ResolverMatch
sameorigin: bool
status_code: int
templates: List[django.template.base.Template]
@@ -98,7 +93,12 @@ class HttpResponse(HttpResponseBase):
streaming: bool = ...
content: Any = ...
def __init__(
self, content: Any = ..., *args: Any, **kwargs: Any
self,
content: Union[
Iterator[Any], List[str], TextIOWrapper, bytes, int, str
] = ...,
*args: Any,
**kwargs: Any
) -> None: ...
def serialize(self): ...
__bytes__: Any = ...
@@ -107,7 +107,7 @@ class HttpResponse(HttpResponseBase):
@content.setter
def content(self, value: Any) -> None: ...
def __iter__(self): ...
def write(self, content: Union[str, bytes]) -> None: ...
def write(self, content: Union[bytes, str]) -> None: ...
def tell(self) -> int: ...
def getvalue(self) -> bytes: ...
def writable(self) -> bool: ...
@@ -119,7 +119,7 @@ class StreamingHttpResponse(HttpResponseBase):
context: None
cookies: http.cookies.SimpleCookie
json: functools.partial
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
resolver_match: django.utils.functional.SimpleLazyObject
status_code: int
templates: List[Any]
@@ -127,7 +127,20 @@ class StreamingHttpResponse(HttpResponseBase):
streaming: bool = ...
streaming_content: Any = ...
def __init__(
self, streaming_content: Any = ..., *args: Any, **kwargs: Any
self,
streaming_content: Union[
Iterator[Any],
List[bytes],
List[str],
BufferedReader,
BytesIO,
TextIOWrapper,
ContentFile,
str,
_TemporaryFileWrapper,
] = ...,
*args: Any,
**kwargs: Any
) -> None: ...
@property
def content(self) -> Any: ...
@@ -145,10 +158,10 @@ class FileResponse(StreamingHttpResponse):
cookies: http.cookies.SimpleCookie
file_to_stream: Optional[
Union[
_io.BytesIO,
tempfile._TemporaryFileWrapper,
_io.BufferedReader,
_io.BytesIO,
django.core.files.base.ContentFile,
tempfile._TemporaryFileWrapper,
]
]
json: functools.partial
@@ -169,7 +182,7 @@ class FileResponse(StreamingHttpResponse):
def set_headers(
self,
filelike: Union[
_TemporaryFileWrapper, ContentFile, BufferedReader, BytesIO
BufferedReader, BytesIO, ContentFile, _TemporaryFileWrapper
],
) -> None: ...
@@ -187,7 +200,7 @@ class HttpResponseRedirect(HttpResponseRedirectBase):
json: functools.partial
redirect_chain: List[Tuple[str, int]]
request: Dict[
str, Union[str, int, django.test.client.FakePayload, Dict[str, str]]
str, Union[Dict[str, str], django.test.client.FakePayload, int, str]
]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[django.template.base.Template]
@@ -241,7 +254,7 @@ class HttpResponseForbidden(HttpResponse):
cookies: http.cookies.SimpleCookie
csrf_cookie_set: bool
json: functools.partial
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[django.template.base.Template]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
@@ -253,7 +266,7 @@ class HttpResponseNotAllowed(HttpResponse):
status_code: int = ...
def __init__(
self,
permitted_methods: Union[Tuple[str, str], List[str]],
permitted_methods: Union[List[str], Tuple[str, str]],
*args: Any,
**kwargs: Any
) -> None: ...
@@ -285,14 +298,22 @@ class JsonResponse(HttpResponse):
context: None
cookies: http.cookies.SimpleCookie
json: functools.partial
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
resolver_match: django.utils.functional.SimpleLazyObject
status_code: int
templates: List[Any]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
def __init__(
self,
data: Any,
data: Union[
Dict[str, Union[Dict[str, bool], List[Dict[str, str]]]],
Dict[str, Union[Dict[str, str], int]],
Dict[str, str],
List[int],
List[str],
str,
UUID,
],
encoder: Type[DjangoJSONEncoder] = ...,
safe: bool = ...,
json_dumps_params: Optional[Dict[str, int]] = ...,