diff --git a/django-stubs/core/handlers/base.pyi b/django-stubs/core/handlers/base.pyi index 2be4169..93461d1 100644 --- a/django-stubs/core/handlers/base.pyi +++ b/django-stubs/core/handlers/base.pyi @@ -6,10 +6,6 @@ from django.http.response import HttpResponse, HttpResponseBase logger: Any class BaseHandler: - _view_middleware: None = ... - _template_response_middleware: None = ... - _exception_middleware: None = ... - _middleware_chain: None = ... def load_middleware(self) -> None: ... def make_view_atomic(self, view: Callable) -> Callable: ... def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ... diff --git a/django-stubs/core/management/utils.pyi b/django-stubs/core/management/utils.pyi index 27e13d3..23b5696 100644 --- a/django-stubs/core/management/utils.pyi +++ b/django-stubs/core/management/utils.pyi @@ -5,6 +5,6 @@ from django.db.models.base import Model def popen_wrapper(args: List[str], stdout_encoding: str = ...) -> Tuple[str, str, int]: ... def handle_extensions(extensions: List[str]) -> Set[str]: ... -def find_command(cmd: str, path: None = ..., pathext: None = ...) -> Optional[str]: ... +def find_command(cmd: str, path: Optional[str] = ..., pathext: Optional[str] = ...) -> Optional[str]: ... def get_random_secret_key(): ... def parse_apps_and_model_labels(labels: List[str]) -> Tuple[Set[Type[Model]], Set[AppConfig]]: ... diff --git a/django-stubs/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi index a6eba96..ffbcdfa 100644 --- a/django-stubs/db/backends/utils.pyi +++ b/django-stubs/db/backends/utils.pyi @@ -1,6 +1,7 @@ +import types from datetime import date, datetime, time from decimal import Decimal -from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union +from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union, Type from uuid import UUID logger: Any @@ -16,7 +17,12 @@ class CursorWrapper: def __getattr__(self, attr: str) -> Any: ... def __iter__(self) -> None: ... def __enter__(self) -> CursorWrapper: ... - def __exit__(self, type: None, value: None, traceback: None) -> None: ... + def __exit__( + self, + exc_type: Optional[Type[BaseException]], + exc_value: Optional[BaseException], + tb: Optional[types.TracebackType], + ) -> None: ... def callproc(self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ...) -> Any: ... def execute( self, sql: str, params: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 74ab259..aab35fb 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -80,9 +80,9 @@ class ForeignObject(RelatedField[_ST, _GT]): on_delete: Callable[..., None], from_fields: Sequence[str], to_fields: Sequence[str], - rel: None = ..., + rel: Optional[ForeignObjectRel] = ..., related_name: Optional[str] = ..., - related_query_name: None = ..., + related_query_name: Optional[str] = ..., limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., parent_link: bool = ..., db_constraint: bool = ..., diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index 47458d8..84a0607 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -71,7 +71,7 @@ class Options(Generic[_M]): abstract: bool = ... managed: bool = ... proxy: bool = ... - proxy_for_model: None = ... + proxy_for_model: Optional[Type[Model]] = ... concrete_model: Optional[Type[Model]] = ... swappable: None = ... parents: collections.OrderedDict = ... diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index 31caebf..e086582 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -92,7 +92,7 @@ class QuerySet(Generic[_T], Collection[_T], Sized): ) -> ValuesQuerySet[_T, Any]: ... def dates(self, field_name: str, kind: str, order: str = ...) -> ValuesQuerySet[_T, datetime.date]: ... def datetimes( - self, field_name: str, kind: str, order: str = ..., tzinfo: None = ... + self, field_name: str, kind: str, order: str = ..., tzinfo: Optional[datetime.tzinfo] = ... ) -> ValuesQuerySet[_T, datetime.datetime]: ... def none(self) -> QuerySet[_T]: ... def all(self) -> QuerySet[_T]: ... diff --git a/django-stubs/test/testcases.pyi b/django-stubs/test/testcases.pyi index 9c17811..8769a95 100644 --- a/django-stubs/test/testcases.pyi +++ b/django-stubs/test/testcases.pyi @@ -119,15 +119,17 @@ class SimpleTestCase(unittest.TestCase): field_kwargs: None = ..., empty_value: str = ..., ) -> Any: ... - def assertHTMLEqual(self, html1: str, html2: str, msg: None = ...) -> None: ... - def assertHTMLNotEqual(self, html1: str, html2: str, msg: None = ...) -> None: ... + def assertHTMLEqual(self, html1: str, html2: str, msg: Optional[str] = ...) -> None: ... + def assertHTMLNotEqual(self, html1: str, html2: str, msg: Optional[str] = ...) -> None: ... def assertInHTML( self, needle: str, haystack: SafeText, count: Optional[int] = ..., msg_prefix: str = ... ) -> None: ... - def assertJSONEqual(self, raw: str, expected_data: Union[Dict[str, str], bool, str], msg: None = ...) -> None: ... - def assertJSONNotEqual(self, raw: str, expected_data: str, msg: None = ...) -> None: ... - def assertXMLEqual(self, xml1: str, xml2: str, msg: None = ...) -> None: ... - def assertXMLNotEqual(self, xml1: str, xml2: str, msg: None = ...) -> None: ... + def assertJSONEqual( + self, raw: str, expected_data: Union[Dict[str, str], bool, str], msg: Optional[str] = ... + ) -> None: ... + def assertJSONNotEqual(self, raw: str, expected_data: str, msg: Optional[str] = ...) -> None: ... + def assertXMLEqual(self, xml1: str, xml2: str, msg: Optional[str] = ...) -> None: ... + def assertXMLNotEqual(self, xml1: str, xml2: str, msg: Optional[str] = ...) -> None: ... class TransactionTestCase(SimpleTestCase): reset_sequences: bool = ... @@ -141,7 +143,7 @@ class TransactionTestCase(SimpleTestCase): values: Union[List[None], List[Tuple[str, str]], List[date], List[int], List[str], Set[str], QuerySet], transform: Union[Callable, Type[str]] = ..., ordered: bool = ..., - msg: None = ..., + msg: Optional[str] = ..., ) -> None: ... def assertNumQueries( self, num: int, func: Optional[Union[Callable, Type[list]]] = ..., *args: Any, using: Any = ..., **kwargs: Any diff --git a/django-stubs/utils/timesince.pyi b/django-stubs/utils/timesince.pyi index 8db447a..04e5b6a 100644 --- a/django-stubs/utils/timesince.pyi +++ b/django-stubs/utils/timesince.pyi @@ -1,8 +1,10 @@ from datetime import date -from typing import Any, Optional +from typing import Any, Optional, Dict -TIME_STRINGS: Any +TIME_STRINGS: Dict[str, str] TIMESINCE_CHUNKS: Any -def timesince(d: date, now: Optional[date] = ..., reversed: bool = ..., time_strings: None = ...) -> str: ... -def timeuntil(d: date, now: Optional[date] = ..., time_strings: None = ...) -> str: ... +def timesince( + d: date, now: Optional[date] = ..., reversed: bool = ..., time_strings: Optional[Dict[str, str]] = ... +) -> str: ... +def timeuntil(d: date, now: Optional[date] = ..., time_strings: Optional[Dict[str, str]] = ...) -> str: ...