mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-18 01:45:59 +08:00
Add accepts method stub in HttpRequest (#676)
* Add accepts method to HttpRequest stubs The accepts method (and dependencies) was missing in the stub for HttpRequest * Change accepted_types to return correct type * Fix Black formatting * Add annotation for MediaType __init__ args
This commit is contained in:
@@ -70,7 +70,8 @@ class HttpRequest(BytesIO):
|
||||
def scheme(self) -> Optional[str]: ...
|
||||
def is_secure(self) -> bool: ...
|
||||
def is_ajax(self) -> bool: ...
|
||||
def accepted_types(self) -> str: ...
|
||||
@property
|
||||
def accepted_types(self) -> List[MediaType]: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def parse_file_upload(
|
||||
self, META: Mapping[str, Any], post_data: BinaryIO
|
||||
@@ -80,6 +81,7 @@ class HttpRequest(BytesIO):
|
||||
@property
|
||||
def body(self) -> bytes: ...
|
||||
def _load_post_and_files(self) -> None: ...
|
||||
def accepts(self, media_type: str) -> bool: ...
|
||||
|
||||
_Q = TypeVar("_Q", bound="QueryDict")
|
||||
|
||||
@@ -102,6 +104,12 @@ class QueryDict(MultiValueDict[str, str]):
|
||||
encoding: Optional[str] = ...,
|
||||
) -> _Q: ...
|
||||
|
||||
class MediaType:
|
||||
def __init__(self, media_type_raw_line: str) -> None: ...
|
||||
@property
|
||||
def is_all_types(self) -> bool: ...
|
||||
def match(self, other) -> bool: ...
|
||||
|
||||
@overload
|
||||
def bytes_to_text(s: bytes, encoding: str) -> str: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user