better stubs

This commit is contained in:
Maxim Kurnikov
2018-08-05 03:13:19 +03:00
parent 4013fe4d03
commit fa718b8e55
380 changed files with 11805 additions and 8503 deletions

View File

@@ -1,10 +1,4 @@
# Stubs for django.http.cookie (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
from typing import Dict
from typing import Any, Dict, Optional
SimpleCookie: Any

View File

@@ -1,80 +1,60 @@
from io import BytesIO
from io import BytesIO, StringIO
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.utils.datastructures import ImmutableList, MultiValueDict
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
def _parse_header_params(s: bytes) -> List[bytes]: ...
def exhaust(stream_or_iterable: Union[BytesIO, WSGIRequest]) -> None: ...
def parse_boundary_stream(
stream: LazyStream, max_header_size: int
) -> Union[
Tuple[
str,
Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]],
LazyStream,
],
Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream],
Tuple[str, Dict[Any, Any], LazyStream],
Tuple[
str,
Dict[str, Union[Tuple[str, Dict[str, str]], Tuple[str, Dict[Any, Any]]]],
LazyStream,
],
]: ...
def parse_header(
line: bytes
) -> Union[Tuple[str, Dict[Any, Any]], Tuple[str, Dict[str, bytes]]]: ...
class BoundaryIter:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
class MultiPartParserError(Exception): ...
class InputStreamExhausted(Exception): ...
class MultiPartParser:
def __init__(
self,
META: Dict[str, Any],
input_data: Union[WSGIRequest, StringIO, BytesIO],
upload_handlers: Union[ImmutableList, List[Any]],
encoding: Optional[str] = ...,
) -> None: ...
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
def handle_file_complete(
self, old_field_name: str, counters: List[int]
) -> None: ...
def IE_sanitize(self, filename: str) -> str: ...
class LazyStream:
length: None = ...
position: int = ...
def __init__(
self, producer: Union[BoundaryIter, ChunkIter], length: None = ...
) -> None: ...
def tell(self): ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def __next__(self) -> bytes: ...
def _find_boundary(self, data: bytes) -> Optional[Tuple[int, int]]: ...
def close(self) -> None: ...
def __iter__(self) -> LazyStream: ...
def unget(self, bytes: bytes) -> None: ...
class ChunkIter:
def __init__(self, flo: WSGIRequest, chunk_size: int = ...) -> None: ...
flo: Union[django.core.handlers.wsgi.WSGIRequest, _io.BytesIO] = ...
chunk_size: int = ...
def __init__(
self, flo: Union[WSGIRequest, BytesIO], chunk_size: int = ...
) -> None: ...
def __next__(self) -> bytes: ...
def __iter__(self): ...
class InterBoundaryIter:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __iter__(self) -> InterBoundaryIter: ...
def __next__(self) -> LazyStream: ...
class LazyStream:
def __init__(
self, producer: Union[BoundaryIter, ChunkIter], length: None = ...
) -> None: ...
def __iter__(self) -> LazyStream: ...
class BoundaryIter:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __iter__(self): ...
def __next__(self) -> bytes: ...
def _update_unget_history(self, num_bytes: int) -> None: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def unget(self, bytes: bytes) -> None: ...
class MultiPartParser:
def IE_sanitize(self, filename: str) -> str: ...
def __init__(
self,
META: Dict[str, Any],
input_data: WSGIRequest,
upload_handlers: ImmutableList,
encoding: None = ...,
) -> None: ...
def _close_files(self) -> None: ...
def handle_file_complete(self, old_field_name: str, counters: List[int]) -> None: ...
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
class Parser:
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
def __iter__(
self
) -> Iterator[
Union[
Tuple[str, Dict[Any, Any], LazyStream],
Tuple[
str,
Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]],
LazyStream,
],
Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream],
]
]: ...
def __iter__(self) -> Iterator[Tuple[str, LazyStream, LazyStream]]: ...

View File

