mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
fixes, add some testing folders
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import collections
|
import collections
|
||||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable
|
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable, DefaultDict
|
||||||
|
|
||||||
from django.db.migrations.state import AppConfigStub
|
from django.db.migrations.state import AppConfigStub
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
@@ -12,6 +12,7 @@ class Apps:
|
|||||||
stored_app_configs: List[Any] = ...
|
stored_app_configs: List[Any] = ...
|
||||||
apps_ready: bool = ...
|
apps_ready: bool = ...
|
||||||
loading: bool = ...
|
loading: bool = ...
|
||||||
|
_pending_operations: DefaultDict[str, List]
|
||||||
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
||||||
models_ready: bool = ...
|
models_ready: bool = ...
|
||||||
ready: bool = ...
|
ready: bool = ...
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class AuthenticationMiddleware(MiddlewareMixin):
|
|||||||
class RemoteUserMiddleware(MiddlewareMixin):
|
class RemoteUserMiddleware(MiddlewareMixin):
|
||||||
header: str = ...
|
header: str = ...
|
||||||
force_logout_if_no_header: bool = ...
|
force_logout_if_no_header: bool = ...
|
||||||
def process_request(self, request: WSGIRequest) -> None: ...
|
def process_request(self, request: HttpRequest) -> None: ...
|
||||||
def clean_username(self, username: str, request: WSGIRequest) -> str: ...
|
def clean_username(self, username: str, request: HttpRequest) -> str: ...
|
||||||
|
|
||||||
class PersistentRemoteUserMiddleware(RemoteUserMiddleware):
|
class PersistentRemoteUserMiddleware(RemoteUserMiddleware):
|
||||||
force_logout_if_no_header: bool = ...
|
force_logout_if_no_header: bool = ...
|
||||||
|
|||||||
@@ -1,46 +1,46 @@
|
|||||||
from pathlib import PosixPath
|
from pathlib import Path, PosixPath
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, List, Mapping, Optional, Protocol, Sequence, Set, Union
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser
|
from django.contrib.auth.base_user import AbstractBaseUser
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
def get_default_password_validators() -> Union[
|
class PasswordValidator(Protocol):
|
||||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...): ...
|
||||||
]: ...
|
|
||||||
def get_password_validators(
|
def get_default_password_validators() -> List[PasswordValidator]: ...
|
||||||
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
|
def get_password_validators(validator_config: Sequence[Mapping[str, Any]]) -> List[PasswordValidator]: ...
|
||||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
|
||||||
def validate_password(
|
def validate_password(
|
||||||
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: Optional[List[Any]] = ...
|
password: str,
|
||||||
|
user: Optional[AbstractBaseUser] = ...,
|
||||||
|
password_validators: Optional[Sequence[PasswordValidator]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def password_changed(
|
def password_changed(
|
||||||
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: None = ...
|
password: str,
|
||||||
|
user: Optional[AbstractBaseUser] = ...,
|
||||||
|
password_validators: Optional[Sequence[PasswordValidator]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def password_validators_help_texts(password_validators: Optional[List[Any]] = ...) -> List[str]: ...
|
def password_validators_help_texts(password_validators: Optional[Sequence[PasswordValidator]] = ...) -> List[str]: ...
|
||||||
|
|
||||||
password_validators_help_text_html: Any
|
password_validators_help_text_html: Any
|
||||||
|
|
||||||
class MinimumLengthValidator:
|
class MinimumLengthValidator:
|
||||||
min_length: int = ...
|
min_length: int = ...
|
||||||
def __init__(self, min_length: int = ...) -> None: ...
|
def __init__(self, min_length: int = ...) -> None: ...
|
||||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...) -> None: ...
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|
||||||
class UserAttributeSimilarityValidator:
|
class UserAttributeSimilarityValidator:
|
||||||
DEFAULT_USER_ATTRIBUTES: Any = ...
|
DEFAULT_USER_ATTRIBUTES: Sequence[str] = ...
|
||||||
user_attributes: Tuple[str, str, str, str] = ...
|
user_attributes: Sequence[str] = ...
|
||||||
max_similarity: float = ...
|
max_similarity: float = ...
|
||||||
def __init__(
|
def __init__(self, user_attributes: Sequence[str] = ..., max_similarity: float = ...) -> None: ...
|
||||||
self, user_attributes: Union[List[str], Tuple[str, str, str, str]] = ..., max_similarity: float = ...
|
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...) -> None: ...
|
||||||
) -> None: ...
|
|
||||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|
||||||
class CommonPasswordValidator:
|
class CommonPasswordValidator:
|
||||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
DEFAULT_PASSWORD_LIST_PATH: Path = ...
|
||||||
passwords: Set[str] = ...
|
passwords: Set[str] = ...
|
||||||
def __init__(self, password_list_path: Union[PosixPath, str] = ...) -> None: ...
|
def __init__(self, password_list_path: Union[PosixPath, str] = ...) -> None: ...
|
||||||
def validate(self, password: str, user: None = ...) -> None: ...
|
def validate(self, password: str, user: Optional[AbstractBaseUser] = ...) -> None: ...
|
||||||
def get_help_text(self) -> str: ...
|
def get_help_text(self) -> str: ...
|
||||||
|
|
||||||
class NumericPasswordValidator:
|
class NumericPasswordValidator:
|
||||||
|
|||||||
4
django-stubs/contrib/auth/validators.pyi
Normal file
4
django-stubs/contrib/auth/validators.pyi
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from django.core import validators
|
||||||
|
|
||||||
|
class ASCIIUsernameValidator(validators.RegexValidator): ...
|
||||||
|
class UnicodeUsernameValidator(validators.RegexValidator): ...
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseBase
|
from django.http.response import HttpResponse
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class MessageMiddleware(MiddlewareMixin):
|
class MessageMiddleware(MiddlewareMixin):
|
||||||
def process_request(self, request: WSGIRequest) -> None: ...
|
def process_request(self, request: HttpRequest) -> None: ...
|
||||||
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -8,26 +8,18 @@ VALID_KEY_CHARS: Any
|
|||||||
class CreateError(Exception): ...
|
class CreateError(Exception): ...
|
||||||
class UpdateError(Exception): ...
|
class UpdateError(Exception): ...
|
||||||
|
|
||||||
class SessionBase:
|
class SessionBase(Dict[str, Any]):
|
||||||
TEST_COOKIE_NAME: str = ...
|
TEST_COOKIE_NAME: str = ...
|
||||||
TEST_COOKIE_VALUE: str = ...
|
TEST_COOKIE_VALUE: str = ...
|
||||||
accessed: bool = ...
|
accessed: bool = ...
|
||||||
modified: bool = ...
|
modified: bool = ...
|
||||||
serializer: Any = ...
|
serializer: Any = ...
|
||||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||||
def __contains__(self, key: str) -> bool: ...
|
|
||||||
def __getitem__(self, key: str) -> Any: ...
|
|
||||||
def __setitem__(self, key: str, value: Any) -> None: ...
|
|
||||||
def __delitem__(self, key: str) -> None: ...
|
|
||||||
def get(self, key: str, default: Optional[str] = ...) -> Any: ...
|
|
||||||
def pop(self, key: str, default: Any = ...) -> Any: ...
|
|
||||||
def setdefault(self, key: str, value: str) -> str: ...
|
|
||||||
def set_test_cookie(self) -> None: ...
|
def set_test_cookie(self) -> None: ...
|
||||||
def test_cookie_worked(self) -> bool: ...
|
def test_cookie_worked(self) -> bool: ...
|
||||||
def delete_test_cookie(self) -> None: ...
|
def delete_test_cookie(self) -> None: ...
|
||||||
def encode(self, session_dict: Dict[str, Model]) -> str: ...
|
def encode(self, session_dict: Dict[str, Model]) -> str: ...
|
||||||
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ...
|
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ...
|
||||||
def update(self, dict_: Dict[str, int]) -> None: ...
|
|
||||||
def has_key(self, key: Any): ...
|
def has_key(self, key: Any): ...
|
||||||
def keys(self): ...
|
def keys(self): ...
|
||||||
def values(self): ...
|
def values(self): ...
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
from django.contrib.sessions.backends.base import SessionBase
|
from django.contrib.sessions.backends.base import SessionBase
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class SessionMiddleware(MiddlewareMixin):
|
class SessionMiddleware(MiddlewareMixin):
|
||||||
SessionStore: Type[SessionBase] = ...
|
SessionStore: Type[SessionBase] = ...
|
||||||
def process_request(self, request: WSGIRequest) -> None: ...
|
def process_request(self, request: HttpRequest) -> None: ...
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ...
|
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
from typing import Any, Iterator, List, Optional, Tuple, Union
|
from typing import Any, Iterator, List, Optional, Tuple, Union, Mapping, overload
|
||||||
|
|
||||||
from django.contrib.staticfiles.storage import StaticFilesStorage
|
from django.contrib.staticfiles.storage import StaticFilesStorage
|
||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import Error
|
||||||
from django.core.files.storage import DefaultStorage, FileSystemStorage
|
from django.core.files.storage import DefaultStorage, FileSystemStorage, Storage
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
searched_locations: Any
|
searched_locations: Any
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ class BaseFinder:
|
|||||||
|
|
||||||
class FileSystemFinder(BaseFinder):
|
class FileSystemFinder(BaseFinder):
|
||||||
locations: List[Any] = ...
|
locations: List[Any] = ...
|
||||||
storages: collections.OrderedDict = ...
|
storages: Mapping[str, Any] = ...
|
||||||
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||||
@@ -24,22 +25,27 @@ class AppDirectoriesFinder(BaseFinder):
|
|||||||
storage_class: Any = ...
|
storage_class: Any = ...
|
||||||
source_dir: str = ...
|
source_dir: str = ...
|
||||||
apps: List[str] = ...
|
apps: List[str] = ...
|
||||||
storages: collections.OrderedDict = ...
|
storages: Mapping[str, Any] = ...
|
||||||
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
||||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||||
def find_in_app(self, app: str, path: str) -> Optional[str]: ...
|
def find_in_app(self, app: str, path: str) -> Optional[str]: ...
|
||||||
|
|
||||||
class BaseStorageFinder(BaseFinder):
|
class BaseStorageFinder(BaseFinder):
|
||||||
storage: Any = ...
|
storage: Storage = ...
|
||||||
def __init__(self, storage: Optional[StaticFilesStorage] = ..., *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, storage: Optional[Storage] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, DefaultStorage]]: ...
|
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, DefaultStorage]]: ...
|
||||||
|
|
||||||
class DefaultStorageFinder(BaseStorageFinder):
|
class DefaultStorageFinder(BaseStorageFinder): ...
|
||||||
storage: django.contrib.staticfiles.storage.StaticFilesStorage = ...
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
||||||
|
|
||||||
def find(path: str, all: bool = ...) -> Optional[Union[List[str], str]]: ...
|
def find(path: str, all: bool = ...) -> Optional[Union[List[str], str]]: ...
|
||||||
def get_finders() -> Iterator[BaseFinder]: ...
|
def get_finders() -> Iterator[BaseFinder]: ...
|
||||||
|
@overload
|
||||||
|
def get_finder(import_path: Literal["django.contrib.staticfiles.finders.FileSystemFinder"]) -> FileSystemFinder: ...
|
||||||
|
@overload
|
||||||
|
def get_finder(
|
||||||
|
import_path: Literal["django.contrib.staticfiles.finders.AppDirectoriesFinder"]
|
||||||
|
) -> AppDirectoriesFinder: ...
|
||||||
|
@overload
|
||||||
def get_finder(import_path: str) -> BaseFinder: ...
|
def get_finder(import_path: str) -> BaseFinder: ...
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from argparse import ArgumentParser, HelpFormatter, Namespace
|
from argparse import ArgumentParser, HelpFormatter, Namespace
|
||||||
from io import StringIO, TextIOBase, TextIOWrapper
|
from io import StringIO, TextIOBase, TextIOWrapper
|
||||||
from typing import Any, Callable, List, Optional, Tuple, Union, Type
|
from typing import Any, Callable, List, Optional, Union
|
||||||
|
|
||||||
from django.apps.config import AppConfig
|
from django.apps.config import AppConfig
|
||||||
from django.core.management.color import Style
|
from django.core.management.color import Style
|
||||||
@@ -9,17 +9,6 @@ class CommandError(Exception): ...
|
|||||||
class SystemCheckError(CommandError): ...
|
class SystemCheckError(CommandError): ...
|
||||||
|
|
||||||
class CommandParser(ArgumentParser):
|
class CommandParser(ArgumentParser):
|
||||||
add_help: bool
|
|
||||||
allow_abbrev: bool
|
|
||||||
argument_default: None
|
|
||||||
conflict_handler: str
|
|
||||||
description: str
|
|
||||||
epilog: None
|
|
||||||
formatter_class: Type[DjangoHelpFormatter]
|
|
||||||
fromfile_prefix_chars: None
|
|
||||||
prefix_chars: str
|
|
||||||
prog: str
|
|
||||||
usage: None
|
|
||||||
missing_args_message: None = ...
|
missing_args_message: None = ...
|
||||||
called_from_command_line: bool = ...
|
called_from_command_line: bool = ...
|
||||||
def __init__(self, **kwargs: Any) -> None: ...
|
def __init__(self, **kwargs: Any) -> None: ...
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ from .utils import (
|
|||||||
InternalError as InternalError,
|
InternalError as InternalError,
|
||||||
InterfaceError as InterfaceError,
|
InterfaceError as InterfaceError,
|
||||||
ConnectionHandler as ConnectionHandler,
|
ConnectionHandler as ConnectionHandler,
|
||||||
|
Error as Error,
|
||||||
|
ConnectionDoesNotExist as ConnectionDoesNotExist,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import migrations
|
from . import migrations
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Model(metaclass=ModelBase):
|
|||||||
pass
|
pass
|
||||||
_meta: Any
|
_meta: Any
|
||||||
pk: Any = ...
|
pk: Any = ...
|
||||||
objects: Manager[Model]
|
# objects: Manager[Model]
|
||||||
def __init__(self, *args, **kwargs) -> None: ...
|
def __init__(self, *args, **kwargs) -> None: ...
|
||||||
def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
|
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: ...
|
def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ...
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from django.db.models.sql.query import Query, RawQuery
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Manager
|
from django.db.models import Manager
|
||||||
|
from django.db.models.query_utils import Q as Q
|
||||||
|
|
||||||
_T = TypeVar("_T", bound=models.Model, covariant=True)
|
_T = TypeVar("_T", bound=models.Model, covariant=True)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from contextlib import ContextDecorator
|
from contextlib import ContextDecorator
|
||||||
from typing import Any, Callable, Optional, Union, ContextManager
|
from typing import Any, Callable, Optional, Union, Iterator, overload, ContextManager
|
||||||
|
|
||||||
from django.db import ProgrammingError
|
from django.db import ProgrammingError
|
||||||
|
|
||||||
@@ -25,5 +25,12 @@ class Atomic(ContextDecorator):
|
|||||||
def __enter__(self) -> None: ...
|
def __enter__(self) -> None: ...
|
||||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||||
|
|
||||||
def atomic(using: Optional[Union[Callable, str]] = ..., savepoint: bool = ...) -> ContextManager[Atomic]: ...
|
@overload
|
||||||
|
def atomic() -> Atomic: ...
|
||||||
|
@overload
|
||||||
|
def atomic(using: Optional[str] = ...,) -> ContextManager[Atomic]: ...
|
||||||
|
@overload
|
||||||
|
def atomic(using: Callable = ...) -> Callable: ...
|
||||||
|
@overload
|
||||||
|
def atomic(using: Optional[str] = ..., savepoint: bool = ...) -> ContextManager[Atomic]: ...
|
||||||
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import date, datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError as ValidationError
|
||||||
|
from django.core.files.base import File
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.forms.boundfield import BoundField
|
from django.forms.boundfield import BoundField
|
||||||
from django.forms.fields import Field
|
from django.forms.fields import Field
|
||||||
from django.forms.utils import ErrorDict, ErrorList
|
from django.forms.utils import ErrorDict, ErrorList
|
||||||
from django.forms.widgets import Media, MediaDefiningClass
|
from django.forms.widgets import Media, MediaDefiningClass
|
||||||
from django.http.request import QueryDict
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
||||||
@@ -35,11 +34,11 @@ class BaseForm:
|
|||||||
renderer: Any = ...
|
renderer: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
data: Optional[Union[Dict[str, Union[List[int], int, str]], Dict[str, Union[List[str], str]], QueryDict]] = ...,
|
data: Optional[Mapping[str, Any]] = ...,
|
||||||
files: Optional[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ...,
|
files: Optional[Mapping[str, File]] = ...,
|
||||||
auto_id: Optional[Union[bool, str]] = ...,
|
auto_id: Optional[Union[bool, str]] = ...,
|
||||||
prefix: Optional[str] = ...,
|
prefix: Optional[str] = ...,
|
||||||
initial: Optional[Union[Dict[str, List[int]], Dict[str, date], Dict[str, str]]] = ...,
|
initial: Optional[Mapping[str, Any]] = ...,
|
||||||
error_class: Type[ErrorList] = ...,
|
error_class: Type[ErrorList] = ...,
|
||||||
label_suffix: None = ...,
|
label_suffix: None = ...,
|
||||||
empty_permitted: bool = ...,
|
empty_permitted: bool = ...,
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
from .request import HttpRequest as HttpRequest, QueryDict as QueryDict
|
from .request import (
|
||||||
|
HttpRequest as HttpRequest,
|
||||||
|
QueryDict as QueryDict,
|
||||||
|
RawPostDataException as RawPostDataException,
|
||||||
|
UnreadablePostError as UnreadablePostError,
|
||||||
|
)
|
||||||
|
|
||||||
from .response import (
|
from .response import (
|
||||||
BadHeaderError as BadHeaderError,
|
BadHeaderError as BadHeaderError,
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
# Stubs for django.http.request (Python 3.5)
|
|
||||||
#
|
|
||||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern, Tuple, Union
|
from typing import Any, BinaryIO, Dict, Iterable, List, Mapping, Optional, Pattern, Tuple, Union, overload
|
||||||
|
|
||||||
from django.contrib.sessions.backends.base import SessionBase
|
from django.contrib.sessions.backends.base import SessionBase
|
||||||
from django.core.files import uploadhandler, uploadedfile
|
from django.utils.datastructures import ImmutableList, MultiValueDict
|
||||||
from django.utils.datastructures import MultiValueDict, ImmutableList
|
|
||||||
|
from django.core.files import uploadedfile, uploadhandler
|
||||||
from django.urls import ResolverMatch
|
from django.urls import ResolverMatch
|
||||||
|
|
||||||
RAISE_ERROR = ... # type: object
|
RAISE_ERROR: object = ...
|
||||||
host_validation_re = ... # type: Pattern
|
host_validation_re: Pattern = ...
|
||||||
|
|
||||||
class UnreadablePostError(IOError): ...
|
class UnreadablePostError(IOError): ...
|
||||||
class RawPostDataException(Exception): ...
|
class RawPostDataException(Exception): ...
|
||||||
@@ -21,7 +19,7 @@ class HttpRequest(BytesIO):
|
|||||||
GET: QueryDict = ...
|
GET: QueryDict = ...
|
||||||
POST: QueryDict = ...
|
POST: QueryDict = ...
|
||||||
COOKIES: Dict[str, str] = ...
|
COOKIES: Dict[str, str] = ...
|
||||||
META: Dict[str, str] = ...
|
META: Dict[str, Any] = ...
|
||||||
FILES: MultiValueDict[str, uploadedfile.UploadedFile] = ...
|
FILES: MultiValueDict[str, uploadedfile.UploadedFile] = ...
|
||||||
path: str = ...
|
path: str = ...
|
||||||
path_info: str = ...
|
path_info: str = ...
|
||||||
@@ -30,6 +28,8 @@ class HttpRequest(BytesIO):
|
|||||||
content_type: Optional[str] = ...
|
content_type: Optional[str] = ...
|
||||||
content_params: Optional[Dict[str, str]] = ...
|
content_params: Optional[Dict[str, str]] = ...
|
||||||
session: SessionBase
|
session: SessionBase
|
||||||
|
encoding: Optional[str] = ...
|
||||||
|
upload_handlers: UploadHandlerList = ...
|
||||||
def __init__(self) -> None: ...
|
def __init__(self) -> None: ...
|
||||||
def get_host(self) -> str: ...
|
def get_host(self) -> str: ...
|
||||||
def get_port(self) -> str: ...
|
def get_port(self) -> str: ...
|
||||||
@@ -44,38 +44,23 @@ class HttpRequest(BytesIO):
|
|||||||
def scheme(self) -> Optional[str]: ...
|
def scheme(self) -> Optional[str]: ...
|
||||||
def is_secure(self) -> bool: ...
|
def is_secure(self) -> bool: ...
|
||||||
def is_ajax(self) -> bool: ...
|
def is_ajax(self) -> bool: ...
|
||||||
encoding = ... # type: Optional[str]
|
|
||||||
upload_handlers = ... # type: UploadHandlerList
|
|
||||||
def parse_file_upload(
|
def parse_file_upload(
|
||||||
self, META: Dict[str, str], post_data: BinaryIO
|
self, META: Mapping[str, Any], post_data: BinaryIO
|
||||||
) -> Tuple["QueryDict", MultiValueDict[str, uploadedfile.UploadedFile]]: ...
|
) -> Tuple[QueryDict, MultiValueDict[str, uploadedfile.UploadedFile]]: ...
|
||||||
@property
|
@property
|
||||||
def body(self) -> bytes: ...
|
def body(self) -> bytes: ...
|
||||||
def close(self) -> None: ...
|
def _load_post_and_files(self) -> None: ...
|
||||||
def read(self, *args: Any, **kwargs: Any) -> bytes: ...
|
|
||||||
def readline(self, *args: Any, **kwargs: Any) -> bytes: ...
|
|
||||||
def xreadlines(self) -> Iterator[bytes]: ...
|
|
||||||
def __iter__(self) -> Iterator[bytes]: ...
|
|
||||||
def readlines(self) -> List[bytes]: ... # type: ignore
|
|
||||||
|
|
||||||
class QueryDict(MultiValueDict[str, str]):
|
class QueryDict(MultiValueDict[str, str]):
|
||||||
encoding = str # type: Any
|
encoding: Any = ...
|
||||||
_mutable: bool = ...
|
_mutable: bool = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, query_string: Union[str, bytes, None] = None, mutable: bool = False, encoding: Optional[str] = None
|
self, query_string: Optional[Union[str, bytes]] = ..., mutable: bool = ..., encoding: Optional[str] = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __setitem__(self, key: str, value: str) -> None: ...
|
|
||||||
def __delitem__(self, key: str) -> None: ...
|
|
||||||
def __copy__(self) -> "QueryDict": ...
|
|
||||||
def __deepcopy__(self, memo: Dict[int, object]) -> "QueryDict": ...
|
|
||||||
def setlist(self, key: str, list_: List[str]) -> None: ...
|
def setlist(self, key: str, list_: List[str]) -> None: ...
|
||||||
def setlistdefault(self, key: str, default_list: List[str] = None) -> List[str]: ...
|
def setlistdefault(self, key: str, default_list: Optional[List[str]] = ...) -> List[str]: ...
|
||||||
def appendlist(self, key: str, value: str) -> None: ...
|
def appendlist(self, key: str, value: str) -> None: ...
|
||||||
def popitem(self) -> Tuple[str, str]: ...
|
def urlencode(self, safe: Optional[str] = ...) -> str: ...
|
||||||
def clear(self) -> None: ...
|
|
||||||
def setdefault(self, key: str, default: Optional[str] = None) -> str: ...
|
|
||||||
def copy(self) -> "QueryDict": ...
|
|
||||||
def urlencode(self, safe: Optional[str] = None) -> str: ...
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def bytes_to_text(s: bytes, encoding: str) -> str: ...
|
def bytes_to_text(s: bytes, encoding: str) -> str: ...
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from json import JSONEncoder
|
from json import JSONEncoder
|
||||||
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload
|
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload, AnyStr, IO
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
@@ -13,10 +13,9 @@ from django.urls import ResolverMatch
|
|||||||
|
|
||||||
class BadHeaderError(ValueError): ...
|
class BadHeaderError(ValueError): ...
|
||||||
|
|
||||||
class HttpResponseBase(six.Iterator):
|
class HttpResponseBase(BytesIO):
|
||||||
status_code: int = ...
|
status_code: int = ...
|
||||||
cookies: SimpleCookie = ...
|
cookies: SimpleCookie = ...
|
||||||
closed: bool = ...
|
|
||||||
reason_phrase: str = ...
|
reason_phrase: str = ...
|
||||||
charset: str = ...
|
charset: str = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -52,18 +51,9 @@ class HttpResponseBase(six.Iterator):
|
|||||||
def set_signed_cookie(self, key: str, value: str, salt: str = "", **kwargs: Any) -> None: ...
|
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 delete_cookie(self, key: str, path: str = "", domain: str = None) -> None: ...
|
||||||
def make_bytes(self, value: object) -> bytes: ...
|
def make_bytes(self, value: object) -> bytes: ...
|
||||||
def close(self) -> None: ...
|
|
||||||
def write(self, content: object) -> 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]) -> None: ...
|
|
||||||
|
|
||||||
class HttpResponse(HttpResponseBase):
|
class HttpResponse(HttpResponseBase):
|
||||||
client: Client
|
client: Client
|
||||||
closed: bool
|
|
||||||
context: Optional[Context]
|
context: Optional[Context]
|
||||||
csrf_cookie_set: bool
|
csrf_cookie_set: bool
|
||||||
redirect_chain: List[Tuple[str, int]]
|
redirect_chain: List[Tuple[str, int]]
|
||||||
@@ -83,26 +73,23 @@ class HttpResponse(HttpResponseBase):
|
|||||||
def content(self) -> bytes: ...
|
def content(self) -> bytes: ...
|
||||||
@content.setter
|
@content.setter
|
||||||
def content(self, value: Any) -> None: ...
|
def content(self, value: Any) -> None: ...
|
||||||
def __iter__(self) -> Iterator[bytes]: ...
|
|
||||||
def tell(self) -> int: ...
|
def tell(self) -> int: ...
|
||||||
def getvalue(self) -> bytes: ...
|
|
||||||
def writable(self) -> bool: ...
|
|
||||||
@property
|
@property
|
||||||
def url(self) -> str: ...
|
def url(self) -> str: ...
|
||||||
def json(self) -> Dict[str, Any]: ...
|
def json(self) -> Dict[str, Any]: ...
|
||||||
|
|
||||||
class StreamingHttpResponse(HttpResponseBase):
|
class StreamingHttpResponse(HttpResponseBase):
|
||||||
def __init__(self, streaming_content: Iterable[bytes] = ..., *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, streaming_content: Iterable[AnyStr] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
@property
|
@property
|
||||||
def content(self) -> bytes: ...
|
def content(self) -> AnyStr: ...
|
||||||
@content.setter
|
@content.setter
|
||||||
def content(self, value: Any) -> None: ...
|
def content(self, value: AnyStr) -> None: ...
|
||||||
@property
|
@property
|
||||||
def streaming_content(self) -> Iterator[bytes]: ...
|
def streaming_content(self) -> Iterator[AnyStr]: ...
|
||||||
@streaming_content.setter
|
@streaming_content.setter
|
||||||
def streaming_content(self, value: Iterable[bytes]) -> None: ...
|
def streaming_content(self, value: Iterable[AnyStr]) -> None: ...
|
||||||
def __iter__(self) -> Iterator[bytes]: ...
|
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||||
def getvalue(self) -> bytes: ...
|
def getvalue(self) -> AnyStr: ...
|
||||||
|
|
||||||
class FileResponse(StreamingHttpResponse):
|
class FileResponse(StreamingHttpResponse):
|
||||||
client: Client
|
client: Client
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
from typing import Any, Optional, Callable
|
from typing import Any, Optional
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponseBase, HttpResponseNotFound, HttpResponsePermanentRedirect
|
from django.http.response import HttpResponse, HttpResponseNotFound, HttpResponsePermanentRedirect
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
|
||||||
class CommonMiddleware(MiddlewareMixin):
|
class CommonMiddleware(MiddlewareMixin):
|
||||||
response_redirect_class: Any = ...
|
response_redirect_class: Any = ...
|
||||||
def process_request(self, request: WSGIRequest) -> Optional[HttpResponsePermanentRedirect]: ...
|
def process_request(self, request: HttpRequest) -> Optional[HttpResponsePermanentRedirect]: ...
|
||||||
def should_redirect_with_slash(self, request: WSGIRequest) -> bool: ...
|
def should_redirect_with_slash(self, request: HttpRequest) -> bool: ...
|
||||||
def get_full_path_with_slash(self, request: WSGIRequest) -> str: ...
|
def get_full_path_with_slash(self, request: HttpRequest) -> str: ...
|
||||||
def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
|
def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||||
|
|
||||||
class BrokenLinkEmailsMiddleware(MiddlewareMixin):
|
class BrokenLinkEmailsMiddleware(MiddlewareMixin):
|
||||||
def process_response(self, request: WSGIRequest, response: HttpResponseNotFound) -> HttpResponseNotFound: ...
|
def process_response(self, request: HttpRequest, response: HttpResponseNotFound) -> HttpResponseNotFound: ...
|
||||||
def is_internal_request(self, domain: str, referer: str) -> bool: ...
|
def is_internal_request(self, domain: str, referer: str) -> bool: ...
|
||||||
def is_ignorable_request(self, request: WSGIRequest, uri: str, domain: str, referer: str) -> bool: ...
|
def is_ignorable_request(self, request: HttpRequest, uri: str, domain: str, referer: str) -> bool: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Type, Union, Sequence
|
from typing import Any, Callable, Dict, List, Optional, Type, Union, Sequence, Protocol
|
||||||
|
|
||||||
from django.db.models import Manager, QuerySet
|
from django.db.models import Manager, QuerySet
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
@@ -7,7 +7,7 @@ from django.http.response import HttpResponse, HttpResponseRedirect
|
|||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
|
||||||
def render_to_response(
|
def render_to_response(
|
||||||
template_name: str,
|
template_name: Union[str, Sequence[str]],
|
||||||
context: Optional[Dict[str, Any]] = ...,
|
context: Optional[Dict[str, Any]] = ...,
|
||||||
content_type: Optional[str] = ...,
|
content_type: Optional[str] = ...,
|
||||||
status: Optional[int] = ...,
|
status: Optional[int] = ...,
|
||||||
@@ -21,7 +21,13 @@ def render(
|
|||||||
status: Optional[int] = ...,
|
status: Optional[int] = ...,
|
||||||
using: Optional[str] = ...,
|
using: Optional[str] = ...,
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def redirect(to: Union[Callable, str], *args: Any, permanent: bool = ..., **kwargs: Any) -> HttpResponseRedirect: ...
|
|
||||||
|
class SupportsGetAbsoluteUrl(Protocol):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def redirect(
|
||||||
|
to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: bool = ..., **kwargs: Any
|
||||||
|
) -> HttpResponseRedirect: ...
|
||||||
def get_object_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> Model: ...
|
def get_object_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> Model: ...
|
||||||
def get_list_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> List[Model]: ...
|
def get_list_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> List[Model]: ...
|
||||||
def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...
|
def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
from typing import Any, Dict, Iterator, List, Tuple, Union
|
||||||
|
|
||||||
|
from django.template.base import Template
|
||||||
|
|
||||||
class BaseEngine:
|
class BaseEngine:
|
||||||
name: Any = ...
|
name: Any = ...
|
||||||
@@ -7,7 +9,7 @@ class BaseEngine:
|
|||||||
def __init__(self, params: Dict[str, Union[List[str], bool, str]]) -> None: ...
|
def __init__(self, params: Dict[str, Union[List[str], bool, str]]) -> None: ...
|
||||||
@property
|
@property
|
||||||
def app_dirname(self) -> None: ...
|
def app_dirname(self) -> None: ...
|
||||||
def from_string(self, template_code: Any) -> None: ...
|
def from_string(self, template_code: Any) -> Template: ...
|
||||||
def get_template(self, template_name: Any) -> None: ...
|
def get_template(self, template_name: Any) -> None: ...
|
||||||
def template_dirs(self) -> Tuple[str]: ...
|
def template_dirs(self) -> Tuple[str]: ...
|
||||||
def iter_template_filenames(self, template_name: str) -> Iterator[str]: ...
|
def iter_template_filenames(self, template_name: str) -> Iterator[str]: ...
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from typing import Dict, List, Optional, Union, Any
|
from typing import Dict, List, Optional, Union, Any
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
|
from . import engines as engines
|
||||||
|
|
||||||
def get_template(template_name: str, using: Optional[str] = ...) -> Any: ...
|
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 select_template(template_name_list: Union[List[str], str], using: Optional[str] = ...) -> Any: ...
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Any, Dict, List, Optional, Union, Tuple, Type
|
from typing import Any, Dict, List, Optional, Pattern, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.sessions.backends.base import SessionBase
|
from django.contrib.sessions.backends.base import SessionBase
|
||||||
from django.core.handlers.base import BaseHandler
|
from django.core.handlers.base import BaseHandler
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
from django.http.cookie import SimpleCookie
|
from django.http.cookie import SimpleCookie
|
||||||
from django.http.response import HttpResponseBase
|
from django.http.request import HttpRequest
|
||||||
|
from django.http.response import HttpResponse, HttpResponseBase
|
||||||
|
|
||||||
|
CONTENT_TYPE_RE: Pattern
|
||||||
|
|
||||||
class RedirectCycleError(Exception):
|
class RedirectCycleError(Exception):
|
||||||
last_response: HttpResponseBase = ...
|
last_response: HttpResponseBase = ...
|
||||||
@@ -35,13 +37,13 @@ class RequestFactory:
|
|||||||
cookies: SimpleCookie = ...
|
cookies: SimpleCookie = ...
|
||||||
errors: BytesIO = ...
|
errors: BytesIO = ...
|
||||||
def __init__(self, *, json_encoder: Any = ..., **defaults: Any) -> None: ...
|
def __init__(self, *, json_encoder: Any = ..., **defaults: Any) -> None: ...
|
||||||
def request(self, **request: Any) -> WSGIRequest: ...
|
def request(self, **request: Any) -> HttpRequest: ...
|
||||||
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||||
def post(
|
def post(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||||
def trace(self, path: str, secure: bool = ..., **extra: Any) -> WSGIRequest: ...
|
def trace(self, path: str, secure: bool = ..., **extra: Any) -> HttpRequest: ...
|
||||||
def options(
|
def options(
|
||||||
self,
|
self,
|
||||||
path: str,
|
path: str,
|
||||||
@@ -49,16 +51,16 @@ class RequestFactory:
|
|||||||
content_type: str = ...,
|
content_type: str = ...,
|
||||||
secure: bool = ...,
|
secure: bool = ...,
|
||||||
**extra: Any
|
**extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def put(
|
def put(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def patch(
|
def patch(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def delete(
|
def delete(
|
||||||
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
def generic(
|
def generic(
|
||||||
self,
|
self,
|
||||||
method: str,
|
method: str,
|
||||||
@@ -67,19 +69,54 @@ class RequestFactory:
|
|||||||
content_type: Optional[str] = ...,
|
content_type: Optional[str] = ...,
|
||||||
secure: bool = ...,
|
secure: bool = ...,
|
||||||
**extra: Any
|
**extra: Any
|
||||||
) -> WSGIRequest: ...
|
) -> HttpRequest: ...
|
||||||
|
|
||||||
class Client(RequestFactory):
|
class Client:
|
||||||
defaults: Dict[str, str]
|
json_encoder: Type[DjangoJSONEncoder] = ...
|
||||||
errors: BytesIO
|
defaults: Dict[str, str] = ...
|
||||||
json_encoder: Type[DjangoJSONEncoder]
|
cookies: SimpleCookie = ...
|
||||||
|
errors: BytesIO = ...
|
||||||
handler: ClientHandler = ...
|
handler: ClientHandler = ...
|
||||||
exc_info: None = ...
|
exc_info: None = ...
|
||||||
def __init__(self, enforce_csrf_checks: bool = ..., **defaults: Any) -> None: ...
|
def __init__(self, enforce_csrf_checks: bool = ..., **defaults: Any) -> None: ...
|
||||||
|
def request(self, **request: Any) -> HttpResponse: ...
|
||||||
|
def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpResponse: ...
|
||||||
|
def post(
|
||||||
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
|
) -> HttpResponse: ...
|
||||||
|
def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> HttpResponse: ...
|
||||||
|
def trace(self, path: str, secure: bool = ..., **extra: Any) -> HttpResponse: ...
|
||||||
|
def options(
|
||||||
|
self,
|
||||||
|
path: str,
|
||||||
|
data: Union[Dict[str, str], str] = ...,
|
||||||
|
content_type: str = ...,
|
||||||
|
secure: bool = ...,
|
||||||
|
**extra: Any
|
||||||
|
) -> HttpResponse: ...
|
||||||
|
def put(
|
||||||
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
|
) -> HttpResponse: ...
|
||||||
|
def patch(
|
||||||
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
|
) -> HttpResponse: ...
|
||||||
|
def delete(
|
||||||
|
self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any
|
||||||
|
) -> HttpResponse: ...
|
||||||
|
def generic(
|
||||||
|
self,
|
||||||
|
method: str,
|
||||||
|
path: str,
|
||||||
|
data: Any = ...,
|
||||||
|
content_type: Optional[str] = ...,
|
||||||
|
secure: bool = ...,
|
||||||
|
**extra: Any
|
||||||
|
) -> HttpResponse: ...
|
||||||
def store_exc_info(self, **kwargs: Any) -> None: ...
|
def store_exc_info(self, **kwargs: Any) -> None: ...
|
||||||
@property
|
@property
|
||||||
def session(self) -> SessionBase: ...
|
def session(self) -> SessionBase: ...
|
||||||
def login(self, **credentials: Any) -> bool: ...
|
def login(self, **credentials: Any) -> bool: ...
|
||||||
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
|
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
|
||||||
cookies: SimpleCookie = ...
|
|
||||||
def logout(self) -> None: ...
|
def logout(self) -> None: ...
|
||||||
|
|
||||||
|
def conditional_content_removal(request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from typing import Any, List, Optional, Tuple, Union, TypeVar
|
from typing import Any, List, Optional, Tuple, Union, TypeVar, Iterable, Sequence
|
||||||
|
|
||||||
_Self = TypeVar("_Self")
|
_Self = TypeVar("_Self")
|
||||||
|
|
||||||
@@ -7,20 +7,20 @@ WHITESPACE: Any
|
|||||||
|
|
||||||
def normalize_whitespace(string: str) -> str: ...
|
def normalize_whitespace(string: str) -> str: ...
|
||||||
|
|
||||||
|
_ElementAttribute = Tuple[str, Optional[str]]
|
||||||
|
|
||||||
class Element:
|
class Element:
|
||||||
name: Optional[str] = ...
|
name: Optional[str] = ...
|
||||||
attributes: List[Tuple[str, Optional[str]]] = ...
|
attributes: List[_ElementAttribute] = ...
|
||||||
children: List[Union[Element, str]] = ...
|
children: List[Any] = ...
|
||||||
def __init__(self, name: Optional[str], attributes: Union[List[Tuple[str, Optional[str]]], Tuple]) -> None: ...
|
def __init__(self, name: Optional[str], attributes: Sequence[_ElementAttribute]) -> None: ...
|
||||||
def append(self, element: Union[Element, str]) -> None: ...
|
def append(self, element: Union[Element, str]) -> None: ...
|
||||||
def finalize(self) -> None: ...
|
def finalize(self) -> None: ...
|
||||||
def __contains__(self, element: Union[Element, str]) -> bool: ...
|
def __contains__(self, element: Union[Element, str]) -> bool: ...
|
||||||
def count(self, element: Union[Element, str]) -> int: ...
|
def count(self, element: Union[Element, str]) -> int: ...
|
||||||
def __getitem__(self, key: int) -> Union[Element, str]: ...
|
def __getitem__(self, key: int) -> Any: ...
|
||||||
|
|
||||||
class RootElement(Element):
|
class RootElement(Element):
|
||||||
attributes: List[Any]
|
|
||||||
children: List[Union[Element, str]]
|
|
||||||
def __init__(self) -> None: ...
|
def __init__(self) -> None: ...
|
||||||
|
|
||||||
class HTMLParseError(Exception): ...
|
class HTMLParseError(Exception): ...
|
||||||
|
|||||||
@@ -5,15 +5,17 @@ from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Ty
|
|||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.handlers.wsgi import WSGIHandler
|
from django.core.handlers.wsgi import WSGIHandler
|
||||||
from django.core.servers.basehttp import WSGIRequestHandler, ThreadedWSGIServer
|
from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler
|
||||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.query import QuerySet, RawQuerySet
|
from django.db.models.query import QuerySet, RawQuerySet
|
||||||
from django.forms.fields import EmailField
|
from django.forms.fields import EmailField
|
||||||
from django.http.response import HttpResponse, HttpResponseBase
|
from django.http.response import HttpResponse, HttpResponseBase
|
||||||
from django.template.base import Template
|
from django.template.base import Template
|
||||||
from django.test.utils import CaptureQueriesContext, modify_settings, override_settings, ContextList
|
from django.test.client import Client
|
||||||
|
from django.test.utils import CaptureQueriesContext, ContextList
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
from django.db import connections as connections
|
||||||
|
|
||||||
class _AssertNumQueriesContext(CaptureQueriesContext):
|
class _AssertNumQueriesContext(CaptureQueriesContext):
|
||||||
connection: Any
|
connection: Any
|
||||||
@@ -55,6 +57,7 @@ class _CursorFailure:
|
|||||||
|
|
||||||
class SimpleTestCase(unittest.TestCase):
|
class SimpleTestCase(unittest.TestCase):
|
||||||
client_class: Any = ...
|
client_class: Any = ...
|
||||||
|
client: Client
|
||||||
allow_database_queries: bool = ...
|
allow_database_queries: bool = ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls) -> None: ...
|
def setUpClass(cls) -> None: ...
|
||||||
@@ -233,3 +236,5 @@ class SerializeMixin:
|
|||||||
def setUpClass(cls) -> None: ...
|
def setUpClass(cls) -> None: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls) -> None: ...
|
def tearDownClass(cls) -> None: ...
|
||||||
|
|
||||||
|
def connections_support_transactions() -> bool: ...
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import warnings
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, IO
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, IO, Iterable, Mapping
|
||||||
|
|
||||||
from django.apps.registry import Apps
|
from django.apps.registry import Apps
|
||||||
from django.core.checks.registry import CheckRegistry
|
from django.core.checks.registry import CheckRegistry
|
||||||
@@ -118,3 +118,15 @@ def captured_stderr() -> Iterator[StringIO]: ...
|
|||||||
@contextmanager
|
@contextmanager
|
||||||
def freeze_time(t: float) -> Iterator[None]: ...
|
def freeze_time(t: float) -> Iterator[None]: ...
|
||||||
def tag(*tags: str): ...
|
def tag(*tags: str): ...
|
||||||
|
|
||||||
|
_Signature = str
|
||||||
|
_TestDatabase = Tuple[str, List[str]]
|
||||||
|
|
||||||
|
def dependency_ordered(
|
||||||
|
test_databases: Iterable[Tuple[_Signature, _TestDatabase]], dependencies: Mapping[str, List[str]]
|
||||||
|
) -> List[Tuple[_Signature, _TestDatabase]]: ...
|
||||||
|
def get_unique_databases_and_mirrors() -> Tuple[Dict[_Signature, _TestDatabase], Dict[str, Any]]: ...
|
||||||
|
def teardown_databases(
|
||||||
|
old_config: Iterable[Tuple[Any, str, bool]], verbosity: int, parallel: int = ..., keepdb: bool = ...
|
||||||
|
) -> None: ...
|
||||||
|
def require_jinja2(test_func: Callable) -> Callable: ...
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ class URLResolver:
|
|||||||
default_kwargs: Dict[str, Any] = ...
|
default_kwargs: Dict[str, Any] = ...
|
||||||
namespace: Optional[str] = ...
|
namespace: Optional[str] = ...
|
||||||
app_name: Optional[str] = ...
|
app_name: Optional[str] = ...
|
||||||
|
_local: Any
|
||||||
|
_reverse_dict: MultiValueDict
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
pattern: Any,
|
pattern: Any,
|
||||||
@@ -101,3 +103,5 @@ class URLResolver:
|
|||||||
def resolve(self, path: str) -> ResolverMatch: ...
|
def resolve(self, path: str) -> ResolverMatch: ...
|
||||||
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[str, Any]]: ...
|
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[str, Any]]: ...
|
||||||
def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...
|
def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...
|
||||||
|
def _is_callback(self, name: str) -> bool: ...
|
||||||
|
def _populate(self) -> None: ...
|
||||||
|
|||||||
@@ -1,74 +1,58 @@
|
|||||||
# Stubs for django.utils.datastructures (Python 3.5)
|
|
||||||
|
|
||||||
from collections import OrderedDict
|
|
||||||
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
Dict,
|
Dict,
|
||||||
Generic,
|
|
||||||
Iterable,
|
Iterable,
|
||||||
Iterator,
|
|
||||||
List,
|
List,
|
||||||
Mapping,
|
Mapping,
|
||||||
MutableMapping,
|
MutableMapping,
|
||||||
MutableSet,
|
MutableSet,
|
||||||
Optional,
|
|
||||||
overload,
|
|
||||||
Tuple,
|
Tuple,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
Union,
|
Union,
|
||||||
|
overload,
|
||||||
|
Iterator,
|
||||||
)
|
)
|
||||||
|
|
||||||
KT = TypeVar("KT")
|
_K = TypeVar("_K")
|
||||||
VT = TypeVar("VT")
|
_V = TypeVar("_V")
|
||||||
|
|
||||||
class OrderedSet(MutableSet[KT], Generic[KT]):
|
class OrderedSet(MutableSet[_K]):
|
||||||
dict = ... # type: OrderedDict[KT, None]
|
dict: Dict[_K, None] = ...
|
||||||
def __init__(self, iterable: Iterable[KT] = None) -> None: ...
|
def __contains__(self, item: object) -> bool: ...
|
||||||
def add(self, item: KT) -> None: ...
|
def __iter__(self) -> Iterator[_K]: ...
|
||||||
def remove(self, item: KT) -> None: ...
|
def __len__(self) -> int: ...
|
||||||
def discard(self, item: KT) -> None: ...
|
def add(self, x: _K) -> None: ...
|
||||||
def __contains__(self, item): ...
|
def discard(self, item: _K) -> None: ...
|
||||||
def __iter__(self): ...
|
|
||||||
def __len__(self): ...
|
|
||||||
|
|
||||||
class MultiValueDictKeyError(KeyError): ...
|
class MultiValueDictKeyError(KeyError): ...
|
||||||
|
|
||||||
class MultiValueDict(MutableMapping[KT, VT], Generic[KT, VT]):
|
class MultiValueDict(MutableMapping[_K, List[_V]]):
|
||||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[KT, List[VT]]] = ...) -> None: ...
|
|
||||||
def __copy__(self) -> "MultiValueDict[KT, VT]": ...
|
|
||||||
def __deepcopy__(self, memo: Dict[int, object]) -> "MultiValueDict[KT, VT]": ...
|
|
||||||
def __getitem__(self, key: KT) -> Union[VT, List[VT]]: ... # type: ignore
|
|
||||||
def pop(self, key: KT, default: List[VT] = None) -> List[VT]: ... # type: ignore
|
|
||||||
def __getstate__(self) -> Dict[str, Any]: ...
|
|
||||||
def __setstate__(self, obj_dict: Dict[str, Any]) -> None: ...
|
|
||||||
def get(self, key: KT, default: VT = None) -> Union[Optional[VT], List[VT]]: ... # type: ignore
|
|
||||||
def getlist(self, key: KT, default: List[VT] = None) -> List[VT]: ...
|
|
||||||
def setlist(self, key: KT, list_: List[VT]) -> None: ...
|
|
||||||
def setlistdefault(self, key: KT, default_list: List[VT] = None) -> List[VT]: ...
|
|
||||||
def appendlist(self, key: KT, value: VT) -> None: ...
|
|
||||||
def lists(self) -> Iterable[Tuple[KT, List[VT]]]: ...
|
|
||||||
def copy(self) -> "MultiValueDict[KT, VT]": ...
|
|
||||||
@overload # type: ignore
|
|
||||||
def update(self, args: Mapping[KT, VT]) -> None: ...
|
|
||||||
@overload
|
@overload
|
||||||
def update(self, *args: Mapping[KT, VT], **kwargs: Iterable[Tuple[KT, VT]]) -> None: ... # type: ignore
|
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ...) -> None: ...
|
||||||
def dict(self) -> Dict[KT, Union[VT, List[VT]]]: ...
|
@overload
|
||||||
|
def __init__(self, key_to_list_mapping: Mapping[_K, List[_V]] = ...) -> 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]]: ...
|
||||||
# These overrides are needed to convince mypy that this isn't an abstract class
|
# These overrides are needed to convince mypy that this isn't an abstract class
|
||||||
def __delitem__(self, k: KT) -> None: ...
|
def __delitem__(self, item: _K) -> None: ...
|
||||||
def __setitem__(self, k: KT, v: VT) -> None: ...
|
def __getitem__(self, item: _K) -> List[_V]: ...
|
||||||
|
def __setitem__(self, k: _K, v: List[_V]) -> None: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
def __iter__(self) -> Iterator[KT]: ...
|
def __iter__(self) -> Iterator[_K]: ...
|
||||||
|
|
||||||
class ImmutableList(Tuple[VT, ...], Generic[VT]):
|
class ImmutableList(Tuple[_V, ...]):
|
||||||
warning = ... # type: str
|
warning: str = ...
|
||||||
def complain(self, *wargs: Any, **kwargs: Any) -> None: ...
|
def complain(self, *wargs: Any, **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
class DictWrapper(Dict[str, VT], Generic[VT]):
|
class DictWrapper(Dict[str, _V]):
|
||||||
func = ... # type: Callable[[VT], VT]
|
func: Callable[[_V], _V] = ...
|
||||||
prefix = ... # type: str
|
prefix: str = ...
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, data: Mapping[str, VT], func: Callable[[VT], VT], prefix: str) -> None: ...
|
def __init__(self, data: Mapping[str, _V], func: Callable[[_V], _V], prefix: str) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, data: Iterable[Tuple[str, VT]], func: Callable[[VT], VT], prefix: str) -> None: ...
|
def __init__(self, data: Iterable[Tuple[str, _V]], func: Callable[[_V], _V], prefix: str) -> None: ...
|
||||||
|
|||||||
@@ -69,3 +69,5 @@ def get_language_from_request(request: WSGIRequest, check_path: bool = ...) -> s
|
|||||||
def templatize(src: str, **kwargs: Any) -> str: ...
|
def templatize(src: str, **kwargs: Any) -> str: ...
|
||||||
def deactivate_all() -> None: ...
|
def deactivate_all() -> None: ...
|
||||||
def get_language_info(lang_code: str) -> Any: ...
|
def get_language_info(lang_code: str) -> Any: ...
|
||||||
|
|
||||||
|
from . import trans_real as trans_real
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import gettext as gettext_module
|
import gettext as gettext_module
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from gettext import NullTranslations
|
from gettext import NullTranslations
|
||||||
from typing import Any, List, Optional, Tuple
|
from typing import Any, List, Optional, Tuple, Callable
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ def determine_model_cls_from_string_for_migrations(ctx: MethodContext) -> Type:
|
|||||||
if 'model_name' not in ctx.callee_arg_names:
|
if 'model_name' not in ctx.callee_arg_names:
|
||||||
return ctx.default_return_type
|
return ctx.default_return_type
|
||||||
|
|
||||||
model_name_expr = ctx.args[ctx.callee_arg_names.index('model_name')][0]
|
model_name_expr_tuple = ctx.args[ctx.callee_arg_names.index('model_name')]
|
||||||
model_name = get_string_value_from_expr(model_name_expr)
|
if not model_name_expr_tuple:
|
||||||
|
return ctx.default_return_type
|
||||||
|
|
||||||
|
model_name = get_string_value_from_expr(model_name_expr_tuple[0])
|
||||||
if model_name is None:
|
if model_name is None:
|
||||||
return ctx.default_return_type
|
return ctx.default_return_type
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ DJANGO_COMMIT_SHA = '03219b5f709dcd5b0bfacd963508625557ec1ef0'
|
|||||||
|
|
||||||
# Some errors occur for the test suite itself, and cannot be addressed via django-stubs. They should be ignored
|
# Some errors occur for the test suite itself, and cannot be addressed via django-stubs. They should be ignored
|
||||||
# using this constant.
|
# using this constant.
|
||||||
MOCK_OBJECTS = ['MockRequest', 'MockCompiler', 'modelz']
|
MOCK_OBJECTS = ['MockRequest', 'MockCompiler', 'modelz', 'call_count', 'call_args_list', 'call_args']
|
||||||
IGNORED_ERRORS = {
|
IGNORED_ERRORS = {
|
||||||
'__common__': [
|
'__common__': [
|
||||||
*MOCK_OBJECTS,
|
*MOCK_OBJECTS,
|
||||||
@@ -35,7 +35,7 @@ IGNORED_ERRORS = {
|
|||||||
# settings
|
# settings
|
||||||
re.compile(r'Module has no attribute "[A-Z_]+"'),
|
re.compile(r'Module has no attribute "[A-Z_]+"'),
|
||||||
# attributes assigned to test functions
|
# attributes assigned to test functions
|
||||||
re.compile(r'"Callable\[\[(Any(, )?)+(, VarArg\(Any\))?(, KwArg\(Any\))?\], Any\]" has no attribute'),
|
re.compile(r'"Callable\[\[(Any(, )?)*((, )?VarArg\(Any\))?((, )?KwArg\(Any\))?\], Any\]" has no attribute'),
|
||||||
# assign empty tuple
|
# assign empty tuple
|
||||||
re.compile(r'Incompatible types in assignment \(expression has type "Tuple\[\]", '
|
re.compile(r'Incompatible types in assignment \(expression has type "Tuple\[\]", '
|
||||||
r'variable has type "Tuple\[[A-Za-z, ]+\]"'),
|
r'variable has type "Tuple\[[A-Za-z, ]+\]"'),
|
||||||
@@ -44,6 +44,9 @@ IGNORED_ERRORS = {
|
|||||||
'Cannot infer type of lambda',
|
'Cannot infer type of lambda',
|
||||||
re.compile(r'Incompatible types in assignment \(expression has type "Callable\[\[(Any(, )?)+\], Any\]", '
|
re.compile(r'Incompatible types in assignment \(expression has type "Callable\[\[(Any(, )?)+\], Any\]", '
|
||||||
r'variable has type "Callable\['),
|
r'variable has type "Callable\['),
|
||||||
|
# cookies private attribute
|
||||||
|
'has no attribute "_reserved"',
|
||||||
|
'full_clean" of "Model" does not return a value'
|
||||||
],
|
],
|
||||||
'admin_changelist': [
|
'admin_changelist': [
|
||||||
'Incompatible types in assignment (expression has type "FilteredChildAdmin", variable has type "ChildAdmin")'
|
'Incompatible types in assignment (expression has type "FilteredChildAdmin", variable has type "ChildAdmin")'
|
||||||
@@ -63,6 +66,17 @@ IGNORED_ERRORS = {
|
|||||||
'aggregation_regress': [
|
'aggregation_regress': [
|
||||||
'Incompatible types in assignment (expression has type "List[str]", variable has type "QuerySet[Author]")'
|
'Incompatible types in assignment (expression has type "List[str]", variable has type "QuerySet[Author]")'
|
||||||
],
|
],
|
||||||
|
'apps': [
|
||||||
|
'Incompatible types in assignment (expression has type "str", target has type "type")',
|
||||||
|
'"Callable[[bool, bool], List[Type[Model]]]" has no attribute "cache_clear"'
|
||||||
|
],
|
||||||
|
'auth_tests': [
|
||||||
|
'"PasswordValidator" has no attribute "min_length"',
|
||||||
|
'"validate_password" does not return a value',
|
||||||
|
'"password_changed" does not return a value',
|
||||||
|
re.compile(r'"validate" of "([A-Za-z]+)" does not return a value'),
|
||||||
|
'Module has no attribute "SessionStore"'
|
||||||
|
],
|
||||||
'basic': [
|
'basic': [
|
||||||
'Unexpected keyword argument "unknown_kwarg" for "refresh_from_db" of "Model"',
|
'Unexpected keyword argument "unknown_kwarg" for "refresh_from_db" of "Model"',
|
||||||
'"refresh_from_db" of "Model" defined here'
|
'"refresh_from_db" of "Model" defined here'
|
||||||
@@ -120,11 +134,32 @@ IGNORED_ERRORS = {
|
|||||||
'queryset_pickle': [
|
'queryset_pickle': [
|
||||||
'"None" has no attribute "somefield"'
|
'"None" has no attribute "somefield"'
|
||||||
],
|
],
|
||||||
|
'requests': [
|
||||||
|
'Incompatible types in assignment (expression has type "Dict[str, str]", variable has type "QueryDict")'
|
||||||
|
],
|
||||||
'prefetch_related': [
|
'prefetch_related': [
|
||||||
'Incompatible types in assignment (expression has type "List[Room]", variable has type "QuerySet[Room]")',
|
'Incompatible types in assignment (expression has type "List[Room]", variable has type "QuerySet[Room]")',
|
||||||
'"None" has no attribute "__iter__"',
|
'"None" has no attribute "__iter__"',
|
||||||
'has no attribute "read_by"'
|
'has no attribute "read_by"'
|
||||||
],
|
],
|
||||||
|
'signals': [
|
||||||
|
'Argument 1 to "append" of "list" has incompatible type "Tuple[Any, Any, Any, Any]"; expected "Tuple[Any, Any, Any]"'
|
||||||
|
],
|
||||||
|
'transactions': [
|
||||||
|
'Incompatible types in assignment (expression has type "Thread", variable has type "Callable[[], Any]")'
|
||||||
|
],
|
||||||
|
'test_client': [
|
||||||
|
'Incompatible types in assignment (expression has type "StreamingHttpResponse", variable has type "HttpResponse")',
|
||||||
|
],
|
||||||
|
'test_client_regress': [
|
||||||
|
'Incompatible types in assignment (expression has type "Dict[<nothing>, <nothing>]", variable has type "SessionBase")'
|
||||||
|
],
|
||||||
|
'timezones': [
|
||||||
|
'Too few arguments for "render" of "Template"'
|
||||||
|
],
|
||||||
|
'test_runner': [
|
||||||
|
'Value of type "TestSuite" is not indexable'
|
||||||
|
],
|
||||||
'urlpatterns': [
|
'urlpatterns': [
|
||||||
'"object" has no attribute "__iter__"; maybe "__str__" or "__dir__"? (not iterable)',
|
'"object" has no attribute "__iter__"; maybe "__str__" or "__dir__"? (not iterable)',
|
||||||
'"object" not callable'
|
'"object" not callable'
|
||||||
@@ -132,9 +167,16 @@ IGNORED_ERRORS = {
|
|||||||
'user_commands': [
|
'user_commands': [
|
||||||
'Incompatible types in assignment (expression has type "Callable[[Any, KwArg(Any)], Any]", variable has type'
|
'Incompatible types in assignment (expression has type "Callable[[Any, KwArg(Any)], Any]", variable has type'
|
||||||
],
|
],
|
||||||
|
'utils_tests': [
|
||||||
|
re.compile(r'Argument ([1-9]) to "__get__" of "classproperty" has incompatible type')
|
||||||
|
],
|
||||||
|
'urlpatterns_reverse': [
|
||||||
|
'to "reverse" has incompatible type "object"',
|
||||||
|
'Module has no attribute "_translations"',
|
||||||
|
"'django.urls.resolvers.ResolverMatch' object is not iterable"
|
||||||
|
],
|
||||||
'sessions_tests': [
|
'sessions_tests': [
|
||||||
'base class "SessionTestsMixin" defined the type as "None")',
|
'base class "SessionTestsMixin" defined the type as "None")'
|
||||||
'has no attribute "_reserved"'
|
|
||||||
],
|
],
|
||||||
'select_related_onetoone': [
|
'select_related_onetoone': [
|
||||||
'"None" has no attribute'
|
'"None" has no attribute'
|
||||||
@@ -165,8 +207,8 @@ TESTS_DIRS = [
|
|||||||
'aggregation_regress',
|
'aggregation_regress',
|
||||||
'annotations',
|
'annotations',
|
||||||
'app_loading',
|
'app_loading',
|
||||||
# TODO: 'apps',
|
'apps',
|
||||||
# TODO: 'auth_tests'
|
# TODO: 'auth_tests',
|
||||||
'base',
|
'base',
|
||||||
'bash_completion',
|
'bash_completion',
|
||||||
'basic',
|
'basic',
|
||||||
@@ -297,10 +339,10 @@ TESTS_DIRS = [
|
|||||||
'queryset_pickle',
|
'queryset_pickle',
|
||||||
'raw_query',
|
'raw_query',
|
||||||
'redirects_tests',
|
'redirects_tests',
|
||||||
# TODO: 'requests',
|
'requests',
|
||||||
'reserved_names',
|
'reserved_names',
|
||||||
'resolve_url',
|
'resolve_url',
|
||||||
# TODO: 'responses',
|
'responses',
|
||||||
'reverse_lookup',
|
'reverse_lookup',
|
||||||
'save_delete_hooks',
|
'save_delete_hooks',
|
||||||
'schema',
|
'schema',
|
||||||
@@ -313,8 +355,8 @@ TESTS_DIRS = [
|
|||||||
'sessions_tests',
|
'sessions_tests',
|
||||||
'settings_tests',
|
'settings_tests',
|
||||||
'shell',
|
'shell',
|
||||||
# TODO: 'shortcuts',
|
'shortcuts',
|
||||||
# TODO: 'signals',
|
'signals',
|
||||||
'signed_cookies_tests',
|
'signed_cookies_tests',
|
||||||
# TODO: 'signing',
|
# TODO: 'signing',
|
||||||
# TODO: 'sitemaps_tests',
|
# TODO: 'sitemaps_tests',
|
||||||
@@ -328,23 +370,32 @@ TESTS_DIRS = [
|
|||||||
# TODO: 'template_backends',
|
# TODO: 'template_backends',
|
||||||
'template_loader',
|
'template_loader',
|
||||||
# TODO: 'template_tests',
|
# TODO: 'template_tests',
|
||||||
# TODO: 'test_client',
|
'test_client',
|
||||||
# TODO: 'test_client_regress',
|
'test_client_regress',
|
||||||
'test_exceptions',
|
'test_exceptions',
|
||||||
# TODO: 'test_runner',
|
# TODO: 'test_runner',
|
||||||
'test_runner_apps',
|
'test_runner_apps',
|
||||||
# TODO: 'test_utils',
|
'test_utils',
|
||||||
# TODO: 'timezones',
|
'timezones',
|
||||||
'transaction_hooks',
|
'transaction_hooks',
|
||||||
# TODO: 'transactions',
|
'transactions',
|
||||||
'unmanaged_models',
|
'unmanaged_models',
|
||||||
|
|
||||||
|
# wait for "allow redefinitions" here
|
||||||
# TODO: 'update',
|
# TODO: 'update',
|
||||||
|
|
||||||
'update_only_fields',
|
'update_only_fields',
|
||||||
'urlpatterns',
|
'urlpatterns',
|
||||||
|
|
||||||
|
# not annotatable without annotation in test
|
||||||
# TODO: 'urlpatterns_reverse',
|
# TODO: 'urlpatterns_reverse',
|
||||||
|
|
||||||
'user_commands',
|
'user_commands',
|
||||||
# TODO: 'utils_tests',
|
# TODO: 'utils_tests',
|
||||||
|
|
||||||
|
# not annotatable without annotation in test
|
||||||
# TODO: 'validation',
|
# TODO: 'validation',
|
||||||
|
|
||||||
'validators',
|
'validators',
|
||||||
'version',
|
'version',
|
||||||
'view_tests',
|
'view_tests',
|
||||||
@@ -380,9 +431,9 @@ def is_ignored(line: str, test_folder_name: str) -> bool:
|
|||||||
|
|
||||||
def replace_with_clickable_location(error: str, abs_test_folder: Path) -> str:
|
def replace_with_clickable_location(error: str, abs_test_folder: Path) -> str:
|
||||||
raw_path, _, error_line = error.partition(': ')
|
raw_path, _, error_line = error.partition(': ')
|
||||||
fname, line_number = raw_path.split(':')
|
fname, _,line_number = raw_path.partition(':')
|
||||||
path = abs_test_folder.joinpath(fname).relative_to(PROJECT_DIRECTORY)
|
path = abs_test_folder.joinpath(fname).relative_to(PROJECT_DIRECTORY)
|
||||||
clickable_location = f'./{path}:{line_number}'
|
clickable_location = f'./{path}:{line_number or 1}'
|
||||||
return error.replace(raw_path, clickable_location)
|
return error.replace(raw_path, clickable_location)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user