mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 21:14:49 +08:00
cleanup core.handlers.wsgi
This commit is contained in:
@@ -1,79 +1,85 @@
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Any, Callable, Dict, Optional, Tuple, Union
|
from typing import Any, Callable, Dict, Optional, Union
|
||||||
|
|
||||||
|
from django.contrib.auth.models import AbstractUser
|
||||||
|
from django.contrib.sessions.backends.base import SessionBase
|
||||||
from django.core.handlers import base
|
from django.core.handlers import base
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.http.request import QueryDict
|
from django.http.request import QueryDict
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.test.client import FakePayload
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
|
||||||
|
|
||||||
|
_Stream = Union[BytesIO, str]
|
||||||
|
|
||||||
|
|
||||||
class LimitedStream:
|
class LimitedStream:
|
||||||
stream: django.test.client.FakePayload = ...
|
stream: _Stream = ...
|
||||||
remaining: int = ...
|
remaining: int = ...
|
||||||
buffer: bytes = ...
|
buffer: bytes = ...
|
||||||
buf_size: int = ...
|
buf_size: int = ...
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
stream: Union[BytesIO, FakePayload, str],
|
stream: _Stream,
|
||||||
limit: int,
|
limit: int,
|
||||||
buf_size: int = ...,
|
buf_size: int = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
def read(self, size: Optional[int] = ...) -> bytes: ...
|
def read(self, size: Optional[int] = ...) -> bytes: ...
|
||||||
|
|
||||||
def readline(self, size: Optional[int] = ...) -> bytes: ...
|
def readline(self, size: Optional[int] = ...) -> bytes: ...
|
||||||
|
|
||||||
|
|
||||||
class WSGIRequest(HttpRequest):
|
class WSGIRequest(HttpRequest):
|
||||||
content_params: Dict[str, str]
|
content_params: Dict[str, str]
|
||||||
content_type: str
|
content_type: str
|
||||||
environ: Dict[
|
environ: Dict[str, Any] = ...
|
||||||
str,
|
|
||||||
Union[
|
|
||||||
Tuple[int, int],
|
|
||||||
_io.BytesIO,
|
|
||||||
django.test.client.FakePayload,
|
|
||||||
int,
|
|
||||||
str,
|
|
||||||
],
|
|
||||||
] = ...
|
|
||||||
path_info: str = ...
|
path_info: str = ...
|
||||||
path: str = ...
|
path: str = ...
|
||||||
META: Dict[
|
user: AbstractUser
|
||||||
str,
|
session: SessionBase
|
||||||
Union[
|
|
||||||
Tuple[int, int],
|
META: Dict[str, Any] = ...
|
||||||
_io.BytesIO,
|
|
||||||
django.test.client.FakePayload,
|
|
||||||
int,
|
|
||||||
str,
|
|
||||||
],
|
|
||||||
] = ...
|
|
||||||
method: str = ...
|
method: str = ...
|
||||||
encoding: Any = ...
|
encoding: Any = ...
|
||||||
resolver_match: None = ...
|
resolver_match: None = ...
|
||||||
|
|
||||||
def __init__(self, environ: Dict[str, Any]) -> None: ...
|
def __init__(self, environ: Dict[str, Any]) -> None: ...
|
||||||
|
|
||||||
def GET(self) -> QueryDict: ...
|
def GET(self) -> QueryDict: ...
|
||||||
|
|
||||||
def COOKIES(self) -> Dict[str, str]: ...
|
def COOKIES(self) -> Dict[str, str]: ...
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def FILES(self) -> MultiValueDict: ...
|
def FILES(self) -> MultiValueDict: ...
|
||||||
|
|
||||||
POST: Any = ...
|
POST: Any = ...
|
||||||
|
|
||||||
|
|
||||||
class WSGIHandler(base.BaseHandler):
|
class WSGIHandler(base.BaseHandler):
|
||||||
request_class: Any = ...
|
request_class: Any = ...
|
||||||
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
def __call__(
|
def __call__(
|
||||||
self,
|
self,
|
||||||
environ: Dict[
|
environ: Dict[str, Any],
|
||||||
str, Union[Tuple[int, int], BytesIO, FakePayload, int, str]
|
start_response: Callable,
|
||||||
],
|
|
||||||
start_response: Callable,
|
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
|
|
||||||
|
|
||||||
def get_path_info(environ: Dict[str, Any]) -> str: ...
|
def get_path_info(environ: Dict[str, Any]) -> str: ...
|
||||||
|
|
||||||
|
|
||||||
def get_script_name(environ: Dict[str, Any]) -> str: ...
|
def get_script_name(environ: Dict[str, Any]) -> str: ...
|
||||||
|
|
||||||
|
|
||||||
def get_bytes_from_wsgi(
|
def get_bytes_from_wsgi(
|
||||||
environ: Dict[str, Any], key: str, default: str
|
environ: Dict[str, Any], key: str, default: str
|
||||||
) -> bytes: ...
|
) -> bytes: ...
|
||||||
|
|
||||||
|
|
||||||
def get_str_from_wsgi(
|
def get_str_from_wsgi(
|
||||||
environ: Dict[str, Any], key: str, default: str
|
environ: Dict[str, Any], key: str, default: str
|
||||||
) -> str: ...
|
) -> str: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user