@@ -1,73 +1,113 @@
from django.core.handlers.wsgi import WSGIRequest
from django.utils.datastructures import MultiValueDict
from io import BytesIO
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
def bytes_to_text(
s: Optional[Union[str, bytes, int]], encoding: str
) -> Optional[Union[str, int]]: ...
def split_domain_port(host: str) -> Tuple[str, str]: ...
def validate_host(host: str, allowed_hosts: Union[str, List[str]]) -> bool: ...
from django.core.handlers.wsgi import WSGIRequest
from django.utils.datastructures import MultiValueDict
RAISE_ERROR: Any
host_validation_re: Any
class UnreadablePostError(IOError): ...
class RawPostDataException(Exception): ...
class HttpRequest:
csrf_cookie_needs_reset: bool
csrf_processing_done: bool
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] = ...
COOKIES: Dict[str, str] = ...
META: Dict[str, Union[str, int]] = ...
FILES: django.utils.datastructures.MultiValueDict = ...
path: str = ...
path_info: str = ...
method: Optional[str] = ...
resolver_match: None = ...
content_type: None = ...
content_params: None = ...
def __init__(self) -> None: ...
def __iter__(self) -> Iterator[bytes]: ...
def __repr__(self) -> str: ...
@cached_property
def _current_scheme_host(self) -> str: ...
def _get_full_path(self, path: str, force_append_slash: bool) -> str: ...
def _get_raw_host(self) -> str: ...
def _get_scheme(self) -> str: ...
def _initialize_handlers(self) -> None: ...
def _load_post_and_files(self) -> None: ...
def _mark_post_parse_error(self) -> None: ...
@property
def body(self) -> bytes: ...
def build_absolute_uri(self, location: Optional[str] = ...) -> str: ...
def close(self) -> None: ...
def get_full_path(self, force_append_slash: bool = ...) -> str: ...
def get_full_path_info(self, force_append_slash: bool = ...) -> str: ...
def get_host(self) -> str: ...
def get_port(self) -> str: ...
def get_raw_uri(self) -> str: ...
def get_full_path(self, force_append_slash: bool = ...) -> str: ...
def get_full_path_info(self, force_append_slash: bool = ...) -> str: ...
def get_signed_cookie(
self, key: str, default: None = ..., salt: str = ..., max_age: None = ...
) -> None: ...
def is_ajax(self) -> bool: ...
def is_secure(self) -> bool: ...
def parse_file_upload(
self, META: Dict[str, Any], post_data: WSGIRequest
) -> Tuple[QueryDict, MultiValueDict]: ...
def read(self, *args, **kwargs) -> bytes: ...
def readline(self, *args, **kwargs) -> bytes: ...
self,
key: str,
default: Any = ...,
salt: str = ...,
max_age: Optional[int] = ...,
) -> Optional[str]: ...
def get_raw_uri(self) -> str: ...
def build_absolute_uri(self, location: Optional[str] = ...) -> str: ...
@property
def scheme(self) -> Optional[str]: ...
def is_secure(self) -> bool: ...
def is_ajax(self) -> bool: ...
@property
def encoding(self): ...
@encoding.setter
def encoding(self, val: Any) -> None: ...
@property
def upload_handlers(self): ...
@upload_handlers.setter
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]
) -> Tuple[QueryDict, MultiValueDict]: ...
@property
def body(self) -> bytes: ...
def close(self) -> None: ...
def read(self, *args: Any, **kwargs: Any) -> bytes: ...
def readline(self, *args: Any, **kwargs: Any) -> bytes: ...
def __iter__(self) -> Iterator[bytes]: ...
def xreadlines(self) -> None: ...
def readlines(self): ...
class QueryDict:
def __copy__(self) -> QueryDict: ...
def __deepcopy__(self, memo: Dict[Any, Any]) -> QueryDict: ...
def __delitem__(self, key: str): ...
class QueryDict(MultiValueDict):
encoding: Any = ...
def __init__(
self,
query_string: Optional[Union[str, bytes]] = ...,
mutable: bool = ...,
encoding: Optional[str] = ...,
) -> None: ...
def __setitem__(self, key: str, value: Optional[Union[str, int]]) -> None: ...
def _assert_mutable(self) -> None: ...
def appendlist(self, key: str, value: Union[str, List[str]]) -> None: ...
def clear(self): ...
def copy(self) -> QueryDict: ...
@classmethod
def fromkeys(
cls,
iterable: Union[str, List[str]],
value: str = ...,
iterable: Union[int, List[bytes], str, List[str]],
value: Union[str, bytes] = ...,
mutable: bool = ...,
encoding: None = ...,
encoding: Optional[str] = ...,
) -> QueryDict: ...
def pop(self, key: str, *args) -> Optional[List[str]]: ...
def popitem(self): ...
def setdefault(self, key: str, default: str = ...) -> str: ...
@property
def encoding(self): ...
@encoding.setter
def encoding(self, value: Any) -> None: ...
def __setitem__(
self, key: str, value: Optional[Union[str, int]]
) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __copy__(self) -> QueryDict: ...
def __deepcopy__(self, memo: Dict[Any, Any]) -> QueryDict: ...
def setlist(self, key: str, list_: List[str]) -> None: ...
def setlistdefault(self, key: str, default_list: None = ...) -> List[str]: ...
def setlistdefault(
self, key: str, default_list: None = ...
) -> List[str]: ...
def appendlist(
self, key: Union[str, bytes], value: Union[str, bytes, List[str]]
) -> None: ...
def pop(self, key: str, *args: Any) -> Optional[Union[str, List[str]]]: ...
def popitem(self) -> Any: ...
def clear(self) -> None: ...
def setdefault(self, key: str, default: str = ...) -> str: ...
def copy(self) -> QueryDict: ...
def urlencode(self, safe: Optional[str] = ...) -> str: ...
def bytes_to_text(
s: Optional[Union[str, bytes, int]], encoding: str
) -> Optional[Union[str, int]]: ...
def split_domain_port(host: str) -> Tuple[str, str]: ...
def validate_host(host: str, allowed_hosts: Union[str, List[str]]) -> bool: ...

