initial commit

This commit is contained in:
Maxim Kurnikov
2018-07-29 18:12:23 +03:00
commit a9f215bf64
311 changed files with 13433 additions and 0 deletions

4
django/http/cookie.pyi Normal file
View File

@@ -0,0 +1,4 @@
from typing import Dict
def parse_cookie(cookie: str) -> Dict[str, str]: ...

View File

@@ -0,0 +1,82 @@
from io import BytesIO
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[Any, Any], LazyStream], Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, bytes]], 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: ...
def __next__(self) -> bytes: ...
def _find_boundary(self, data: bytes) -> Optional[Tuple[int, int]]: ...
class ChunkIter:
def __init__(self, flo: WSGIRequest, chunk_size: int = ...) -> None: ...
def __next__(self) -> bytes: ...
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: ...
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, Tuple[str, Dict[str, bytes]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]], LazyStream]]]: ...

92
django/http/request.pyi Normal file
View File

@@ -0,0 +1,92 @@
from django.core.handlers.wsgi import WSGIRequest
from django.utils.datastructures import MultiValueDict
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: ...
class HttpRequest:
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_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: ...
@property
def scheme(self) -> Optional[str]: ...
class QueryDict:
def __copy__(self) -> QueryDict: ...
def __deepcopy__(self, memo: Dict[Any, Any]) -> QueryDict: ...
def __delitem__(self, key: str): ...
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 = ...,
mutable: bool = ...,
encoding: None = ...
) -> QueryDict: ...
def pop(self, key: str, *args) -> Optional[List[str]]: ...
def popitem(self): ...
def setdefault(self, key: str, default: str = ...) -> str: ...
def setlist(self, key: str, list_: List[str]) -> None: ...
def setlistdefault(self, key: str, default_list: None = ...) -> List[str]: ...
def urlencode(self, safe: Optional[str] = ...) -> str: ...

113
django/http/response.pyi Normal file
View File

@@ -0,0 +1,113 @@
from io import (
BufferedReader,
BytesIO,
TextIOWrapper,
)
from django.core.files.base import ContentFile
from django.core.serializers.json import DjangoJSONEncoder
from tempfile import _TemporaryFileWrapper
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class FileResponse:
def __init__(self, *args, as_attachment = ..., filename = ..., **kwargs) -> None: ...
def _set_streaming_content(
self,
value: Union[BufferedReader, _TemporaryFileWrapper, ContentFile]
) -> None: ...
def set_headers(self, filelike: Union[BufferedReader, BytesIO, _TemporaryFileWrapper]) -> None: ...
class HttpResponse:
def __init__(self, content: Any = ..., *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 HttpResponseBase:
def __delitem__(self, header: str) -> None: ...
def __getitem__(self, header: str) -> str: ...
def __init__(
self,
content_type: Optional[str] = ...,
status: Optional[Union[str, int]] = ...,
reason: Optional[str] = ...,
charset: Optional[str] = ...
) -> None: ...
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 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[str, bytes, int]) -> 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] = ...,
path: str = ...,
domain: Optional[str] = ...,
secure: Optional[bool] = ...,
httponly: 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]): ...
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:
def __init__(
self,
data: Dict[str, Union[Dict[str, str], str, List[Dict[str, str]], Dict[str, bool]]],
encoder: Type[DjangoJSONEncoder] = ...,
safe: bool = ...,
json_dumps_params: None = ...,
**kwargs
) -> None: ...
class StreamingHttpResponse:
def __init__(
self,
streaming_content: Union[List[str], BufferedReader, str, _TemporaryFileWrapper] = ...,
*args,
**kwargs
) -> None: ...
def __iter__(self) -> map: ...
def _set_streaming_content(self, value: Union[TextIOWrapper, str, List[bytes], List[str]]) -> None: ...
@property
def content(self): ...