reformat with black

This commit is contained in:
Maxim Kurnikov
2018-07-29 23:34:58 +03:00
parent 4866354600
commit cf85607969
343 changed files with 6054 additions and 2158 deletions

View File

@@ -5,6 +5,7 @@
from typing import Any
from typing import Dict
SimpleCookie: Any
def parse_cookie(cookie: str) -> Dict[str, str]: ...

View File

@@ -1,58 +1,48 @@
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,
)
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]]]: ...
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: ...
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 = ...
self, producer: Union[BoundaryIter, ChunkIter], length: None = ...
) -> None: ...
def __iter__(self) -> LazyStream: ...
def __next__(self) -> bytes: ...
@@ -60,7 +50,6 @@ class LazyStream:
def read(self, size: Optional[int] = ...) -> bytes: ...
def unget(self, bytes: bytes) -> None: ...
class MultiPartParser:
def IE_sanitize(self, filename: str) -> str: ...
def __init__(
@@ -68,15 +57,24 @@ class MultiPartParser:
META: Dict[str, Any],
input_data: WSGIRequest,
upload_handlers: ImmutableList,
encoding: None = ...
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]]]: ...
) -> 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],
]
]: ...

View File

@@ -1,25 +1,13 @@
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]]: ...
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]: ...
@@ -42,25 +30,18 @@ class HttpRequest:
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 = ...
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
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: ...
@@ -69,7 +50,7 @@ class QueryDict:
self,
query_string: Optional[Union[str, bytes]] = ...,
mutable: bool = ...,
encoding: Optional[str] = ...
encoding: Optional[str] = ...,
) -> None: ...
def __setitem__(self, key: str, value: Optional[Union[str, int]]) -> None: ...
def _assert_mutable(self) -> None: ...
@@ -82,11 +63,11 @@ class QueryDict:
iterable: Union[str, List[str]],
value: str = ...,
mutable: bool = ...,
encoding: None = ...
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: ...
def urlencode(self, safe: Optional[str] = ...) -> str: ...

View File

@@ -1,39 +1,28 @@
from io import (
BufferedReader,
BytesIO,
TextIOWrapper,
)
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 (
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
from typing import Dict, List, Optional, Tuple, Type, Union
class FileResponse:
def __init__(self, *args, as_attachment = ..., filename = ..., **kwargs) -> None: ...
def __init__(self, *args, as_attachment=..., filename=..., **kwargs) -> None: ...
def _set_streaming_content(
self,
value: Union[_TemporaryFileWrapper, BufferedReader, ContentFile]
self, value: Union[_TemporaryFileWrapper, BufferedReader, ContentFile]
) -> None: ...
def set_headers(
self, filelike: Union[_TemporaryFileWrapper, BufferedReader, BytesIO]
) -> 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 __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 HttpResponseBase:
def __delitem__(self, header: str) -> None: ...
def __getitem__(self, header: str) -> str: ...
@@ -42,15 +31,23 @@ class HttpResponseBase:
content_type: Optional[str] = ...,
status: Optional[Union[str, int]] = ...,
reason: Optional[str] = ...,
charset: Optional[str] = ...
charset: Optional[str] = ...,
) -> None: ...
def __setitem__(
self, header: Union[str, bytes], value: Union[str, bytes, int]
) -> 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 _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 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[bytes, int, str]) -> bytes: ...
def seekable(self) -> bool: ...
@@ -65,29 +62,27 @@ class HttpResponseBase:
domain: Optional[str] = ...,
secure: Optional[bool] = ...,
httponly: bool = ...,
samesite: Optional[str] = ...
samesite: Optional[str] = ...,
) -> None: ...
def set_signed_cookie(
self, key: str, value: str, salt: str = ..., **kwargs
) -> 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,
@@ -95,18 +90,21 @@ class JsonResponse:
encoder: Type[DjangoJSONEncoder] = ...,
safe: bool = ...,
json_dumps_params: None = ...,
**kwargs
**kwargs,
) -> None: ...
class StreamingHttpResponse:
def __init__(
self,
streaming_content: Union[_TemporaryFileWrapper, BufferedReader, str, List[str]] = ...,
streaming_content: Union[
_TemporaryFileWrapper, BufferedReader, str, List[str]
] = ...,
*args,
**kwargs
**kwargs,
) -> None: ...
def __iter__(self) -> map: ...
def _set_streaming_content(self, value: Union[TextIOWrapper, str, List[str], List[bytes]]) -> None: ...
def _set_streaming_content(
self, value: Union[TextIOWrapper, str, List[str], List[bytes]]
) -> None: ...
@property
def content(self): ...
def content(self): ...