View File

@@ -1,110 +1,300 @@
from io import BufferedReader, BytesIO, TextIOWrapper
from datetime import datetime
from io import BufferedReader, BytesIO
from tempfile import _TemporaryFileWrapper
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from django.core.files.base import ContentFile
from django.core.serializers.json import DjangoJSONEncoder
from tempfile import _TemporaryFileWrapper
from typing import Dict, List, Optional, Tuple, Type, Union
from django.utils.functional import SimpleLazyObject
class FileResponse:
def __init__(self, *args, as_attachment=..., filename=..., **kwargs) -> None: ...
def _set_streaming_content(
self, value: Union[_TemporaryFileWrapper, BufferedReader, ContentFile]
) -> None: ...
def set_headers(
self, filelike: Union[_TemporaryFileWrapper, BufferedReader, BytesIO]
) -> None: ...
class HttpResponse:
def __init__(
self, content: Union[int, TextIOWrapper, bytes, str] = ..., *args, **kwargs
) -> None: ...
def __repr__(self) -> str: ...
def getvalue(self) -> bytes: ...
def writable(self) -> bool: ...
def write(self, content: Union[str, bytes]) -> None: ...
def writelines(self, lines: List[str]) -> None: ...
class BadHeaderError(ValueError): ...
class HttpResponseBase:
def __delitem__(self, header: str) -> None: ...
def __getitem__(self, header: str) -> str: ...
status_code: int = ...
cookies: http.cookies.SimpleCookie = ...
closed: bool = ...
def __init__(
self,
content_type: Optional[str] = ...,
status: Optional[Union[str, int]] = ...,
status: Any = ...,
reason: Optional[str] = ...,
charset: Optional[str] = ...,
) -> None: ...
@property
def reason_phrase(self): ...
@reason_phrase.setter
def reason_phrase(self, value: Any) -> None: ...
@property
def charset(self): ...
@charset.setter
def charset(self, value: Any) -> None: ...
def serialize_headers(self) -> bytes: ...
__bytes__: Any = ...
def __setitem__(
self, header: Union[str, bytes], value: Union[str, bytes, int]
) -> None: ...
@property
def _content_type_for_repr(self) -> str: ...
def _convert_to_charset(
self, value: Union[str, int], charset: str, mime_encode: bool = ...
) -> str: ...
def close(self) -> None: ...
def delete_cookie(
self, key: str, path: str = ..., domain: Optional[str] = ...
) -> None: ...
def __delitem__(self, header: str) -> None: ...
def __getitem__(self, header: str) -> str: ...
def has_header(self, header: str) -> bool: ...
__contains__: Any = ...
def items(self): ...
def get(
self, header: str, alternate: Optional[Union[str, Tuple]] = ...
) -> Optional[Union[str, Tuple]]: ...
def has_header(self, header: str) -> bool: ...
def make_bytes(self, value: Union[bytes, int, str]) -> bytes: ...
def seekable(self) -> bool: ...
def serialize_headers(self) -> bytes: ...
def set_cookie(
self,
key: str,
value: str = ...,
max_age: Optional[int] = ...,
expires: Optional[str] = ...,
expires: Optional[Union[str, datetime]] = ...,
path: str = ...,
domain: Optional[str] = ...,
secure: Optional[bool] = ...,
httponly: bool = ...,
httponly: Optional[bool] = ...,
samesite: Optional[str] = ...,
) -> None: ...
def set_signed_cookie(
self, key: str, value: str, salt: str = ..., **kwargs
) -> None: ...
def setdefault(self, key: str, value: str) -> None: ...
def tell(self): ...
def write(self, content: str): ...
def writelines(self, lines: List[str]): ...
def set_signed_cookie(
self, key: str, value: str, salt: str = ..., **kwargs: Any
) -> None: ...
def delete_cookie(
self, key: str, path: str = ..., domain: Optional[str] = ...
) -> None: ...
def make_bytes(
self, value: Union[int, SimpleLazyObject, bytes, str]
) -> bytes: ...
def close(self) -> None: ...
def write(self, content: str) -> Any: ...
def flush(self) -> None: ...
def tell(self) -> Any: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...
def writelines(self, lines: List[str]) -> Any: ...
class HttpResponseNotAllowed:
def __init__(self, permitted_methods: List[str], *args, **kwargs) -> None: ...
def __repr__(self) -> str: ...
class HttpResponseNotModified:
def __init__(self, *args, **kwargs) -> None: ...
class HttpResponseRedirectBase:
def __init__(self, redirect_to: str, *args, **kwargs) -> None: ...
def __repr__(self) -> str: ...
class JsonResponse:
class HttpResponse(HttpResponseBase):
client: django.test.client.Client
closed: bool
context: Optional[
Union[django.template.context.Context, django.test.utils.ContextList]
]
cookies: http.cookies.SimpleCookie
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,
]
sameorigin: bool
status_code: int
templates: List[django.template.base.Template]
test_server_port: str
test_was_secure_request: bool
wsgi_request: django.core.handlers.wsgi.WSGIRequest
xframe_options_exempt: bool
streaming: bool = ...
content: Any = ...
def __init__(
self,
data: Dict[str, Union[Dict[str, bool], str, Dict[str, str], List[Dict[str, str]]]],
encoder: Type[DjangoJSONEncoder] = ...,
safe: bool = ...,
json_dumps_params: None = ...,
**kwargs,
) -> None: ...
class StreamingHttpResponse:
def __init__(
self,
streaming_content: Union[
_TemporaryFileWrapper, BufferedReader, str, List[str]
] = ...,
*args,
**kwargs,
) -> None: ...
def __iter__(self) -> map: ...
def _set_streaming_content(
self, value: Union[TextIOWrapper, str, List[str], List[bytes]]
self, content: Any = ..., *args: Any, **kwargs: Any
) -> None: ...
def serialize(self): ...
__bytes__: Any = ...
@property
def content(self): ...
@content.setter
def content(self, value: Any) -> None: ...
def __iter__(self): ...
def write(self, content: Union[str, bytes]) -> None: ...
def tell(self) -> int: ...
def getvalue(self) -> bytes: ...
def writable(self) -> bool: ...
def writelines(self, lines: List[str]) -> None: ...
class StreamingHttpResponse(HttpResponseBase):
client: django.test.client.Client
closed: bool
context: None
cookies: http.cookies.SimpleCookie
json: functools.partial
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
resolver_match: django.utils.functional.SimpleLazyObject
status_code: int
templates: List[Any]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
streaming: bool = ...
streaming_content: Any = ...
def __init__(
self, streaming_content: Any = ..., *args: Any, **kwargs: Any
) -> None: ...
@property
def content(self) -> Any: ...
@property
def streaming_content(self): ...
@streaming_content.setter
def streaming_content(self, value: Any) -> None: ...
def __iter__(self) -> map: ...
def getvalue(self) -> bytes: ...
class FileResponse(StreamingHttpResponse):
client: django.test.client.Client
closed: bool
context: None
cookies: http.cookies.SimpleCookie
file_to_stream: Optional[
Union[
_io.BytesIO,
tempfile._TemporaryFileWrapper,
_io.BufferedReader,
django.core.files.base.ContentFile,
]
]
json: functools.partial
request: Dict[str, str]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[Any]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
block_size: int = ...
as_attachment: bool = ...
filename: str = ...
def __init__(
self,
*args: Any,
as_attachment: bool = ...,
filename: str = ...,
**kwargs: Any
) -> None: ...
def set_headers(
self,
filelike: Union[
_TemporaryFileWrapper, ContentFile, BufferedReader, BytesIO
],
) -> None: ...
class HttpResponseRedirectBase(HttpResponse):
allowed_schemes: Any = ...
def __init__(self, redirect_to: str, *args: Any, **kwargs: Any) -> None: ...
url: Any = ...
class HttpResponseRedirect(HttpResponseRedirectBase):
client: django.test.client.Client
closed: bool
context: Optional[django.test.utils.ContextList]
cookies: http.cookies.SimpleCookie
csrf_cookie_set: bool
json: functools.partial
redirect_chain: List[Tuple[str, int]]
request: Dict[
str, Union[str, int, django.test.client.FakePayload, Dict[str, str]]
]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[django.template.base.Template]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class HttpResponsePermanentRedirect(HttpResponseRedirectBase):
client: django.test.client.Client
closed: bool
context: None
cookies: http.cookies.SimpleCookie
json: functools.partial
redirect_chain: List[Tuple[str, int]]
request: Dict[str, str]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[Any]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class HttpResponseNotModified(HttpResponse):
closed: bool
cookies: http.cookies.SimpleCookie
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def content(self, value: Any) -> None: ...
class HttpResponseBadRequest(HttpResponse):
closed: bool
cookies: http.cookies.SimpleCookie
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class HttpResponseNotFound(HttpResponse):
client: django.test.client.Client
closed: bool
context: Optional[django.template.context.Context]
cookies: http.cookies.SimpleCookie
csrf_cookie_set: bool
json: functools.partial
request: Dict[str, str]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[django.template.base.Template]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class HttpResponseForbidden(HttpResponse):
client: django.test.client.Client
closed: bool
context: Optional[django.template.context.Context]
cookies: http.cookies.SimpleCookie
csrf_cookie_set: bool
json: functools.partial
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[django.template.base.Template]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class HttpResponseNotAllowed(HttpResponse):
closed: bool
cookies: http.cookies.SimpleCookie
status_code: int = ...
def __init__(
self,
permitted_methods: Union[Tuple[str, str], List[str]],
*args: Any,
**kwargs: Any
) -> None: ...
class HttpResponseGone(HttpResponse):
closed: bool
cookies: http.cookies.SimpleCookie
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class HttpResponseServerError(HttpResponse):
client: django.test.client.Client
closed: bool
context: django.test.utils.ContextList
cookies: http.cookies.SimpleCookie
csrf_cookie_set: bool
json: functools.partial
request: Dict[str, str]
resolver_match: django.utils.functional.SimpleLazyObject
templates: List[django.template.base.Template]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
status_code: int = ...
class Http404(Exception): ...
class JsonResponse(HttpResponse):
client: django.test.client.Client
closed: bool
context: None
cookies: http.cookies.SimpleCookie
json: functools.partial
request: Dict[str, Union[str, int, django.test.client.FakePayload]]
resolver_match: django.utils.functional.SimpleLazyObject
status_code: int
templates: List[Any]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
def __init__(
self,
data: Any,
encoder: Type[DjangoJSONEncoder] = ...,
safe: bool = ...,
json_dumps_params: Optional[Dict[str, int]] = ...,
**kwargs: Any
) -> None: ...