fixes, add some testing folders

This commit is contained in:
Maxim Kurnikov
2019-02-04 19:31:37 +03:00
parent 3dcab64e07
commit 69d4ccaf54
31 changed files with 319 additions and 236 deletions

View File

@@ -1,4 +1,9 @@
from .request import HttpRequest as HttpRequest, QueryDict as QueryDict
from .request import (
HttpRequest as HttpRequest,
QueryDict as QueryDict,
RawPostDataException as RawPostDataException,
UnreadablePostError as UnreadablePostError,
)
from .response import (
BadHeaderError as BadHeaderError,

View File

@@ -1,16 +1,14 @@
# Stubs for django.http.request (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from io import BytesIO
from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern, Tuple, Union
from typing import Any, BinaryIO, Dict, Iterable, List, Mapping, Optional, Pattern, Tuple, Union, overload
from django.contrib.sessions.backends.base import SessionBase
from django.core.files import uploadhandler, uploadedfile
from django.utils.datastructures import MultiValueDict, ImmutableList
from django.utils.datastructures import ImmutableList, MultiValueDict
from django.core.files import uploadedfile, uploadhandler
from django.urls import ResolverMatch
RAISE_ERROR = ... # type: object
host_validation_re = ... # type: Pattern
RAISE_ERROR: object = ...
host_validation_re: Pattern = ...
class UnreadablePostError(IOError): ...
class RawPostDataException(Exception): ...
@@ -21,7 +19,7 @@ class HttpRequest(BytesIO):
GET: QueryDict = ...
POST: QueryDict = ...
COOKIES: Dict[str, str] = ...
META: Dict[str, str] = ...
META: Dict[str, Any] = ...
FILES: MultiValueDict[str, uploadedfile.UploadedFile] = ...
path: str = ...
path_info: str = ...
@@ -30,6 +28,8 @@ class HttpRequest(BytesIO):
content_type: Optional[str] = ...
content_params: Optional[Dict[str, str]] = ...
session: SessionBase
encoding: Optional[str] = ...
upload_handlers: UploadHandlerList = ...
def __init__(self) -> None: ...
def get_host(self) -> str: ...
def get_port(self) -> str: ...
@@ -44,38 +44,23 @@ class HttpRequest(BytesIO):
def scheme(self) -> Optional[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]]: ...
self, META: Mapping[str, Any], post_data: BinaryIO
) -> Tuple[QueryDict, MultiValueDict[str, uploadedfile.UploadedFile]]: ...
@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 xreadlines(self) -> Iterator[bytes]: ...
def __iter__(self) -> Iterator[bytes]: ...
def readlines(self) -> List[bytes]: ... # type: ignore
def _load_post_and_files(self) -> None: ...
class QueryDict(MultiValueDict[str, str]):
encoding = str # type: Any
encoding: Any = ...
_mutable: bool = ...
def __init__(
self, query_string: Union[str, bytes, None] = None, mutable: bool = False, encoding: Optional[str] = None
self, query_string: Optional[Union[str, bytes]] = ..., mutable: bool = ..., encoding: Optional[str] = ...
) -> 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 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: Optional[List[str]] = ...) -> List[str]: ...
def appendlist(self, key: str, value: str) -> None: ...
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 urlencode(self, safe: Optional[str] = ...) -> str: ...
@overload
def bytes_to_text(s: bytes, encoding: str) -> str: ...

View File

@@ -1,7 +1,7 @@
import datetime
from io import BytesIO
from json import JSONEncoder
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload, AnyStr, IO
import six
from django.core.handlers.wsgi import WSGIRequest
@@ -13,10 +13,9 @@ from django.urls import ResolverMatch
class BadHeaderError(ValueError): ...
class HttpResponseBase(six.Iterator):
class HttpResponseBase(BytesIO):
status_code: int = ...
cookies: SimpleCookie = ...
closed: bool = ...
reason_phrase: str = ...
charset: str = ...
def __init__(
@@ -52,18 +51,9 @@ class HttpResponseBase(six.Iterator):
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: ...
def flush(self) -> None: ...
def tell(self) -> int: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...
def writelines(self, lines: Iterable[object]) -> None: ...
class HttpResponse(HttpResponseBase):
client: Client
closed: bool
context: Optional[Context]
csrf_cookie_set: bool
redirect_chain: List[Tuple[str, int]]
@@ -83,26 +73,23 @@ class HttpResponse(HttpResponseBase):
def content(self) -> bytes: ...
@content.setter
def content(self, value: Any) -> None: ...
def __iter__(self) -> Iterator[bytes]: ...
def tell(self) -> int: ...
def getvalue(self) -> bytes: ...
def writable(self) -> bool: ...
@property
def url(self) -> str: ...
def json(self) -> Dict[str, Any]: ...
class StreamingHttpResponse(HttpResponseBase):
def __init__(self, streaming_content: Iterable[bytes] = ..., *args: Any, **kwargs: Any) -> None: ...
def __init__(self, streaming_content: Iterable[AnyStr] = ..., *args: Any, **kwargs: Any) -> None: ...
@property
def content(self) -> bytes: ...
def content(self) -> AnyStr: ...
@content.setter
def content(self, value: Any) -> None: ...
def content(self, value: AnyStr) -> None: ...
@property
def streaming_content(self) -> Iterator[bytes]: ...
def streaming_content(self) -> Iterator[AnyStr]: ...
@streaming_content.setter
def streaming_content(self, value: Iterable[bytes]) -> None: ...
def __iter__(self) -> Iterator[bytes]: ...
def getvalue(self) -> bytes: ...
def streaming_content(self, value: Iterable[AnyStr]) -> None: ...
def __iter__(self) -> Iterator[AnyStr]: ...
def getvalue(self) -> AnyStr: ...
class FileResponse(StreamingHttpResponse):
client: Client