mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-14 07:47:09 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -2,8 +2,7 @@ from collections import OrderedDict
|
||||
from contextlib import _GeneratorContextManager
|
||||
from decimal import Decimal
|
||||
from io import StringIO
|
||||
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
|
||||
Type, Union)
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.conf import LazySettings
|
||||
@@ -16,13 +15,10 @@ from django.test.runner import DiscoverRunner
|
||||
from django.test.testcases import SimpleTestCase
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
|
||||
class Approximate:
|
||||
val: Union[decimal.Decimal, float] = ...
|
||||
places: int = ...
|
||||
def __init__(
|
||||
self, val: Union[Decimal, float], places: int = ...
|
||||
) -> None: ...
|
||||
def __init__(self, val: Union[Decimal, float], places: int = ...) -> None: ...
|
||||
def __eq__(self, other: Union[Decimal, float]) -> bool: ...
|
||||
|
||||
class ContextList(list):
|
||||
@@ -35,31 +31,20 @@ class _TestState: ...
|
||||
|
||||
def setup_test_environment(debug: Optional[bool] = ...) -> None: ...
|
||||
def teardown_test_environment() -> None: ...
|
||||
def get_runner(
|
||||
settings: LazySettings, test_runner_class: Optional[str] = ...
|
||||
) -> Type[DiscoverRunner]: ...
|
||||
def get_runner(settings: LazySettings, test_runner_class: Optional[str] = ...) -> Type[DiscoverRunner]: ...
|
||||
|
||||
class TestContextDecorator:
|
||||
attr_name: Any = ...
|
||||
kwarg_name: Any = ...
|
||||
def __init__(
|
||||
self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> 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 __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[
|
||||
Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
],
|
||||
self, decorated: Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]
|
||||
) -> Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]: ...
|
||||
|
||||
class override_settings(TestContextDecorator):
|
||||
@@ -70,9 +55,7 @@ class override_settings(TestContextDecorator):
|
||||
wrapped: Union[django.conf.Settings, django.conf.UserSettingsHolder] = ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def save_options(
|
||||
self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> None: ...
|
||||
def save_options(self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]) -> None: ...
|
||||
def decorate_class(
|
||||
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
|
||||
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
|
||||
@@ -93,11 +76,7 @@ class override_system_checks(TestContextDecorator):
|
||||
registry: django.core.checks.registry.CheckRegistry = ...
|
||||
new_checks: List[Callable] = ...
|
||||
deployment_checks: Optional[List[Callable]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
new_checks: List[Callable],
|
||||
deployment_checks: Optional[List[Callable]] = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ...
|
||||
old_checks: Set[Callable] = ...
|
||||
old_deployment_checks: Set[Callable] = ...
|
||||
def enable(self) -> None: ...
|
||||
@@ -105,9 +84,7 @@ class override_system_checks(TestContextDecorator):
|
||||
|
||||
class CaptureQueriesContext:
|
||||
connection: django.db.DefaultConnectionProxy = ...
|
||||
def __init__(
|
||||
self, connection: Union[DefaultConnectionProxy, DatabaseWrapper]
|
||||
) -> None: ...
|
||||
def __init__(self, connection: Union[DefaultConnectionProxy, DatabaseWrapper]) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __getitem__(self, index: int) -> Dict[str, str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -117,16 +94,12 @@ class CaptureQueriesContext:
|
||||
initial_queries: int = ...
|
||||
final_queries: Optional[int] = ...
|
||||
def __enter__(self) -> CaptureQueriesContext: ...
|
||||
def __exit__(
|
||||
self, exc_type: None, exc_value: None, traceback: None
|
||||
) -> None: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
|
||||
class ignore_warnings(TestContextDecorator):
|
||||
attr_name: None
|
||||
kwarg_name: None
|
||||
ignore_kwargs: Dict[
|
||||
str, Union[Type[django.utils.deprecation.RemovedInDjango30Warning], str]
|
||||
] = ...
|
||||
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 = ...
|
||||
|
||||
Reference in New Issue
Block a user