mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 21:46:43 +08:00
move generated stubs to separate directory, too messty
This commit is contained in:
26
django-stubs-generated/http/__init__.pyi
Normal file
26
django-stubs-generated/http/__init__.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
from django.http.cookie import (
|
||||
SimpleCookie as SimpleCookie,
|
||||
parse_cookie as parse_cookie
|
||||
)
|
||||
from django.http.request import (
|
||||
HttpRequest as HttpRequest,
|
||||
QueryDict as QueryDict,
|
||||
RawPostDataException as RawPostDataException,
|
||||
UnreadablePostError as UnreadablePostError,
|
||||
)
|
||||
from django.http.response import (
|
||||
BadHeaderError as BadHeaderError,
|
||||
FileResponse as FileResponse,
|
||||
Http404 as Http404,
|
||||
HttpResponse as HttpResponse,
|
||||
HttpResponseBadRequest as HttpResponseBadRequest,
|
||||
HttpResponseForbidden as HttpResponseForbidden,
|
||||
HttpResponseGone as HttpResponseGone,
|
||||
HttpResponseNotAllowed as HttpResponseNotAllowed,
|
||||
HttpResponseNotFound as HttpResponseNotFound,
|
||||
HttpResponseNotModified as HttpResponseNotModified,
|
||||
HttpResponsePermanentRedirect as HttpResponsePermanentRedirect,
|
||||
HttpResponseRedirect as HttpResponseRedirect,
|
||||
HttpResponseServerError as HttpResponseServerError,
|
||||
JsonResponse as JsonResponse, StreamingHttpResponse as StreamingHttpResponse
|
||||
)
|
||||
5
django-stubs-generated/http/cookie.pyi
Normal file
5
django-stubs-generated/http/cookie.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from typing import Any, Dict
|
||||
|
||||
SimpleCookie: Any
|
||||
|
||||
def parse_cookie(cookie: str) -> Dict[str, str]: ...
|
||||
66
django-stubs-generated/http/multipartparser.pyi
Normal file
66
django-stubs-generated/http/multipartparser.pyi
Normal file
@@ -0,0 +1,66 @@
|
||||
from io import BytesIO, StringIO
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import QueryDict
|
||||
from django.utils.datastructures import ImmutableList, MultiValueDict
|
||||
|
||||
|
||||
class MultiPartParserError(Exception): ...
|
||||
class InputStreamExhausted(Exception): ...
|
||||
|
||||
class MultiPartParser:
|
||||
def __init__(
|
||||
self,
|
||||
META: Dict[str, Any],
|
||||
input_data: Union[BytesIO, StringIO, WSGIRequest],
|
||||
upload_handlers: Union[List[Any], ImmutableList],
|
||||
encoding: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
|
||||
def handle_file_complete(
|
||||
self, old_field_name: str, counters: List[int]
|
||||
) -> None: ...
|
||||
def IE_sanitize(self, filename: str) -> str: ...
|
||||
|
||||
class LazyStream:
|
||||
length: None = ...
|
||||
position: int = ...
|
||||
def __init__(
|
||||
self, producer: Union[BoundaryIter, ChunkIter], length: None = ...
|
||||
) -> None: ...
|
||||
def tell(self): ...
|
||||
def read(self, size: Optional[int] = ...) -> bytes: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def __iter__(self) -> LazyStream: ...
|
||||
def unget(self, bytes: bytes) -> None: ...
|
||||
|
||||
class ChunkIter:
|
||||
flo: Union[_io.BytesIO, django.core.handlers.wsgi.WSGIRequest] = ...
|
||||
chunk_size: int = ...
|
||||
def __init__(
|
||||
self, flo: Union[BytesIO, WSGIRequest], chunk_size: int = ...
|
||||
) -> None: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
def __iter__(self): ...
|
||||
|
||||
class InterBoundaryIter:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
def __iter__(self) -> InterBoundaryIter: ...
|
||||
def __next__(self) -> LazyStream: ...
|
||||
|
||||
class BoundaryIter:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
class Parser:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
def __iter__(
|
||||
self
|
||||
) -> Iterator[
|
||||
Tuple[
|
||||
str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream
|
||||
]
|
||||
]: ...
|
||||
114
django-stubs-generated/http/request.pyi
Normal file
114
django-stubs-generated/http/request.pyi
Normal file
@@ -0,0 +1,114 @@
|
||||
from io import BytesIO
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union, Callable
|
||||
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
RAISE_ERROR: Any
|
||||
host_validation_re: Any
|
||||
|
||||
class UnreadablePostError(IOError): ...
|
||||
class RawPostDataException(Exception): ...
|
||||
|
||||
class HttpRequest:
|
||||
csrf_cookie_needs_reset: bool
|
||||
csrf_processing_done: bool
|
||||
get_host: Callable
|
||||
sensitive_post_parameters: str
|
||||
session: SessionStore
|
||||
GET: Union[Dict[str, str], QueryDict] = ...
|
||||
POST: Union[Dict[str, str], QueryDict] = ...
|
||||
COOKIES: Dict[str, str] = ...
|
||||
META: Dict[str, Union[int, str]] = ...
|
||||
FILES: MultiValueDict = ...
|
||||
path: str = ...
|
||||
path_info: str = ...
|
||||
method: Optional[str] = ...
|
||||
resolver_match: None = ...
|
||||
content_type: None = ...
|
||||
content_params: None = ...
|
||||
def __init__(self) -> None: ...
|
||||
def get_host(self) -> str: ...
|
||||
def get_port(self) -> str: ...
|
||||
def get_full_path(self, force_append_slash: bool = ...) -> str: ...
|
||||
def get_full_path_info(self, force_append_slash: bool = ...) -> str: ...
|
||||
def get_signed_cookie(
|
||||
self,
|
||||
key: str,
|
||||
default: Any = ...,
|
||||
salt: str = ...,
|
||||
max_age: Optional[int] = ...,
|
||||
) -> Optional[str]: ...
|
||||
def get_raw_uri(self) -> str: ...
|
||||
def build_absolute_uri(self, location: Optional[str] = ...) -> str: ...
|
||||
@property
|
||||
def scheme(self) -> Optional[str]: ...
|
||||
def is_secure(self) -> bool: ...
|
||||
def is_ajax(self) -> bool: ...
|
||||
@property
|
||||
def encoding(self): ...
|
||||
@encoding.setter
|
||||
def encoding(self, val: Any) -> None: ...
|
||||
@property
|
||||
def upload_handlers(self): ...
|
||||
@upload_handlers.setter
|
||||
def upload_handlers(self, upload_handlers: Any) -> None: ...
|
||||
upload_handlers: Any = ...
|
||||
def parse_file_upload(
|
||||
self, META: Dict[str, Any], post_data: Union[BytesIO, WSGIRequest]
|
||||
) -> Tuple[QueryDict, MultiValueDict]: ...
|
||||
@property
|
||||
def body(self) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def read(self, *args: Any, **kwargs: Any) -> bytes: ...
|
||||
def readline(self, *args: Any, **kwargs: Any) -> bytes: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def xreadlines(self) -> None: ...
|
||||
def readlines(self): ...
|
||||
|
||||
class QueryDict(MultiValueDict):
|
||||
encoding: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
query_string: Optional[Union[bytes, str]] = ...,
|
||||
mutable: bool = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def fromkeys(
|
||||
cls,
|
||||
iterable: Union[List[bytes], List[str], int, str],
|
||||
value: Union[bytes, str] = ...,
|
||||
mutable: bool = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
) -> QueryDict: ...
|
||||
@property
|
||||
def encoding(self): ...
|
||||
@encoding.setter
|
||||
def encoding(self, value: Any) -> None: ...
|
||||
def __setitem__(
|
||||
self, key: str, value: Optional[Union[int, str]]
|
||||
) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __copy__(self) -> QueryDict: ...
|
||||
def __deepcopy__(self, memo: Dict[Any, Any]) -> QueryDict: ...
|
||||
def setlist(self, key: str, list_: List[str]) -> None: ...
|
||||
def setlistdefault(
|
||||
self, key: str, default_list: None = ...
|
||||
) -> List[str]: ...
|
||||
def appendlist(
|
||||
self, key: Union[bytes, str], value: Union[List[str], bytes, str]
|
||||
) -> None: ...
|
||||
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: ...
|
||||
def copy(self) -> QueryDict: ...
|
||||
def urlencode(self, safe: Optional[str] = ...) -> str: ...
|
||||
|
||||
def bytes_to_text(
|
||||
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[List[str], str]) -> bool: ...
|
||||
302
django-stubs-generated/http/response.pyi
Normal file
302
django-stubs-generated/http/response.pyi
Normal file
@@ -0,0 +1,302 @@
|
||||
import functools
|
||||
import io
|
||||
import tempfile
|
||||
from datetime import datetime
|
||||
from io import BufferedReader, BytesIO
|
||||
from tempfile import _TemporaryFileWrapper
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||
from http import cookies
|
||||
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.template import Template
|
||||
from django.template.context import Context
|
||||
from django.test import Client
|
||||
from django.test.client import FakePayload
|
||||
from django.urls import ResolverMatch
|
||||
|
||||
|
||||
class BadHeaderError(ValueError): ...
|
||||
|
||||
class HttpResponseBase:
|
||||
status_code: int = ...
|
||||
cookies: cookies.SimpleCookie = ...
|
||||
closed: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Any = ...,
|
||||
reason: Optional[str] = ...,
|
||||
charset: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def reason_phrase(self): ...
|
||||
@reason_phrase.setter
|
||||
def reason_phrase(self, value: Any) -> None: ...
|
||||
@property
|
||||
def charset(self): ...
|
||||
@charset.setter
|
||||
def charset(self, value: Any) -> None: ...
|
||||
def serialize_headers(self) -> bytes: ...
|
||||
__bytes__: Any = ...
|
||||
def __setitem__(
|
||||
self, header: Union[bytes, str], value: Union[bytes, int, str]
|
||||
) -> None: ...
|
||||
def __delitem__(self, header: str) -> None: ...
|
||||
def __getitem__(self, header: str) -> str: ...
|
||||
def has_header(self, header: str) -> bool: ...
|
||||
__contains__: Any = ...
|
||||
def items(self): ...
|
||||
def get(
|
||||
self, header: str, alternate: Optional[Union[Tuple, str]] = ...
|
||||
) -> Optional[Union[Tuple, str]]: ...
|
||||
def set_cookie(
|
||||
self,
|
||||
key: str,
|
||||
value: str = ...,
|
||||
max_age: Optional[int] = ...,
|
||||
expires: Optional[Union[datetime, str]] = ...,
|
||||
path: str = ...,
|
||||
domain: Optional[str] = ...,
|
||||
secure: Optional[bool] = ...,
|
||||
httponly: Optional[bool] = ...,
|
||||
samesite: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def setdefault(self, key: str, value: str) -> None: ...
|
||||
def set_signed_cookie(
|
||||
self, key: str, value: str, salt: str = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def delete_cookie(
|
||||
self, key: str, path: str = ..., domain: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def make_bytes(self, value: Union[bytes, int, str]) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, content: str) -> Any: ...
|
||||
def flush(self) -> None: ...
|
||||
def tell(self) -> Any: ...
|
||||
def readable(self) -> bool: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def writelines(self, lines: List[str]) -> Any: ...
|
||||
|
||||
class HttpResponse(HttpResponseBase):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: Optional[Context]
|
||||
cookies: cookies.SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
redirect_chain: List[Tuple[str, int]]
|
||||
request: Dict[str, Union[FakePayload, int, str]]
|
||||
resolver_match: ResolverMatch
|
||||
sameorigin: bool
|
||||
status_code: int
|
||||
templates: List[Template]
|
||||
test_server_port: str
|
||||
test_was_secure_request: bool
|
||||
wsgi_request: WSGIRequest
|
||||
xframe_options_exempt: bool
|
||||
streaming: bool = ...
|
||||
content: Any = ...
|
||||
def __init__(
|
||||
self, content: Any = ..., *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def serialize(self): ...
|
||||
__bytes__: Any = ...
|
||||
@property
|
||||
def content(self): ...
|
||||
@content.setter
|
||||
def content(self, value: Any) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def write(self, content: Union[bytes, str]) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
def getvalue(self) -> bytes: ...
|
||||
def writable(self) -> bool: ...
|
||||
def writelines(self, lines: List[str]) -> None: ...
|
||||
|
||||
class StreamingHttpResponse(HttpResponseBase):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: None
|
||||
cookies: cookies.SimpleCookie
|
||||
json: functools.partial
|
||||
request: Dict[str, Union[FakePayload, int, str]]
|
||||
resolver_match: ResolverMatch
|
||||
status_code: int
|
||||
templates: List[Any]
|
||||
wsgi_request: WSGIRequest
|
||||
streaming: bool = ...
|
||||
streaming_content: Any = ...
|
||||
def __init__(
|
||||
self, streaming_content: Any = ..., *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
@property
|
||||
def content(self) -> Any: ...
|
||||
@property
|
||||
def streaming_content(self): ...
|
||||
@streaming_content.setter
|
||||
def streaming_content(self, value: Any) -> None: ...
|
||||
def __iter__(self) -> map: ...
|
||||
def getvalue(self) -> bytes: ...
|
||||
|
||||
class FileResponse(StreamingHttpResponse):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: None
|
||||
cookies: cookies.SimpleCookie
|
||||
file_to_stream: Optional[
|
||||
Union[
|
||||
io.BufferedReader,
|
||||
io.BytesIO,
|
||||
ContentFile,
|
||||
tempfile._TemporaryFileWrapper,
|
||||
]
|
||||
]
|
||||
json: functools.partial
|
||||
request: Dict[str, str]
|
||||
resolver_match: ResolverMatch
|
||||
templates: List[Any]
|
||||
wsgi_request: WSGIRequest
|
||||
block_size: int = ...
|
||||
as_attachment: bool = ...
|
||||
filename: str = ...
|
||||
def __init__(
|
||||
self,
|
||||
*args: Any,
|
||||
as_attachment: bool = ...,
|
||||
filename: str = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def set_headers(
|
||||
self,
|
||||
filelike: Union[
|
||||
BufferedReader, BytesIO, ContentFile, _TemporaryFileWrapper
|
||||
],
|
||||
) -> None: ...
|
||||
|
||||
class HttpResponseRedirectBase(HttpResponse):
|
||||
allowed_schemes: Any = ...
|
||||
def __init__(self, redirect_to: str, *args: Any, **kwargs: Any) -> None: ...
|
||||
url: Any = ...
|
||||
|
||||
class HttpResponseRedirect(HttpResponseRedirectBase):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: Optional[Context]
|
||||
cookies: cookies.SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
redirect_chain: List[Tuple[str, int]]
|
||||
request: Dict[
|
||||
str, Union[Dict[str, str], FakePayload, int, str]
|
||||
]
|
||||
resolver_match: ResolverMatch
|
||||
templates: List[Template]
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class HttpResponsePermanentRedirect(HttpResponseRedirectBase):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: None
|
||||
cookies: cookies.SimpleCookie
|
||||
json: functools.partial
|
||||
redirect_chain: List[Tuple[str, int]]
|
||||
request: Dict[str, str]
|
||||
resolver_match: ResolverMatch
|
||||
templates: List[Any]
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class HttpResponseNotModified(HttpResponse):
|
||||
closed: bool
|
||||
cookies: cookies.SimpleCookie
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def content(self, value: Any) -> None: ...
|
||||
|
||||
class HttpResponseBadRequest(HttpResponse):
|
||||
closed: bool
|
||||
cookies: cookies.SimpleCookie
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class HttpResponseNotFound(HttpResponse):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: Optional[Context]
|
||||
cookies: cookies.SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
request: Dict[str, str]
|
||||
resolver_match: ResolverMatch
|
||||
templates: List[Template]
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class HttpResponseForbidden(HttpResponse):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: Optional[Context]
|
||||
cookies: cookies.SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
request: Dict[str, Union[FakePayload, int, str]]
|
||||
resolver_match: ResolverMatch
|
||||
templates: List[Template]
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class HttpResponseNotAllowed(HttpResponse):
|
||||
closed: bool
|
||||
cookies: cookies.SimpleCookie
|
||||
status_code: int = ...
|
||||
def __init__(
|
||||
self,
|
||||
permitted_methods: Union[List[str], Tuple[str, str]],
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
class HttpResponseGone(HttpResponse):
|
||||
closed: bool
|
||||
cookies: cookies.SimpleCookie
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class HttpResponseServerError(HttpResponse):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: Context
|
||||
cookies: cookies.SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
request: Dict[str, str]
|
||||
resolver_match: ResolverMatch
|
||||
templates: List[Template]
|
||||
wsgi_request: WSGIRequest
|
||||
status_code: int = ...
|
||||
|
||||
class Http404(Exception): ...
|
||||
|
||||
class JsonResponse(HttpResponse):
|
||||
client: Client
|
||||
closed: bool
|
||||
context: None
|
||||
cookies: cookies.SimpleCookie
|
||||
json: functools.partial
|
||||
request: Dict[str, Union[FakePayload, int, str]]
|
||||
resolver_match: ResolverMatch
|
||||
status_code: int
|
||||
templates: List[Any]
|
||||
wsgi_request: WSGIRequest
|
||||
def __init__(
|
||||
self,
|
||||
data: Any,
|
||||
encoder: Type[DjangoJSONEncoder] = ...,
|
||||
safe: bool = ...,
|
||||
json_dumps_params: Optional[Dict[str, int]] = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
Reference in New Issue
Block a user