Added a few definitions to resolve incompatibily with Pyre/Pysa (#601)

This commit is contained in:
Maxim Masiutin
2021-04-24 08:24:49 +03:00
committed by GitHub
parent 9e8e4363b1
commit c633f3215f
3 changed files with 9 additions and 1 deletions

View File

@@ -24,7 +24,10 @@ class SessionBase(Dict[str, Any]):
def items(self): ...
def clear(self) -> None: ...
def is_empty(self) -> bool: ...
session_key: Any = ...
def _get_session_key(self) -> str: ...
def _set_session_key(self, value: str) -> None: ...
session_key = property(_get_session_key)
_session_key = property(_get_session_key, _set_session_key)
def get_expiry_age(self, **kwargs: Any) -> int: ...
def get_expiry_date(self, **kwargs: Any) -> datetime: ...
def set_expiry(self, value: Optional[Union[datetime, int]]) -> None: ...

View File

@@ -71,6 +71,8 @@ class HttpRequest(BytesIO):
def scheme(self) -> Optional[str]: ...
def is_secure(self) -> bool: ...
def is_ajax(self) -> bool: ...
def accepted_types(self) -> str: ...
def __repr__(self) -> str: ...
def parse_file_upload(
self, META: Mapping[str, Any], post_data: BinaryIO
) -> Tuple[QueryDict, MultiValueDict[str, uploadedfile.UploadedFile]]: ...

View File

@@ -37,6 +37,7 @@ class HttpResponseBase(Iterable[Any]):
headers: Optional[Dict[str, str]] = ...,
) -> None: ...
def serialize_headers(self) -> bytes: ...
__bytes__ = serialize_headers
def __setitem__(self, header: Union[str, bytes], value: Union[str, bytes, int]) -> None: ...
def __delitem__(self, header: Union[str, bytes]) -> None: ...
def __getitem__(self, header: Union[str, bytes]) -> str: ...
@@ -83,6 +84,7 @@ class HttpResponse(HttpResponseBase):
streaming: bool = ...
def __init__(self, content: object = ..., *args: Any, **kwargs: Any) -> None: ...
def serialize(self) -> bytes: ...
__bytes__ = serialize
@property
def url(self) -> str: ...
# Attributes assigned by monkey-patching in test client ClientHandler.__call__()
@@ -94,6 +96,7 @@ class HttpResponse(HttpResponseBase):
context: Context
resolver_match: ResolverMatch
def json(self) -> Any: ...
def __iter__(self): ...
def getvalue(self) -> bytes: ...
class StreamingHttpResponse(HttpResponseBase):