mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-21 19:32:16 +08:00
third iteration of stubs
This commit is contained in:
@@ -2,6 +2,7 @@ from io import BytesIO
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.test.client import FakePayload
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
RAISE_ERROR: Any
|
||||
@@ -16,10 +17,10 @@ class HttpRequest:
|
||||
get_host: Callable
|
||||
sensitive_post_parameters: str
|
||||
session: django.contrib.sessions.backends.db.SessionStore
|
||||
GET: Union[Dict[str, str], django.http.request.QueryDict] = ...
|
||||
POST: Union[Dict[str, str], django.http.request.QueryDict] = ...
|
||||
GET: Dict[str, str] = ...
|
||||
POST: Dict[str, str] = ...
|
||||
COOKIES: Dict[str, str] = ...
|
||||
META: Dict[str, Union[str, int]] = ...
|
||||
META: Dict[str, Union[int, str]] = ...
|
||||
FILES: django.utils.datastructures.MultiValueDict = ...
|
||||
path: str = ...
|
||||
path_info: str = ...
|
||||
@@ -55,7 +56,14 @@ class HttpRequest:
|
||||
def upload_handlers(self, upload_handlers: Any) -> None: ...
|
||||
upload_handlers: Any = ...
|
||||
def parse_file_upload(
|
||||
self, META: Dict[str, Any], post_data: Union[WSGIRequest, BytesIO]
|
||||
self,
|
||||
META: Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
post_data: Union[BytesIO, WSGIRequest],
|
||||
) -> Tuple[QueryDict, MultiValueDict]: ...
|
||||
@property
|
||||
def body(self) -> bytes: ...
|
||||
@@ -70,15 +78,15 @@ class QueryDict(MultiValueDict):
|
||||
encoding: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
query_string: Optional[Union[str, bytes]] = ...,
|
||||
query_string: Optional[Union[bytes, str]] = ...,
|
||||
mutable: bool = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def fromkeys(
|
||||
cls,
|
||||
iterable: Union[int, List[bytes], str, List[str]],
|
||||
value: Union[str, bytes] = ...,
|
||||
iterable: Union[List[bytes], List[str], int, str],
|
||||
value: Union[bytes, str] = ...,
|
||||
mutable: bool = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
) -> QueryDict: ...
|
||||
@@ -87,7 +95,7 @@ class QueryDict(MultiValueDict):
|
||||
@encoding.setter
|
||||
def encoding(self, value: Any) -> None: ...
|
||||
def __setitem__(
|
||||
self, key: str, value: Optional[Union[str, int]]
|
||||
self, key: str, value: Optional[Union[int, str]]
|
||||
) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __copy__(self) -> QueryDict: ...
|
||||
@@ -97,9 +105,9 @@ class QueryDict(MultiValueDict):
|
||||
self, key: str, default_list: None = ...
|
||||
) -> List[str]: ...
|
||||
def appendlist(
|
||||
self, key: Union[str, bytes], value: Union[str, bytes, List[str]]
|
||||
self, key: Union[bytes, str], value: Union[List[str], bytes, str]
|
||||
) -> None: ...
|
||||
def pop(self, key: str, *args: Any) -> Optional[Union[str, List[str]]]: ...
|
||||
def pop(self, key: str, *args: Any) -> Optional[Union[List[str], str]]: ...
|
||||
def popitem(self) -> Any: ...
|
||||
def clear(self) -> None: ...
|
||||
def setdefault(self, key: str, default: str = ...) -> str: ...
|
||||
@@ -107,7 +115,7 @@ class QueryDict(MultiValueDict):
|
||||
def urlencode(self, safe: Optional[str] = ...) -> str: ...
|
||||
|
||||
def bytes_to_text(
|
||||
s: Optional[Union[str, bytes, int]], encoding: str
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
s: Optional[Union[bytes, int, str]], encoding: str
|
||||
) -> Optional[Union[int, str]]: ...
|
||||
def split_domain_port(host: str) -> Tuple[str, str]: ...
|
||||
def validate_host(host: str, allowed_hosts: Union[str, List[str]]) -> bool: ...
|
||||
def validate_host(host: str, allowed_hosts: Union[List[str], str]) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user