mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-10-27 08:03:23 +08:00
better stubs
This commit is contained in:
1 parent
4013fe4d03
commit
fa718b8e55
380 files changed
+11805
-8503
No files matched your search
+127
-100
@@ -1,124 +1,151 @@
|
||||
from io import StringIO
|
||||
from collections import OrderedDict
|
||||
from contextlib import _GeneratorContextManager
|
||||
from decimal import Decimal
|
||||
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
|
||||
Union)
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.conf import LazySettings
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.dummy.base import DatabaseWrapper
|
||||
from django.contrib.admin.tests import AdminSeleniumTestCase
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.template.base import Template
|
||||
from django.template.context import Context
|
||||
from django.test.runner import DiscoverRunner
|
||||
from django.test.testcases import SimpleTestCase
|
||||
from django.test.testcases import (SimpleTestCase, TestCase,
|
||||
_AssertNumQueriesContext)
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
def captured_output(stream_name: str) -> Iterator[StringIO]: ...
|
||||
def captured_stderr() -> _GeneratorContextManager: ...
|
||||
def captured_stdout() -> _GeneratorContextManager: ...
|
||||
def compare_xml(want: str, got: str) -> bool: ...
|
||||
def dependency_ordered(
|
||||
test_databases: List[Tuple[str, Tuple[str, List[str]]]],
|
||||
dependencies: Dict[str, List[str]],
|
||||
) -> List[Tuple[str, Tuple[str, List[str]]]]: ...
|
||||
def extend_sys_path(*paths) -> Iterator[None]: ...
|
||||
def freeze_time(t: int) -> Iterator[None]: ...
|
||||
def get_runner(
|
||||
settings: LazySettings, test_runner_class: Optional[str] = ...
|
||||
) -> Type[DiscoverRunner]: ...
|
||||
def get_unique_databases_and_mirrors() -> Tuple[OrderedDict, Dict[Any, Any]]: ...
|
||||
def instrumented_test_render(self: Template, context: Context) -> SafeText: ...
|
||||
def require_jinja2(test_func: Callable) -> Callable: ...
|
||||
def setup_databases(
|
||||
verbosity: int,
|
||||
interactive: bool,
|
||||
keepdb: bool = ...,
|
||||
debug_sql: bool = ...,
|
||||
parallel: int = ...,
|
||||
**kwargs,
|
||||
) -> Union[
|
||||
List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]
|
||||
]: ...
|
||||
def setup_test_environment(debug: bool = ...) -> None: ...
|
||||
def tag(*tags) -> Callable: ...
|
||||
def teardown_databases(
|
||||
old_config: List[Tuple[DatabaseWrapper, str, bool]],
|
||||
verbosity: int,
|
||||
parallel: int = ...,
|
||||
keepdb: bool = ...,
|
||||
) -> None: ...
|
||||
def teardown_test_environment() -> None: ...
|
||||
|
||||
class Approximate:
|
||||
def __eq__(self, other: Union[float, Decimal]) -> bool: ...
|
||||
def __init__(self, val: Union[float, Decimal], places: int = ...) -> None: ...
|
||||
val: Union[float, decimal.Decimal] = ...
|
||||
places: int = ...
|
||||
def __init__(self, val: Any, places: int = ...) -> None: ...
|
||||
def __eq__(self, other: Any): ...
|
||||
|
||||
class ContextList(list):
|
||||
def __getitem__(self, key: Union[str, int]) -> Any: ...
|
||||
def get(self, key: Any, default: Optional[Any] = ...): ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def keys(self): ...
|
||||
|
||||
class _TestState: ...
|
||||
|
||||
def setup_test_environment(debug: bool = ...) -> None: ...
|
||||
def teardown_test_environment() -> None: ...
|
||||
def get_runner(
|
||||
settings: LazySettings, test_runner_class: None = ...
|
||||
) -> Type[DiscoverRunner]: ...
|
||||
|
||||
class TestContextDecorator:
|
||||
attr_name: Any = ...
|
||||
kwarg_name: Any = ...
|
||||
def __init__(
|
||||
self, attr_name: Optional[str] = ..., kwarg_name: None = ...
|
||||
) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def __enter__(self) -> Optional[Apps]: ...
|
||||
def __exit__(
|
||||
self, exc_type: None, exc_value: None, traceback: None
|
||||
) -> None: ...
|
||||
def decorate_class(
|
||||
self, cls: Type[SimpleTestCase]
|
||||
) -> Type[SimpleTestCase]: ...
|
||||
def decorate_callable(self, func: Callable) -> Callable: ...
|
||||
def __call__(
|
||||
self, decorated: Union[Type[SimpleTestCase], Callable]
|
||||
) -> Union[Type[SimpleTestCase], Callable]: ...
|
||||
|
||||
class override_settings(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
options: Dict[str, Any] = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder] = ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def save_options(self, test_func: Type[SimpleTestCase]) -> None: ...
|
||||
def decorate_class(
|
||||
self, cls: Type[SimpleTestCase]
|
||||
) -> Type[SimpleTestCase]: ...
|
||||
|
||||
class modify_settings(override_settings):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder]
|
||||
operations: List[Tuple[str, Dict[str, Union[List[str], str]]]] = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def save_options(
|
||||
self, test_func: Type[Union[TestCase, AdminSeleniumTestCase]]
|
||||
) -> None: ...
|
||||
options: Dict[str, List[Union[str, Tuple[str, str]]]] = ...
|
||||
def enable(self) -> None: ...
|
||||
|
||||
class override_system_checks(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
registry: django.core.checks.registry.CheckRegistry = ...
|
||||
new_checks: List[Callable] = ...
|
||||
deployment_checks: Optional[List[Callable]] = ...
|
||||
def __init__(
|
||||
self, new_checks: Any, deployment_checks: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
old_checks: Set[Callable] = ...
|
||||
old_deployment_checks: Set[Callable] = ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
|
||||
class CaptureQueriesContext:
|
||||
def __enter__(self) -> CaptureQueriesContext: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __getitem__(self, index: int) -> Dict[str, str]: ...
|
||||
def __init__(
|
||||
self,
|
||||
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper],
|
||||
) -> None: ...
|
||||
connection: django.db.DefaultConnectionProxy = ...
|
||||
def __init__(self, connection: DatabaseWrapper) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __getitem__(self, index: Any): ...
|
||||
def __len__(self) -> int: ...
|
||||
@property
|
||||
def captured_queries(self) -> List[Dict[str, str]]: ...
|
||||
force_debug_cursor: bool = ...
|
||||
initial_queries: int = ...
|
||||
final_queries: Optional[int] = ...
|
||||
def __enter__(self) -> _AssertNumQueriesContext: ...
|
||||
def __exit__(
|
||||
self, exc_type: None, exc_value: None, traceback: None
|
||||
) -> None: ...
|
||||
|
||||
class ContextList:
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: Union[str, int]) -> Any: ...
|
||||
def get(self, key: str, default: None = ...) -> str: ...
|
||||
class ignore_warnings(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
ignore_kwargs: Dict[
|
||||
str, Union[Type[django.utils.deprecation.RemovedInDjango30Warning], str]
|
||||
] = ...
|
||||
filter_func: Callable = ...
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
catch_warnings: warnings.catch_warnings = ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
|
||||
requires_tz_support: Any
|
||||
|
||||
def isolate_lru_cache(lru_cache_object: Any) -> None: ...
|
||||
|
||||
class override_script_prefix(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
prefix: str = ...
|
||||
def __init__(self, prefix: str) -> None: ...
|
||||
old_prefix: str = ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
|
||||
class LoggingCaptureMixin:
|
||||
logger: Any = ...
|
||||
old_stream: Any = ...
|
||||
logger_output: Any = ...
|
||||
def setUp(self) -> None: ...
|
||||
def tearDown(self) -> None: ...
|
||||
|
||||
class TestContextDecorator:
|
||||
def __call__(self, decorated: Any) -> Any: ...
|
||||
def __enter__(self) -> Optional[Apps]: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __init__(
|
||||
self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def decorate_callable(self, func: Callable) -> Callable: ...
|
||||
def decorate_class(self, cls: Type[SimpleTestCase]) -> Type[SimpleTestCase]: ...
|
||||
|
||||
class ignore_warnings:
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
|
||||
class isolate_apps:
|
||||
def __init__(self, *installed_apps, **kwargs) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
class isolate_apps(TestContextDecorator):
|
||||
attr_name: Optional[str]
|
||||
kwarg_name: Optional[str]
|
||||
installed_apps: Tuple[str] = ...
|
||||
def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ...
|
||||
old_apps: django.apps.registry.Apps = ...
|
||||
def enable(self) -> Apps: ...
|
||||
|
||||
class modify_settings:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def save_options(self, test_func: Type[SimpleTestCase]) -> None: ...
|
||||
|
||||
class override_script_prefix:
|
||||
def __init__(self, prefix: str) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
|
||||
class override_settings:
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def decorate_class(
|
||||
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def save_options(
|
||||
self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> None: ...
|
||||
|
||||
class override_system_checks:
|
||||
def __init__(
|
||||
self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...
|
||||
) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
Reference in new issue
Block a user