mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 20:54:29 +08:00
add test_views test folder
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Type, Union, Sequence
|
||||||
|
|
||||||
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
|
||||||
@@ -15,7 +15,7 @@ def render_to_response(
|
|||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def render(
|
def render(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
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] = ...,
|
||||||
|
|||||||
@@ -1,25 +1,18 @@
|
|||||||
import logging.config
|
import logging.config
|
||||||
from logging import LogRecord
|
from typing import Any, Callable, Dict, Optional
|
||||||
from typing import Any, Callable, Dict, List, Optional, Union
|
|
||||||
|
|
||||||
from django.core.mail.backends.locmem import EmailBackend
|
from django.core.mail.backends.locmem import EmailBackend
|
||||||
|
from django.core.management.color import Style
|
||||||
|
|
||||||
request_logger: Any
|
request_logger: Any
|
||||||
DEFAULT_LOGGING: Any
|
DEFAULT_LOGGING: Any
|
||||||
|
|
||||||
def configure_logging(
|
def configure_logging(logging_config: str, logging_settings: Dict[str, Any]) -> None: ...
|
||||||
logging_config: str, logging_settings: Dict[str, Union[Dict[str, Dict[str, Union[List[str], bool, str]]], int]]
|
|
||||||
) -> None: ...
|
|
||||||
|
|
||||||
class AdminEmailHandler(logging.Handler):
|
class AdminEmailHandler(logging.Handler):
|
||||||
filters: List[django.utils.log.RequireDebugFalse]
|
|
||||||
formatter: None
|
|
||||||
level: int
|
|
||||||
lock: _thread.RLock
|
|
||||||
include_html: bool = ...
|
include_html: bool = ...
|
||||||
email_backend: Optional[str] = ...
|
email_backend: Optional[str] = ...
|
||||||
def __init__(self, include_html: bool = ..., email_backend: None = ...) -> None: ...
|
def __init__(self, include_html: bool = ..., email_backend: Optional[str] = ...) -> None: ...
|
||||||
def emit(self, record: LogRecord) -> None: ...
|
|
||||||
def send_mail(self, subject: str, message: str, *args: Any, **kwargs: Any) -> None: ...
|
def send_mail(self, subject: str, message: str, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def connection(self) -> EmailBackend: ...
|
def connection(self) -> EmailBackend: ...
|
||||||
def format_subject(self, subject: str) -> str: ...
|
def format_subject(self, subject: str) -> str: ...
|
||||||
@@ -27,23 +20,14 @@ class AdminEmailHandler(logging.Handler):
|
|||||||
class CallbackFilter(logging.Filter):
|
class CallbackFilter(logging.Filter):
|
||||||
callback: Callable = ...
|
callback: Callable = ...
|
||||||
def __init__(self, callback: Callable) -> None: ...
|
def __init__(self, callback: Callable) -> None: ...
|
||||||
def filter(self, record: str) -> int: ...
|
|
||||||
|
|
||||||
class RequireDebugFalse(logging.Filter):
|
class RequireDebugFalse(logging.Filter): ...
|
||||||
name: str
|
class RequireDebugTrue(logging.Filter): ...
|
||||||
nlen: int
|
|
||||||
def filter(self, record: Union[LogRecord, str]) -> bool: ...
|
|
||||||
|
|
||||||
class RequireDebugTrue(logging.Filter):
|
|
||||||
name: str
|
|
||||||
nlen: int
|
|
||||||
def filter(self, record: Union[LogRecord, str]) -> bool: ...
|
|
||||||
|
|
||||||
class ServerFormatter(logging.Formatter):
|
class ServerFormatter(logging.Formatter):
|
||||||
datefmt: None
|
datefmt: None
|
||||||
style: django.core.management.color.Style = ...
|
style: Style = ...
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def format(self, record: LogRecord) -> str: ...
|
|
||||||
def uses_server_time(self) -> bool: ...
|
def uses_server_time(self) -> bool: ...
|
||||||
|
|
||||||
def log_response(
|
def log_response(
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
from importlib.abc import SourceLoader
|
||||||
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
||||||
|
from types import TracebackType
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIRequest
|
from django.core.handlers.wsgi import WSGIRequest
|
||||||
from django.http.request import QueryDict
|
from django.http.request import QueryDict
|
||||||
@@ -16,8 +18,8 @@ class CallableSettingWrapper:
|
|||||||
def cleanse_setting(key: Union[int, str], value: Any) -> Any: ...
|
def cleanse_setting(key: Union[int, str], value: Any) -> Any: ...
|
||||||
def get_safe_settings() -> Dict[str, Any]: ...
|
def get_safe_settings() -> Dict[str, Any]: ...
|
||||||
def technical_500_response(request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ...): ...
|
def technical_500_response(request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ...): ...
|
||||||
def get_default_exception_reporter_filter() -> SafeExceptionReporterFilter: ...
|
def get_default_exception_reporter_filter() -> ExceptionReporterFilter: ...
|
||||||
def get_exception_reporter_filter(request: Optional[WSGIRequest]) -> SafeExceptionReporterFilter: ...
|
def get_exception_reporter_filter(request: Optional[WSGIRequest]) -> ExceptionReporterFilter: ...
|
||||||
|
|
||||||
class ExceptionReporterFilter:
|
class ExceptionReporterFilter:
|
||||||
def get_post_parameters(self, request: Any): ...
|
def get_post_parameters(self, request: Any): ...
|
||||||
@@ -32,7 +34,7 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
|
|||||||
|
|
||||||
class ExceptionReporter:
|
class ExceptionReporter:
|
||||||
request: Optional[WSGIRequest] = ...
|
request: Optional[WSGIRequest] = ...
|
||||||
filter: django.views.debug.SafeExceptionReporterFilter = ...
|
filter: ExceptionReporterFilter = ...
|
||||||
exc_type: None = ...
|
exc_type: None = ...
|
||||||
exc_value: Optional[str] = ...
|
exc_value: Optional[str] = ...
|
||||||
tb: None = ...
|
tb: None = ...
|
||||||
@@ -41,12 +43,25 @@ class ExceptionReporter:
|
|||||||
template_does_not_exist: bool = ...
|
template_does_not_exist: bool = ...
|
||||||
postmortem: None = ...
|
postmortem: None = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, request: Optional[WSGIRequest], exc_type: None, exc_value: Optional[str], tb: None, is_email: bool = ...
|
self,
|
||||||
|
request: Optional[WSGIRequest],
|
||||||
|
exc_type: Optional[Type[BaseException]],
|
||||||
|
exc_value: Optional[Union[str, BaseException]],
|
||||||
|
tb: Optional[TracebackType],
|
||||||
|
is_email: bool = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def get_traceback_data(self) -> Dict[str, Any]: ...
|
def get_traceback_data(self) -> Dict[str, Any]: ...
|
||||||
def get_traceback_html(self) -> SafeText: ...
|
def get_traceback_html(self) -> SafeText: ...
|
||||||
def get_traceback_text(self) -> SafeText: ...
|
def get_traceback_text(self) -> SafeText: ...
|
||||||
def get_traceback_frames(self) -> List[Any]: ...
|
def get_traceback_frames(self) -> List[Any]: ...
|
||||||
|
def _get_lines_from_file(
|
||||||
|
self,
|
||||||
|
filename: str,
|
||||||
|
lineno: int,
|
||||||
|
context_lines: int,
|
||||||
|
loader: Optional[SourceLoader] = ...,
|
||||||
|
module_name: Optional[str] = None,
|
||||||
|
): ...
|
||||||
|
|
||||||
def technical_404_response(request: WSGIRequest, exception: Http404) -> HttpResponse: ...
|
def technical_404_response(request: WSGIRequest, exception: Http404) -> HttpResponse: ...
|
||||||
def default_urlconf(request: WSGIRequest) -> HttpResponse: ...
|
def default_urlconf(request: WSGIRequest) -> HttpResponse: ...
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
|
|||||||
template_translatable: Any
|
template_translatable: Any
|
||||||
|
|
||||||
def directory_index(path: Any, fullpath: Any): ...
|
def directory_index(path: Any, fullpath: Any): ...
|
||||||
def was_modified_since(header: None = ..., mtime: float = ..., size: int = ...) -> bool: ...
|
def was_modified_since(header: Optional[str] = ..., mtime: float = ..., size: int = ...) -> bool: ...
|
||||||
|
|||||||
@@ -125,6 +125,10 @@ IGNORED_ERRORS = {
|
|||||||
],
|
],
|
||||||
'select_related_onetoone': [
|
'select_related_onetoone': [
|
||||||
'"None" has no attribute'
|
'"None" has no attribute'
|
||||||
|
],
|
||||||
|
'view_tests': [
|
||||||
|
'"Handler" has no attribute "include_html"',
|
||||||
|
'"EmailMessage" has no attribute "alternatives"'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
# Test folders to typecheck
|
# Test folders to typecheck
|
||||||
@@ -330,7 +334,7 @@ TESTS_DIRS = [
|
|||||||
# TODO: 'validation',
|
# TODO: 'validation',
|
||||||
'validators',
|
'validators',
|
||||||
'version',
|
'version',
|
||||||
# TODO: 'view_tests',
|
'view_tests',
|
||||||
# TODO: 'wsgi',
|
# TODO: 'wsgi',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user