mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-21 19:32:16 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
from .request import (HttpRequest as HttpRequest,
|
||||
QueryDict as QueryDict)
|
||||
from .request import HttpRequest as HttpRequest, QueryDict as QueryDict
|
||||
|
||||
from .response import (BadHeaderError as BadHeaderError,
|
||||
FileResponse as FileResponse,
|
||||
Http404 as Http404,
|
||||
HttpResponse as HttpResponse,
|
||||
HttpResponseBadRequest as HttpResponseBadRequest,
|
||||
HttpResponseForbidden as HttpResponseForbidden,
|
||||
HttpResponseGone as HttpResponseGone,
|
||||
HttpResponseNotAllowed as HttpResponseNotAllowed,
|
||||
HttpResponseNotFound as HttpResponseNotFound,
|
||||
HttpResponseNotModified as HttpResponseNotModified,
|
||||
HttpResponsePermanentRedirect as HttpResponsePermanentRedirect,
|
||||
HttpResponseRedirect as HttpResponseRedirect,
|
||||
HttpResponseServerError as HttpResponseServerError,
|
||||
JsonResponse as JsonResponse,
|
||||
StreamingHttpResponse as StreamingHttpResponse)
|
||||
from .response import (
|
||||
BadHeaderError as BadHeaderError,
|
||||
FileResponse as FileResponse,
|
||||
Http404 as Http404,
|
||||
HttpResponse as HttpResponse,
|
||||
HttpResponseBadRequest as HttpResponseBadRequest,
|
||||
HttpResponseForbidden as HttpResponseForbidden,
|
||||
HttpResponseGone as HttpResponseGone,
|
||||
HttpResponseNotAllowed as HttpResponseNotAllowed,
|
||||
HttpResponseNotFound as HttpResponseNotFound,
|
||||
HttpResponseNotModified as HttpResponseNotModified,
|
||||
HttpResponsePermanentRedirect as HttpResponsePermanentRedirect,
|
||||
HttpResponseRedirect as HttpResponseRedirect,
|
||||
HttpResponseServerError as HttpResponseServerError,
|
||||
JsonResponse as JsonResponse,
|
||||
StreamingHttpResponse as StreamingHttpResponse,
|
||||
)
|
||||
|
||||
from .cookie import (SimpleCookie as SimpleCookie,
|
||||
parse_cookie as parse_cookie)
|
||||
from .cookie import SimpleCookie as SimpleCookie, parse_cookie as parse_cookie
|
||||
|
||||
@@ -4,88 +4,49 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
from django.http.request import QueryDict
|
||||
from django.utils.datastructures import ImmutableList, MultiValueDict
|
||||
|
||||
|
||||
class MultiPartParserError(Exception): ...
|
||||
|
||||
|
||||
class InputStreamExhausted(Exception): ...
|
||||
|
||||
|
||||
class MultiPartParser:
|
||||
def __init__(
|
||||
self,
|
||||
META: Dict[str, Any],
|
||||
input_data: BytesIO,
|
||||
upload_handlers: Union[List[Any], ImmutableList],
|
||||
encoding: Optional[str] = ...,
|
||||
self,
|
||||
META: Dict[str, Any],
|
||||
input_data: BytesIO,
|
||||
upload_handlers: Union[List[Any], ImmutableList],
|
||||
encoding: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
|
||||
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
|
||||
|
||||
def handle_file_complete(
|
||||
self, old_field_name: str, counters: List[int]
|
||||
) -> None: ...
|
||||
|
||||
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 __init__(self, producer: Union[BoundaryIter, ChunkIter], length: None = ...) -> None: ...
|
||||
def tell(self): ...
|
||||
|
||||
def read(self, size: Optional[int] = ...) -> bytes: ...
|
||||
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
|
||||
def __iter__(self) -> LazyStream: ...
|
||||
|
||||
def unget(self, bytes: bytes) -> None: ...
|
||||
|
||||
|
||||
class ChunkIter:
|
||||
flo: BytesIO = ...
|
||||
chunk_size: int = ...
|
||||
|
||||
def __init__(
|
||||
self, flo: BytesIO, chunk_size: int = ...
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self, flo: 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 BoundaryIter:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
|
||||
def __iter__(self): ...
|
||||
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
|
||||
class Parser:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
|
||||
def __iter__(
|
||||
self
|
||||
) -> Iterator[
|
||||
Tuple[
|
||||
str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream
|
||||
]
|
||||
]: ...
|
||||
def __iter__(self) -> Iterator[Tuple[str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream]]: ...
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import (Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern,
|
||||
Tuple, Union)
|
||||
from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern, Tuple, Union
|
||||
|
||||
from django.core.files import uploadhandler, uploadedfile
|
||||
from django.utils.datastructures import MultiValueDict, ImmutableList
|
||||
@@ -15,8 +14,7 @@ host_validation_re = ... # type: Pattern
|
||||
class UnreadablePostError(IOError): ...
|
||||
class RawPostDataException(Exception): ...
|
||||
|
||||
UploadHandlerList = Union[List[uploadhandler.FileUploadHandler],
|
||||
ImmutableList[uploadhandler.FileUploadHandler]]
|
||||
UploadHandlerList = Union[List[uploadhandler.FileUploadHandler], ImmutableList[uploadhandler.FileUploadHandler]]
|
||||
|
||||
class HttpRequest(BinaryIO):
|
||||
GET = ... # type: QueryDict
|
||||
@@ -33,17 +31,19 @@ class HttpRequest(BinaryIO):
|
||||
def __init__(self) -> None: ...
|
||||
def get_host(self) -> str: ...
|
||||
def get_port(self) -> str: ...
|
||||
def get_full_path(self, force_append_slash: bool=False) -> str: ...
|
||||
def get_signed_cookie(self, key: str, default: str=..., salt: str='', max_age: int=None) -> str: ...
|
||||
def get_full_path(self, force_append_slash: bool = False) -> str: ...
|
||||
def get_signed_cookie(self, key: str, default: str = ..., salt: str = "", max_age: int = None) -> str: ...
|
||||
def get_raw_uri(self) -> str: ...
|
||||
def build_absolute_uri(self, location: str=None) -> str: ...
|
||||
def build_absolute_uri(self, location: str = None) -> str: ...
|
||||
@property
|
||||
def scheme(self) -> str: ...
|
||||
def is_secure(self) -> bool: ...
|
||||
def is_ajax(self) -> bool: ...
|
||||
encoding = ... # type: Optional[str]
|
||||
upload_handlers = ... # type: UploadHandlerList
|
||||
def parse_file_upload(self, META: Dict[str, str], post_data: BinaryIO) -> Tuple['QueryDict', MultiValueDict[str, uploadedfile.UploadedFile]]: ...
|
||||
encoding = ... # type: Optional[str]
|
||||
upload_handlers = ... # type: UploadHandlerList
|
||||
def parse_file_upload(
|
||||
self, META: Dict[str, str], post_data: BinaryIO
|
||||
) -> Tuple["QueryDict", MultiValueDict[str, uploadedfile.UploadedFile]]: ...
|
||||
@property
|
||||
def body(self) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -55,20 +55,22 @@ class HttpRequest(BinaryIO):
|
||||
|
||||
class QueryDict(MultiValueDict[str, str]):
|
||||
encoding = str # type: Any
|
||||
def __init__(self, query_string: Union[str, bytes, None]=None, mutable: bool=False, encoding: Optional[str]=None) -> None: ...
|
||||
def __init__(
|
||||
self, query_string: Union[str, bytes, None] = None, mutable: bool = False, encoding: Optional[str] = None
|
||||
) -> None: ...
|
||||
def __setitem__(self, key: str, value: str) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __copy__(self) -> 'QueryDict': ...
|
||||
def __deepcopy__(self, memo: Dict[int, object]) -> 'QueryDict': ...
|
||||
def __copy__(self) -> "QueryDict": ...
|
||||
def __deepcopy__(self, memo: Dict[int, object]) -> "QueryDict": ...
|
||||
def setlist(self, key: str, list_: List[str]) -> None: ...
|
||||
def setlistdefault(self, key: str, default_list: List[str]=None) -> List[str]: ...
|
||||
def setlistdefault(self, key: str, default_list: List[str] = None) -> List[str]: ...
|
||||
def appendlist(self, key: str, value: str) -> None: ...
|
||||
def pop(self, key: str, default: List[str]=None) -> List[str]: ... # type: ignore
|
||||
def pop(self, key: str, default: List[str] = None) -> List[str]: ... # type: ignore
|
||||
def popitem(self) -> Tuple[str, str]: ...
|
||||
def clear(self) -> None: ...
|
||||
def setdefault(self, key: str, default: Optional[str]=None) -> str: ...
|
||||
def copy(self) -> 'QueryDict': ...
|
||||
def urlencode(self, safe: Optional[str]=None) -> str: ...
|
||||
def setdefault(self, key: str, default: Optional[str] = None) -> str: ...
|
||||
def copy(self) -> "QueryDict": ...
|
||||
def urlencode(self, safe: Optional[str] = None) -> str: ...
|
||||
|
||||
@overload
|
||||
def bytes_to_text(s: bytes, encoding: str) -> str: ...
|
||||
|
||||
@@ -13,9 +13,9 @@ class HttpResponseBase(six.Iterator):
|
||||
status_code = ... # type: int
|
||||
cookies = ... # type: SimpleCookie
|
||||
closed = ... # type: bool
|
||||
reason_phrase = ... # type: str
|
||||
charset = ... # type: str
|
||||
def __init__(self, content_type: str=None, status: int=None, reason: str=None, charset: str=None) -> None: ...
|
||||
reason_phrase = ... # type: str
|
||||
charset = ... # type: str
|
||||
def __init__(self, content_type: str = None, status: int = None, reason: str = None, charset: str = None) -> None: ...
|
||||
def serialize_headers(self) -> bytes: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def __setitem__(self, header: str, value: Union[str, bytes]) -> None: ...
|
||||
@@ -28,10 +28,20 @@ class HttpResponseBase(six.Iterator):
|
||||
def get(self, header: str, alternate: str) -> str: ...
|
||||
@overload
|
||||
def get(self, header: str) -> Optional[str]: ...
|
||||
def set_cookie(self, key: str, value: str='', max_age: int=None, expires: Union[str, datetime.datetime]=None, path: str='', domain: str=None, secure: bool=False, httponly: bool=False) -> None: ...
|
||||
def set_cookie(
|
||||
self,
|
||||
key: str,
|
||||
value: str = "",
|
||||
max_age: int = None,
|
||||
expires: Union[str, datetime.datetime] = None,
|
||||
path: str = "",
|
||||
domain: str = None,
|
||||
secure: bool = False,
|
||||
httponly: bool = False,
|
||||
) -> None: ...
|
||||
def setdefault(self, key: str, value: str) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str='', **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str='', domain: str=None) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str = "", **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = "", domain: str = None) -> None: ...
|
||||
def make_bytes(self, value: object) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, content: object) -> None: ...
|
||||
@@ -44,7 +54,7 @@ class HttpResponseBase(six.Iterator):
|
||||
|
||||
class HttpResponse(HttpResponseBase):
|
||||
streaming = ... # type: bool
|
||||
def __init__(self, content: object=b'', *args: Any, **kwargs: Any) -> None: ...
|
||||
def __init__(self, content: object = b"", *args: Any, **kwargs: Any) -> None: ...
|
||||
def serialize(self) -> bytes: ...
|
||||
@property
|
||||
def content(self) -> bytes: ...
|
||||
@@ -54,7 +64,7 @@ class HttpResponse(HttpResponseBase):
|
||||
def getvalue(self) -> bytes: ...
|
||||
|
||||
class StreamingHttpResponse(HttpResponseBase):
|
||||
def __init__(self, streaming_content: Iterable[bytes]=..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def __init__(self, streaming_content: Iterable[bytes] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def content(self) -> bytes: ...
|
||||
@property
|
||||
@@ -73,26 +83,28 @@ class HttpResponseRedirectBase(HttpResponse):
|
||||
def url(self) -> str: ...
|
||||
|
||||
class HttpResponseRedirect(HttpResponseRedirectBase): ...
|
||||
|
||||
class HttpResponsePermanentRedirect(HttpResponseRedirectBase): ...
|
||||
|
||||
class HttpResponseNotModified(HttpResponse):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class HttpResponseBadRequest(HttpResponse): ...
|
||||
|
||||
class HttpResponseNotFound(HttpResponse): ...
|
||||
|
||||
class HttpResponseForbidden(HttpResponse): ...
|
||||
|
||||
class HttpResponseNotAllowed(HttpResponse):
|
||||
def __init__(self, permitted_methods: Iterable[str], *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class HttpResponseGone(HttpResponse): ...
|
||||
|
||||
class HttpResponseServerError(HttpResponse): ...
|
||||
|
||||
class Http404(Exception): ...
|
||||
|
||||
class JsonResponse(HttpResponse):
|
||||
def __init__(self, data: object, encoder: Type[JSONEncoder]=..., safe: bool=True, json_dumps_params: Dict[str, Any]=None, **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
data: object,
|
||||
encoder: Type[JSONEncoder] = ...,
|
||||
safe: bool = True,
|
||||
json_dumps_params: Dict[str, Any] = None,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user