mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 20:54:29 +08:00
fix imports in django.http.response.pyi
This commit is contained in:
@@ -1,17 +1,27 @@
|
|||||||
|
import functools
|
||||||
|
import io
|
||||||
|
import tempfile
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BufferedReader, BytesIO
|
from io import BufferedReader, BytesIO
|
||||||
from tempfile import _TemporaryFileWrapper
|
from tempfile import _TemporaryFileWrapper
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||||
|
from http import cookies
|
||||||
|
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
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 BadHeaderError(ValueError): ...
|
||||||
|
|
||||||
class HttpResponseBase:
|
class HttpResponseBase:
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
cookies: http.cookies.SimpleCookie = ...
|
cookies: cookies.SimpleCookie = ...
|
||||||
closed: bool = ...
|
closed: bool = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -71,23 +81,21 @@ class HttpResponseBase:
|
|||||||
def writelines(self, lines: List[str]) -> Any: ...
|
def writelines(self, lines: List[str]) -> Any: ...
|
||||||
|
|
||||||
class HttpResponse(HttpResponseBase):
|
class HttpResponse(HttpResponseBase):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: Optional[
|
context: Optional[Context]
|
||||||
Union[django.template.context.Context, django.test.utils.ContextList]
|
cookies: cookies.SimpleCookie
|
||||||
]
|
|
||||||
cookies: http.cookies.SimpleCookie
|
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
redirect_chain: List[Tuple[str, int]]
|
redirect_chain: List[Tuple[str, int]]
|
||||||
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
|
request: Dict[str, Union[FakePayload, int, str]]
|
||||||
resolver_match: django.urls.resolvers.ResolverMatch
|
resolver_match: ResolverMatch
|
||||||
sameorigin: bool
|
sameorigin: bool
|
||||||
status_code: int
|
status_code: int
|
||||||
templates: List[django.template.base.Template]
|
templates: List[Template]
|
||||||
test_server_port: str
|
test_server_port: str
|
||||||
test_was_secure_request: bool
|
test_was_secure_request: bool
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
xframe_options_exempt: bool
|
xframe_options_exempt: bool
|
||||||
streaming: bool = ...
|
streaming: bool = ...
|
||||||
content: Any = ...
|
content: Any = ...
|
||||||
@@ -108,16 +116,16 @@ class HttpResponse(HttpResponseBase):
|
|||||||
def writelines(self, lines: List[str]) -> None: ...
|
def writelines(self, lines: List[str]) -> None: ...
|
||||||
|
|
||||||
class StreamingHttpResponse(HttpResponseBase):
|
class StreamingHttpResponse(HttpResponseBase):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: None
|
context: None
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
|
request: Dict[str, Union[FakePayload, int, str]]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
status_code: int
|
status_code: int
|
||||||
templates: List[Any]
|
templates: List[Any]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
streaming: bool = ...
|
streaming: bool = ...
|
||||||
streaming_content: Any = ...
|
streaming_content: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -133,23 +141,23 @@ class StreamingHttpResponse(HttpResponseBase):
|
|||||||
def getvalue(self) -> bytes: ...
|
def getvalue(self) -> bytes: ...
|
||||||
|
|
||||||
class FileResponse(StreamingHttpResponse):
|
class FileResponse(StreamingHttpResponse):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: None
|
context: None
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
file_to_stream: Optional[
|
file_to_stream: Optional[
|
||||||
Union[
|
Union[
|
||||||
_io.BufferedReader,
|
io.BufferedReader,
|
||||||
_io.BytesIO,
|
io.BytesIO,
|
||||||
django.core.files.base.ContentFile,
|
ContentFile,
|
||||||
tempfile._TemporaryFileWrapper,
|
tempfile._TemporaryFileWrapper,
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
request: Dict[str, str]
|
request: Dict[str, str]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
templates: List[Any]
|
templates: List[Any]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
block_size: int = ...
|
block_size: int = ...
|
||||||
as_attachment: bool = ...
|
as_attachment: bool = ...
|
||||||
filename: str = ...
|
filename: str = ...
|
||||||
@@ -173,77 +181,77 @@ class HttpResponseRedirectBase(HttpResponse):
|
|||||||
url: Any = ...
|
url: Any = ...
|
||||||
|
|
||||||
class HttpResponseRedirect(HttpResponseRedirectBase):
|
class HttpResponseRedirect(HttpResponseRedirectBase):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: Optional[django.test.utils.ContextList]
|
context: Optional[Context]
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
redirect_chain: List[Tuple[str, int]]
|
redirect_chain: List[Tuple[str, int]]
|
||||||
request: Dict[
|
request: Dict[
|
||||||
str, Union[Dict[str, str], django.test.client.FakePayload, int, str]
|
str, Union[Dict[str, str], FakePayload, int, str]
|
||||||
]
|
]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
templates: List[django.template.base.Template]
|
templates: List[Template]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class HttpResponsePermanentRedirect(HttpResponseRedirectBase):
|
class HttpResponsePermanentRedirect(HttpResponseRedirectBase):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: None
|
context: None
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
redirect_chain: List[Tuple[str, int]]
|
redirect_chain: List[Tuple[str, int]]
|
||||||
request: Dict[str, str]
|
request: Dict[str, str]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
templates: List[Any]
|
templates: List[Any]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class HttpResponseNotModified(HttpResponse):
|
class HttpResponseNotModified(HttpResponse):
|
||||||
closed: bool
|
closed: bool
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def content(self, value: Any) -> None: ...
|
def content(self, value: Any) -> None: ...
|
||||||
|
|
||||||
class HttpResponseBadRequest(HttpResponse):
|
class HttpResponseBadRequest(HttpResponse):
|
||||||
closed: bool
|
closed: bool
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class HttpResponseNotFound(HttpResponse):
|
class HttpResponseNotFound(HttpResponse):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: Optional[django.template.context.Context]
|
context: Optional[Context]
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
request: Dict[str, str]
|
request: Dict[str, str]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
templates: List[django.template.base.Template]
|
templates: List[Template]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class HttpResponseForbidden(HttpResponse):
|
class HttpResponseForbidden(HttpResponse):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: Optional[django.template.context.Context]
|
context: Optional[Context]
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
|
request: Dict[str, Union[FakePayload, int, str]]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
templates: List[django.template.base.Template]
|
templates: List[Template]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class HttpResponseNotAllowed(HttpResponse):
|
class HttpResponseNotAllowed(HttpResponse):
|
||||||
closed: bool
|
closed: bool
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -254,36 +262,36 @@ class HttpResponseNotAllowed(HttpResponse):
|
|||||||
|
|
||||||
class HttpResponseGone(HttpResponse):
|
class HttpResponseGone(HttpResponse):
|
||||||
closed: bool
|
closed: bool
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class HttpResponseServerError(HttpResponse):
|
class HttpResponseServerError(HttpResponse):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: django.test.utils.ContextList
|
context: Context
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
request: Dict[str, str]
|
request: Dict[str, str]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
templates: List[django.template.base.Template]
|
templates: List[Template]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
|
|
||||||
class Http404(Exception): ...
|
class Http404(Exception): ...
|
||||||
|
|
||||||
class JsonResponse(HttpResponse):
|
class JsonResponse(HttpResponse):
|
||||||
client: django.test.client.Client
|
client: Client
|
||||||
closed: bool
|
closed: bool
|
||||||
context: None
|
context: None
|
||||||
cookies: http.cookies.SimpleCookie
|
cookies: cookies.SimpleCookie
|
||||||
json: functools.partial
|
json: functools.partial
|
||||||
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
|
request: Dict[str, Union[FakePayload, int, str]]
|
||||||
resolver_match: django.utils.functional.SimpleLazyObject
|
resolver_match: ResolverMatch
|
||||||
status_code: int
|
status_code: int
|
||||||
templates: List[Any]
|
templates: List[Any]
|
||||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
wsgi_request: WSGIRequest
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
data: Any,
|
data: Any,
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -18,7 +18,7 @@ setup(
|
|||||||
author_email="maxim.kurnikov@gmail.com",
|
author_email="maxim.kurnikov@gmail.com",
|
||||||
version="0.1.0",
|
version="0.1.0",
|
||||||
license='BSD',
|
license='BSD',
|
||||||
install_requires='Django==2.1',
|
install_requires='Django>=2.1.1',
|
||||||
packages=['django-stubs'],
|
packages=['django-stubs'],
|
||||||
package_data=find_stubs('django-stubs')
|
package_data=find_stubs('django-stubs')
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user