mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 05:51:53 +08:00
fix ci
This commit is contained in:
@@ -11,7 +11,7 @@ class Model(metaclass=ModelBase):
|
||||
pass
|
||||
_meta: Any
|
||||
pk: Any = ...
|
||||
# objects: Manager[Model]
|
||||
objects: Manager[Model]
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
|
||||
def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ...
|
||||
|
||||
@@ -13,11 +13,12 @@ from django.urls import ResolverMatch
|
||||
|
||||
class BadHeaderError(ValueError): ...
|
||||
|
||||
class HttpResponseBase(BytesIO):
|
||||
class HttpResponseBase:
|
||||
status_code: int = ...
|
||||
cookies: SimpleCookie = ...
|
||||
reason_phrase: str = ...
|
||||
charset: str = ...
|
||||
closed: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
content_type: Optional[str] = ...,
|
||||
@@ -51,6 +52,15 @@ class HttpResponseBase(BytesIO):
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str = "", **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = "", domain: str = None) -> None: ...
|
||||
def make_bytes(self, value: object) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, content: Union[str, bytes]) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
def readable(self) -> bool: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def writelines(self, lines: Iterable[object]): ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
|
||||
class HttpResponse(HttpResponseBase):
|
||||
client: Client
|
||||
@@ -73,7 +83,6 @@ class HttpResponse(HttpResponseBase):
|
||||
def content(self) -> bytes: ...
|
||||
@content.setter
|
||||
def content(self, value: Any) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
def json(self) -> Dict[str, Any]: ...
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
from typing import Dict, List, Optional, Union, Any
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from . import engines as engines
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
def get_template(template_name: str, using: Optional[str] = ...) -> Any: ...
|
||||
def select_template(template_name_list: Union[List[str], str], using: Optional[str] = ...) -> Any: ...
|
||||
def render_to_string(
|
||||
template_name: Union[List[str], str],
|
||||
context: Optional[Dict[str, Any]] = ...,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
request: Optional[HttpRequest] = ...,
|
||||
using: Optional[str] = ...,
|
||||
) -> str: ...
|
||||
|
||||
@@ -9,6 +9,8 @@ from django.http.cookie import SimpleCookie
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseBase
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
|
||||
CONTENT_TYPE_RE: Pattern
|
||||
|
||||
class RedirectCycleError(Exception):
|
||||
@@ -37,13 +39,13 @@ class RequestFactory:
|
||||
cookies: SimpleCookie = ...
|
||||
errors: BytesIO = ...
|
||||
def __init__(self, *, json_encoder: Any = ..., **defaults: Any) -> None: ...
|
||||
def request(self, **request: Any) -> HttpRequest: ...
|
||||
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||
def request(self, **request: Any) -> WSGIRequest: ...
|
||||
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
||||
def post(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpRequest: ...
|
||||
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||
def trace(self, path: str, secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||
) -> WSGIRequest: ...
|
||||
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
||||
def trace(self, path: str, secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
||||
def options(
|
||||
self,
|
||||
path: str,
|
||||
@@ -51,16 +53,16 @@ class RequestFactory:
|
||||
content_type: str = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
) -> HttpRequest: ...
|
||||
) -> WSGIRequest: ...
|
||||
def put(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpRequest: ...
|
||||
) -> WSGIRequest: ...
|
||||
def patch(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpRequest: ...
|
||||
) -> WSGIRequest: ...
|
||||
def delete(
|
||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||
) -> HttpRequest: ...
|
||||
) -> WSGIRequest: ...
|
||||
def generic(
|
||||
self,
|
||||
method: str,
|
||||
@@ -69,7 +71,7 @@ class RequestFactory:
|
||||
content_type: Optional[str] = ...,
|
||||
secure: bool = ...,
|
||||
**extra: Any
|
||||
) -> HttpRequest: ...
|
||||
) -> WSGIRequest: ...
|
||||
|
||||
class Client:
|
||||
json_encoder: Type[DjangoJSONEncoder] = ...
|
||||
|
||||
@@ -27,21 +27,23 @@ class OrderedSet(MutableSet[_K]):
|
||||
|
||||
class MultiValueDictKeyError(KeyError): ...
|
||||
|
||||
class MultiValueDict(MutableMapping[_K, List[_V]]):
|
||||
_Val = Union[_V, List[_V]]
|
||||
|
||||
class MultiValueDict(MutableMapping[_K, _V]):
|
||||
@overload
|
||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ...) -> None: ...
|
||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, _Val]] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, key_to_list_mapping: Mapping[_K, List[_V]] = ...) -> None: ...
|
||||
def __init__(self, key_to_list_mapping: Mapping[_K, _Val] = ...) -> None: ...
|
||||
def getlist(self, key: _K, default: List[_V] = None) -> List[_V]: ...
|
||||
def setlist(self, key: _K, list_: List[_V]) -> None: ...
|
||||
def setlistdefault(self, key: _K, default_list: List[_V] = None) -> List[_V]: ...
|
||||
def appendlist(self, key: _K, value: _V) -> None: ...
|
||||
def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ...
|
||||
def dict(self) -> Dict[_K, List[_V]]: ...
|
||||
def dict(self) -> Dict[_K, _Val]: ...
|
||||
# These overrides are needed to convince mypy that this isn't an abstract class
|
||||
def __delitem__(self, item: _K) -> None: ...
|
||||
def __getitem__(self, item: _K) -> List[_V]: ...
|
||||
def __setitem__(self, k: _K, v: List[_V]) -> None: ...
|
||||
def __getitem__(self, item: _K) -> _Val: ... # type: ignore
|
||||
def __setitem__(self, k: _K, v: _Val) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_K]: ...
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ IGNORED_ERRORS = {
|
||||
'requests': [
|
||||
'Incompatible types in assignment (expression has type "Dict[str, str]", variable has type "QueryDict")'
|
||||
],
|
||||
'responses': [
|
||||
'Argument 1 to "TextIOWrapper" has incompatible type "HttpResponse"; expected "IO[bytes]"'
|
||||
],
|
||||
'prefetch_related': [
|
||||
'Incompatible types in assignment (expression has type "List[Room]", variable has type "QuerySet[Room]")',
|
||||
'"None" has no attribute "__iter__"',
|
||||
|
||||
Reference in New Issue
Block a user