diff --git a/django-stubs/contrib/sessions/backends/base.pyi b/django-stubs/contrib/sessions/backends/base.pyi index 5fcb05e..e3ead61 100644 --- a/django-stubs/contrib/sessions/backends/base.pyi +++ b/django-stubs/contrib/sessions/backends/base.pyi @@ -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: ... diff --git a/django-stubs/http/request.pyi b/django-stubs/http/request.pyi index 821e690..e4abb8a 100644 --- a/django-stubs/http/request.pyi +++ b/django-stubs/http/request.pyi @@ -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]]: ... diff --git a/django-stubs/http/response.pyi b/django-stubs/http/response.pyi index 67ca939..2bc42d2 100644 --- a/django-stubs/http/response.pyi +++ b/django-stubs/http/response.pyi @@ -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):