integrate more stubs

This commit is contained in:
Maxim Kurnikov
2018-11-13 21:10:56 +03:00
parent 6de735a7bb
commit 9a68263257
17 changed files with 419 additions and 109 deletions

View File

@@ -1,21 +1,20 @@
from django.http.cookie import SimpleCookie, parse_cookie
from django.http.request import (
HttpRequest, QueryDict, RawPostDataException, UnreadablePostError,
)
from django.http.response import (
BadHeaderError, FileResponse, Http404, HttpResponse,
HttpResponseBadRequest, HttpResponseForbidden, HttpResponseGone,
HttpResponseNotAllowed, HttpResponseNotFound, HttpResponseNotModified,
HttpResponsePermanentRedirect, HttpResponseRedirect,
HttpResponseServerError, JsonResponse, StreamingHttpResponse,
)
from .request import (HttpRequest as HttpRequest)
__all__ = [
'SimpleCookie', 'parse_cookie', 'HttpRequest', 'QueryDict',
'RawPostDataException', 'UnreadablePostError',
'HttpResponse', 'StreamingHttpResponse', 'HttpResponseRedirect',
'HttpResponsePermanentRedirect', 'HttpResponseNotModified',
'HttpResponseBadRequest', 'HttpResponseForbidden', 'HttpResponseNotFound',
'HttpResponseNotAllowed', 'HttpResponseGone', 'HttpResponseServerError',
'Http404', 'BadHeaderError', 'JsonResponse', 'FileResponse',
]
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)

View File

@@ -1,8 +1,5 @@
# Stubs for django.http.cookie (Python 3.5)
from typing import Any, Dict
from typing import Dict
from http.cookies import SimpleCookie, Morsel
cookie_pickles_properly = ... # type: bool
SimpleCookie: Any
def parse_cookie(cookie: str) -> Dict[str, str]: ...

View File

@@ -0,0 +1,91 @@
from io import BytesIO
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] = ...,
) -> 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 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 __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
]
]: ...