diff --git a/django-stubs/contrib/contenttypes/fields.pyi b/django-stubs/contrib/contenttypes/fields.pyi index 3239d176e..b5aab8bfe 100644 --- a/django-stubs/contrib/contenttypes/fields.pyi +++ b/django-stubs/contrib/contenttypes/fields.pyi @@ -84,7 +84,6 @@ class GenericRelation(ForeignObject[Any]): content_type_field_name: Any = ... for_concrete_model: Any = ... to_fields: Any = ... - def __new__(cls, *args: Any, **kwargs: Any) -> GenericRelation: ... def __init__( self, to: Union[Type[Model], str], diff --git a/django-stubs/core/servers/basehttp.pyi b/django-stubs/core/servers/basehttp.pyi index 667e1c202..d4a6109f1 100644 --- a/django-stubs/core/servers/basehttp.pyi +++ b/django-stubs/core/servers/basehttp.pyi @@ -26,7 +26,7 @@ class ServerHandler(simple_server.ServerHandler): class WSGIRequestHandler(simple_server.WSGIRequestHandler): close_connection: bool - connection: WSGIRequest # type: ignore [assignment] + connection: WSGIRequest request: WSGIRequest rfile: BytesIO wfile: BytesIO diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index ca20296e7..13bdac1b0 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -127,8 +127,8 @@ _I = TypeVar("_I", bound=Optional[int]) class IntegerField(Generic[_I], Field[Union[_I, Combinable], _I]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: IntegerField[int], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -137,7 +137,7 @@ class IntegerField(Generic[_I], Field[Union[_I, Combinable], _I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_I, Callable[[], _I]]] = ..., + default: Optional[Union[int, Callable[[], int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -145,17 +145,17 @@ class IntegerField(Generic[_I], Field[Union[_I, Combinable], _I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[Tuple[int, str], Tuple[str, Iterable[Tuple[int, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> IntegerField[int]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: IntegerField[Optional[int]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -164,7 +164,7 @@ class IntegerField(Generic[_I], Field[Union[_I, Combinable], _I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_I, Callable[[], _I]] = ..., + default: Union[Optional[int], Callable[[], Optional[int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -172,22 +172,25 @@ class IntegerField(Generic[_I], Field[Union[_I, Combinable], _I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[ + Tuple[Optional[int], str], + Tuple[str, Iterable[Tuple[Optional[int], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> IntegerField[Optional[int]]: ... + ) -> None: ... class PositiveIntegerRelDbTypeMixin: def rel_db_type(self, connection: Any) -> Any: ... class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: PositiveIntegerField[int], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -196,7 +199,7 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_I, Callable[[], _I]]] = ..., + default: Optional[Union[int, Callable[[], int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -204,17 +207,17 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[Tuple[int, str], Tuple[str, Iterable[Tuple[int, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> PositiveIntegerField[int]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: PositiveIntegerField[Optional[int]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -223,7 +226,7 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_I, Callable[[], _I]] = ..., + default: Union[Optional[int], Callable[[], Optional[int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -231,19 +234,22 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[ + Tuple[Optional[int], str], + Tuple[str, Iterable[Tuple[Optional[int], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> PositiveIntegerField[Optional[int]]: ... + ) -> None: ... class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: PositiveSmallIntegerField[int], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -252,7 +258,7 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_I, Callable[[], _I]]] = ..., + default: Optional[Union[int, Callable[[], int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -260,17 +266,17 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[Tuple[int, str], Tuple[str, Iterable[Tuple[int, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> PositiveSmallIntegerField[int]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: PositiveSmallIntegerField[Optional[int]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -279,7 +285,7 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_I, Callable[[], _I]] = ..., + default: Union[Optional[int], Callable[[], Optional[int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -287,19 +293,22 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[ + Tuple[Optional[int], str], + Tuple[str, Iterable[Tuple[Optional[int], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> PositiveSmallIntegerField[Optional[int]]: ... + ) -> None: ... class SmallIntegerField(IntegerField[_I]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: SmallIntegerField[int], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -308,7 +317,7 @@ class SmallIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_I, Callable[[], _I]]] = ..., + default: Optional[Union[int, Callable[[], int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -316,17 +325,17 @@ class SmallIntegerField(IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[Tuple[int, str], Tuple[str, Iterable[Tuple[int, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> SmallIntegerField[int]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: SmallIntegerField[Optional[int]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -335,7 +344,7 @@ class SmallIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_I, Callable[[], _I]] = ..., + default: Union[Optional[int], Callable[[], Optional[int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -343,19 +352,22 @@ class SmallIntegerField(IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[ + Tuple[Optional[int], str], + Tuple[str, Iterable[Tuple[Optional[int], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> SmallIntegerField[Optional[int]]: ... + ) -> None: ... class BigIntegerField(IntegerField[_I]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: BigIntegerField[int], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -364,7 +376,7 @@ class BigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_I, Callable[[], _I]]] = ..., + default: Optional[Union[int, Callable[[], int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -372,17 +384,17 @@ class BigIntegerField(IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[Tuple[int, str], Tuple[str, Iterable[Tuple[int, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BigIntegerField[int]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: BigIntegerField[Optional[int]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -391,7 +403,7 @@ class BigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_I, Callable[[], _I]] = ..., + default: Union[Optional[int], Callable[[], Optional[int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -399,19 +411,22 @@ class BigIntegerField(IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[ + Tuple[Optional[int], str], + Tuple[str, Iterable[Tuple[Optional[int], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BigIntegerField[Optional[int]]: ... + ) -> None: ... class PositiveBigIntegerField(IntegerField[_I]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: PositiveBigIntegerField[int], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -420,7 +435,7 @@ class PositiveBigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_I, Callable[[], _I]]] = ..., + default: Optional[Union[int, Callable[[], int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -428,17 +443,17 @@ class PositiveBigIntegerField(IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[Tuple[int, str], Tuple[str, Iterable[Tuple[int, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> PositiveBigIntegerField[int]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: PositiveBigIntegerField[Optional[int]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -447,7 +462,7 @@ class PositiveBigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_I, Callable[[], _I]] = ..., + default: Union[Optional[int], Callable[[], Optional[int]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -455,21 +470,24 @@ class PositiveBigIntegerField(IntegerField[_I]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]] + Union[ + Tuple[Optional[int], str], + Tuple[str, Iterable[Tuple[Optional[int], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> PositiveBigIntegerField[Optional[int]]: ... + ) -> None: ... _F = TypeVar("_F", bound=Optional[float]) class FloatField(Generic[_F], Field[Union[_F, Combinable], _F]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: FloatField[float], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -478,7 +496,7 @@ class FloatField(Generic[_F], Field[Union[_F, Combinable], _F]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_F, Callable[[], _F]]] = ..., + default: Optional[Union[float, Callable[[], float]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -486,17 +504,17 @@ class FloatField(Generic[_F], Field[Union[_F, Combinable], _F]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_F, str], Tuple[str, Iterable[Tuple[_F, str]]]] + Union[Tuple[float, str], Tuple[str, Iterable[Tuple[float, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> FloatField[float]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: FloatField[Optional[float]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -505,7 +523,7 @@ class FloatField(Generic[_F], Field[Union[_F, Combinable], _F]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_F, Callable[[], _F]] = ..., + default: Union[Optional[float], Callable[[], Optional[float]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -513,14 +531,17 @@ class FloatField(Generic[_F], Field[Union[_F, Combinable], _F]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_F, str], Tuple[str, Iterable[Tuple[_F, str]]]] + Union[ + Tuple[Optional[float], str], + Tuple[str, Iterable[Tuple[Optional[float], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> FloatField[Optional[float]]: ... + ) -> None: ... _DEC = TypeVar("_DEC", bound=Optional[decimal.Decimal]) @@ -529,8 +550,8 @@ class DecimalField(Generic[_DEC], Field[Union[_DEC, Combinable], _DEC]): max_digits: int = ... decimal_places: int = ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: DecimalField[decimal.Decimal], verbose_name: Optional[str] = ..., name: Optional[str] = ..., max_digits: int = ..., @@ -541,7 +562,7 @@ class DecimalField(Generic[_DEC], Field[Union[_DEC, Combinable], _DEC]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_DEC, Callable[[], _DEC]]] = ..., + default: Optional[Union[decimal.Decimal, Callable[[], decimal.Decimal]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -549,17 +570,20 @@ class DecimalField(Generic[_DEC], Field[Union[_DEC, Combinable], _DEC]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_DEC, str], Tuple[str, Iterable[Tuple[_DEC, str]]]] + Union[ + Tuple[decimal.Decimal, str], + Tuple[str, Iterable[Tuple[decimal.Decimal, str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DecimalField[decimal.Decimal]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: DecimalField[Optional[decimal.Decimal]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., max_digits: int = ..., @@ -570,7 +594,9 @@ class DecimalField(Generic[_DEC], Field[Union[_DEC, Combinable], _DEC]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_DEC, Callable[[], _DEC]] = ..., + default: Union[ + Optional[decimal.Decimal], Callable[[], Optional[decimal.Decimal]] + ] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -578,21 +604,24 @@ class DecimalField(Generic[_DEC], Field[Union[_DEC, Combinable], _DEC]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_DEC, str], Tuple[str, Iterable[Tuple[_DEC, str]]]] + Union[ + Tuple[Optional[decimal.Decimal], str], + Tuple[str, Iterable[Tuple[Optional[decimal.Decimal], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DecimalField[Optional[decimal.Decimal]]: ... + ) -> None: ... class AutoFieldMeta(type): ... class AutoFieldMixin: ... class AutoField(AutoFieldMixin, IntegerField[int], metaclass=AutoFieldMeta): - def __new__( - cls, + def __init__( + self: AutoField, verbose_name: Optional[str] = ..., name: Optional[str] = ..., max_digits: int = ..., @@ -618,11 +647,11 @@ class AutoField(AutoFieldMixin, IntegerField[int], metaclass=AutoFieldMeta): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> AutoField: ... + ) -> None: ... class BigAutoField(AutoFieldMixin, BigIntegerField[int]): - def __new__( - cls, + def __init__( + self: BigAutoField, verbose_name: Optional[str] = ..., name: Optional[str] = ..., max_digits: int = ..., @@ -648,11 +677,11 @@ class BigAutoField(AutoFieldMixin, BigIntegerField[int]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BigAutoField: ... + ) -> None: ... class SmallAutoField(AutoFieldMixin, SmallIntegerField[int]): - def __new__( - cls, + def __init__( + self: SmallAutoField, verbose_name: Optional[str] = ..., name: Optional[str] = ..., max_digits: int = ..., @@ -678,14 +707,14 @@ class SmallAutoField(AutoFieldMixin, SmallIntegerField[int]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> SmallAutoField: ... + ) -> None: ... _C = TypeVar("_C", bound=Optional[str]) class CharField(Generic[_C], Field[Union[_C, Combinable], _C]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: CharField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -695,7 +724,7 @@ class CharField(Generic[_C], Field[Union[_C, Combinable], _C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -703,17 +732,17 @@ class CharField(Generic[_C], Field[Union[_C, Combinable], _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> CharField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: CharField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -723,7 +752,7 @@ class CharField(Generic[_C], Field[Union[_C, Combinable], _C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -731,19 +760,22 @@ class CharField(Generic[_C], Field[Union[_C, Combinable], _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> CharField[Optional[str]]: ... + ) -> None: ... class SlugField(CharField[_C]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: SlugField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -753,7 +785,7 @@ class SlugField(CharField[_C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -761,17 +793,17 @@ class SlugField(CharField[_C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> SlugField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: SlugField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -781,7 +813,7 @@ class SlugField(CharField[_C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -789,19 +821,22 @@ class SlugField(CharField[_C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> SlugField[Optional[str]]: ... + ) -> None: ... class EmailField(CharField[_C]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: EmailField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -811,7 +846,7 @@ class EmailField(CharField[_C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -819,17 +854,17 @@ class EmailField(CharField[_C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> EmailField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: EmailField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -839,7 +874,7 @@ class EmailField(CharField[_C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -847,19 +882,22 @@ class EmailField(CharField[_C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> EmailField[Optional[str]]: ... + ) -> None: ... class URLField(CharField[_C]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: URLField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -869,7 +907,7 @@ class URLField(CharField[_C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -877,17 +915,17 @@ class URLField(CharField[_C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> URLField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: URLField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -897,7 +935,7 @@ class URLField(CharField[_C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -905,19 +943,22 @@ class URLField(CharField[_C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> URLField[Optional[str]]: ... + ) -> None: ... class TextField(Generic[_C], Field[Union[_C, Combinable], _C]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: TextField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -927,7 +968,7 @@ class TextField(Generic[_C], Field[Union[_C, Combinable], _C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -935,17 +976,17 @@ class TextField(Generic[_C], Field[Union[_C, Combinable], _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> TextField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: TextField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -955,7 +996,7 @@ class TextField(Generic[_C], Field[Union[_C, Combinable], _C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -963,21 +1004,24 @@ class TextField(Generic[_C], Field[Union[_C, Combinable], _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> TextField[Optional[str]]: ... + ) -> None: ... _B = TypeVar("_B", bound=Optional[bool]) class BooleanField(Generic[_B], Field[Union[_B, Combinable], _B]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: BooleanField[bool], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -987,7 +1031,7 @@ class BooleanField(Generic[_B], Field[Union[_B, Combinable], _B]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_B, Callable[[], _B]]] = ..., + default: Optional[Union[bool, Callable[[], bool]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -995,17 +1039,17 @@ class BooleanField(Generic[_B], Field[Union[_B, Combinable], _B]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_B, str], Tuple[str, Iterable[Tuple[_B, str]]]] + Union[Tuple[bool, str], Tuple[str, Iterable[Tuple[bool, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BooleanField[bool]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: BooleanField[Optional[bool]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1015,7 +1059,7 @@ class BooleanField(Generic[_B], Field[Union[_B, Combinable], _B]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_B, Callable[[], _B]] = ..., + default: Union[Optional[bool], Callable[[], Optional[bool]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1023,19 +1067,22 @@ class BooleanField(Generic[_B], Field[Union[_B, Combinable], _B]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_B, str], Tuple[str, Iterable[Tuple[_B, str]]]] + Union[ + Tuple[Optional[bool], str], + Tuple[str, Iterable[Tuple[Optional[bool], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BooleanField[Optional[bool]]: ... + ) -> None: ... class IPAddressField(Generic[_C], Field[Union[_C, Combinable], _C]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: IPAddressField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1044,7 +1091,7 @@ class IPAddressField(Generic[_C], Field[Union[_C, Combinable], _C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1052,17 +1099,17 @@ class IPAddressField(Generic[_C], Field[Union[_C, Combinable], _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> IPAddressField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: IPAddressField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1071,7 +1118,7 @@ class IPAddressField(Generic[_C], Field[Union[_C, Combinable], _C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1079,22 +1126,25 @@ class IPAddressField(Generic[_C], Field[Union[_C, Combinable], _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> IPAddressField[Optional[str]]: ... + ) -> None: ... class GenericIPAddressField( Generic[_C], Field[Union[_C, ipaddress.IPv4Address, ipaddress.IPv6Address, Combinable], _C], ): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: GenericIPAddressField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., protocol: str = ..., @@ -1105,7 +1155,7 @@ class GenericIPAddressField( blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[str, Callable[[], str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1113,17 +1163,17 @@ class GenericIPAddressField( unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[Tuple[str, str], Tuple[str, Iterable[Tuple[str, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> GenericIPAddressField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: GenericIPAddressField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., protocol: str = ..., @@ -1134,7 +1184,7 @@ class GenericIPAddressField( blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1142,14 +1192,17 @@ class GenericIPAddressField( unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> GenericIPAddressField[Optional[str]]: ... + ) -> None: ... _DD = TypeVar("_DD", bound=Optional[date]) @@ -1160,8 +1213,8 @@ class DateField(DateTimeCheckMixin, Field[Union[_DD, Combinable], _DD]): auto_now: bool = ... auto_now_add: bool = ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: DateField[date], verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1172,7 +1225,7 @@ class DateField(DateTimeCheckMixin, Field[Union[_DD, Combinable], _DD]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_DD, Callable[[], _DD]]] = ..., + default: Optional[Union[date, Callable[[], date]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1180,17 +1233,17 @@ class DateField(DateTimeCheckMixin, Field[Union[_DD, Combinable], _DD]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_DD, str], Tuple[str, Iterable[Tuple[_DD, str]]]] + Union[Tuple[date, str], Tuple[str, Iterable[Tuple[date, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DateField[date]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: DateField[Optional[date]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1201,7 +1254,7 @@ class DateField(DateTimeCheckMixin, Field[Union[_DD, Combinable], _DD]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_DD, Callable[[], _DD]] = ..., + default: Union[Optional[date], Callable[[], Optional[date]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1209,14 +1262,17 @@ class DateField(DateTimeCheckMixin, Field[Union[_DD, Combinable], _DD]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_DD, str], Tuple[str, Iterable[Tuple[_DD, str]]]] + Union[ + Tuple[Optional[date], str], + Tuple[str, Iterable[Tuple[Optional[date], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DateField[Optional[date]]: ... + ) -> None: ... _TM = TypeVar("_TM", bound=Optional[time]) @@ -1225,8 +1281,8 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[Union[_TM, Combinable], auto_now: bool = ... auto_now_add: bool = ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: TimeField[time], verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1237,7 +1293,7 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[Union[_TM, Combinable], blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_TM, Callable[[], _TM]]] = ..., + default: Optional[Union[time, Callable[[], time]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1245,17 +1301,17 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[Union[_TM, Combinable], unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_TM, str], Tuple[str, Iterable[Tuple[_TM, str]]]] + Union[Tuple[time, str], Tuple[str, Iterable[Tuple[time, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> TimeField[time]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: TimeField[Optional[time]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1266,7 +1322,7 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[Union[_TM, Combinable], blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_TM, Callable[[], _TM]] = ..., + default: Union[Optional[time], Callable[[], Optional[time]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1274,14 +1330,17 @@ class TimeField(Generic[_TM], DateTimeCheckMixin, Field[Union[_TM, Combinable], unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_TM, str], Tuple[str, Iterable[Tuple[_TM, str]]]] + Union[ + Tuple[Optional[time], str], + Tuple[str, Iterable[Tuple[Optional[time], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> TimeField[Optional[time]]: ... + ) -> None: ... _DT = TypeVar("_DT", bound=Optional[datetime]) @@ -1290,8 +1349,8 @@ class DateTimeField(DateField[_DT]): auto_now: bool = ... auto_now_add: bool = ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: DateTimeField[datetime], verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1302,7 +1361,7 @@ class DateTimeField(DateField[_DT]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_DT, Callable[[], _DT]]] = ..., + default: Optional[Union[datetime, Callable[[], datetime]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1310,17 +1369,17 @@ class DateTimeField(DateField[_DT]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_DT, str], Tuple[str, Iterable[Tuple[_DT, str]]]] + Union[Tuple[datetime, str], Tuple[str, Iterable[Tuple[datetime, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DateTimeField[datetime]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: DateTimeField[Optional[datetime]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1331,7 +1390,7 @@ class DateTimeField(DateField[_DT]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_DT, Callable[[], _DT]] = ..., + default: Union[Optional[datetime], Callable[[], Optional[datetime]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1339,21 +1398,24 @@ class DateTimeField(DateField[_DT]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_DT, str], Tuple[str, Iterable[Tuple[_DT, str]]]] + Union[ + Tuple[Optional[datetime], str], + Tuple[str, Iterable[Tuple[Optional[datetime], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DateTimeField[Optional[datetime]]: ... + ) -> None: ... _U = TypeVar("_U", bound=Optional[uuid.UUID]) class UUIDField(Generic[_U], Field[Union[str, _U], _U]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: UUIDField[uuid.UUID], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1362,7 +1424,7 @@ class UUIDField(Generic[_U], Field[Union[str, _U], _U]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_U, Callable[[], _U]]] = ..., + default: Optional[Union[uuid.UUID, Callable[[], uuid.UUID]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1370,17 +1432,17 @@ class UUIDField(Generic[_U], Field[Union[str, _U], _U]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_U, str], Tuple[str, Iterable[Tuple[_U, str]]]] + Union[Tuple[uuid.UUID, str], Tuple[str, Iterable[Tuple[uuid.UUID, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> UUIDField[uuid.UUID]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: UUIDField[Optional[uuid.UUID]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1389,7 +1451,7 @@ class UUIDField(Generic[_U], Field[Union[str, _U], _U]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_U, Callable[[], _U]] = ..., + default: Union[Optional[uuid.UUID], Callable[[], Optional[uuid.UUID]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1397,14 +1459,17 @@ class UUIDField(Generic[_U], Field[Union[str, _U], _U]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_U, str], Tuple[str, Iterable[Tuple[_U, str]]]] + Union[ + Tuple[Optional[uuid.UUID], str], + Tuple[str, Iterable[Tuple[Optional[uuid.UUID], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> UUIDField[Optional[uuid.UUID]]: ... + ) -> None: ... class FilePathField(Generic[_C], Field[_C, _C]): path: Union[str, Callable[..., str]] = ... @@ -1413,8 +1478,8 @@ class FilePathField(Generic[_C], Field[_C, _C]): allow_files: bool = ... allow_folders: bool = ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: FilePathField[str], verbose_name: Optional[str] = ..., name: Optional[str] = ..., path: Union[str, Callable[..., str]] = ..., @@ -1428,7 +1493,7 @@ class FilePathField(Generic[_C], Field[_C, _C]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_C, Callable[[], _C]]] = ..., + default: Optional[Union[Optional[str], Callable[[], Optional[str]]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1436,17 +1501,20 @@ class FilePathField(Generic[_C], Field[_C, _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> FilePathField[str]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: FilePathField[Optional[str]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., path: Union[str, Callable[..., str]] = ..., @@ -1460,7 +1528,7 @@ class FilePathField(Generic[_C], Field[_C, _C]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_C, Callable[[], _C]] = ..., + default: Union[Optional[str], Callable[[], Optional[str]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1468,21 +1536,24 @@ class FilePathField(Generic[_C], Field[_C, _C]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + Union[ + Tuple[Optional[str], str], + Tuple[str, Iterable[Tuple[Optional[str], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> FilePathField[Optional[str]]: ... + ) -> None: ... _BIN = TypeVar("_BIN", bound=Optional[bytes]) class BinaryField(Generic[_BIN], Field[Union[_BIN, bytearray, memoryview], _BIN]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: BinaryField[bytes], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1491,7 +1562,7 @@ class BinaryField(Generic[_BIN], Field[Union[_BIN, bytearray, memoryview], _BIN] blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_BIN, Callable[[], _BIN]]] = ..., + default: Optional[Union[bytes, Callable[[], bytes]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1499,17 +1570,17 @@ class BinaryField(Generic[_BIN], Field[Union[_BIN, bytearray, memoryview], _BIN] unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_BIN, str], Tuple[str, Iterable[Tuple[_BIN, str]]]] + Union[Tuple[bytes, str], Tuple[str, Iterable[Tuple[bytes, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BinaryField[bytes]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: BinaryField[Optional[bytes]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1518,7 +1589,7 @@ class BinaryField(Generic[_BIN], Field[Union[_BIN, bytearray, memoryview], _BIN] blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_BIN, Callable[[], _BIN]] = ..., + default: Union[Optional[bytes], Callable[[], Optional[bytes]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1526,21 +1597,24 @@ class BinaryField(Generic[_BIN], Field[Union[_BIN, bytearray, memoryview], _BIN] unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_BIN, str], Tuple[str, Iterable[Tuple[_BIN, str]]]] + Union[ + Tuple[Optional[bytes], str], + Tuple[str, Iterable[Tuple[Optional[bytes], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> BinaryField[Optional[bytes]]: ... + ) -> None: ... _TD = TypeVar("_TD", bound=Optional[timedelta]) class DurationField(Generic[_TD], Field[_TD, _TD]): @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: DurationField[timedelta], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1549,7 +1623,7 @@ class DurationField(Generic[_TD], Field[_TD, _TD]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Optional[Union[_TD, Callable[[], _TD]]] = ..., + default: Optional[Union[timedelta, Callable[[], timedelta]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1557,17 +1631,17 @@ class DurationField(Generic[_TD], Field[_TD, _TD]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_TD, str], Tuple[str, Iterable[Tuple[_TD, str]]]] + Union[Tuple[timedelta, str], Tuple[str, Iterable[Tuple[timedelta, str]]]] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DurationField[timedelta]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: DurationField[Optional[timedelta]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -1576,7 +1650,7 @@ class DurationField(Generic[_TD], Field[_TD, _TD]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Union[_TD, Callable[[], _TD]] = ..., + default: Union[Optional[timedelta], Callable[[], Optional[timedelta]]] = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., @@ -1584,11 +1658,14 @@ class DurationField(Generic[_TD], Field[_TD, _TD]): unique_for_month: Optional[str] = ..., unique_for_year: Optional[str] = ..., choices: Iterable[ - Union[Tuple[_TD, str], Tuple[str, Iterable[Tuple[_TD, str]]]] + Union[ + Tuple[Optional[timedelta], str], + Tuple[str, Iterable[Tuple[Optional[timedelta], str]]], + ] ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> DurationField[Optional[timedelta]]: ... + ) -> None: ... diff --git a/django-stubs/db/models/fields/files.pyi b/django-stubs/db/models/fields/files.pyi index 3b9e8f368..e6a7a332d 100644 --- a/django-stubs/db/models/fields/files.pyi +++ b/django-stubs/db/models/fields/files.pyi @@ -53,8 +53,8 @@ _T = TypeVar("_T", bound="Field[Any, Any]") class FileField(Field[FileDescriptor, FileDescriptor]): storage: Any = ... upload_to: Union[str, Callable[[Any, str], str]] = ... - def __new__( - cls, + def __init__( + self, verbose_name: Optional[str] = ..., name: Optional[str] = ..., upload_to: Union[str, Callable[[Any, str], str]] = ..., @@ -80,7 +80,7 @@ class FileField(Field[FileDescriptor, FileDescriptor]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> FileField: ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> FileDescriptor: ... @@ -101,8 +101,8 @@ class ImageFieldFile(ImageFile, FieldFile): def delete(self, save: bool = ...) -> None: ... class ImageField(FileField): - def __new__( - cls, + def __init__( + self, verbose_name: Optional[str] = ..., name: Optional[str] = ..., width_field: str = ..., @@ -130,7 +130,7 @@ class ImageField(FileField): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ImageField: ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ImageFileDescriptor: ... diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index 96236c777..21ffc1b57 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -29,8 +29,8 @@ class JSONField(CheckFieldDefaultMixin, Field[Union[_A, Combinable], _A]): def get_transform(self, name: Any) -> Any: ... def value_to_string(self, obj: Any) -> Any: ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: JSONField[_A], verbose_name: Optional[str] = ..., name: Optional[str] = ..., encoder: Type[json.JSONEncoder] = ..., @@ -56,10 +56,10 @@ class JSONField(CheckFieldDefaultMixin, Field[Union[_A, Combinable], _A]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> JSONField[_A]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: JSONField[Optional[_A]], verbose_name: Optional[str] = ..., name: Optional[str] = ..., encoder: Type[json.JSONEncoder] = ..., @@ -85,7 +85,7 @@ class JSONField(CheckFieldDefaultMixin, Field[Union[_A, Combinable], _A]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> JSONField[Optional[_A]]: ... + ) -> None: ... class DataContains(PostgresOperatorLookup): lookup_name: str = ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 7441e7ab0..8384390d3 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -94,8 +94,8 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): many_to_one: Literal[True] = ... related_model: Type[_M] = ... @overload - def __new__( - cls, + def __init__( + self: ForeignObject[_M], to: Union[Type[_M], str], on_delete: _OnDeleteOptions, from_fields: Sequence[str], @@ -130,10 +130,10 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ForeignObject[_M]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: ForeignObject[Optional[_M]], to: Union[Type[_M], str], on_delete: _OnDeleteOptions, from_fields: Sequence[str], @@ -168,7 +168,7 @@ class ForeignObject(Generic[_M], RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ForeignObject[Optional[_M]]: ... + ) -> None: ... class ForeignKey(Generic[_M], ForeignObject[_M]): one_to_many: Literal[False] = ... @@ -177,8 +177,8 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): many_to_one: Literal[True] = ... related_model: Type[_M] = ... @overload - def __new__( - cls, + def __init__( + self: ForeignKey[_M], to: Union[Type[_M], str], on_delete: _OnDeleteOptions, to_field: Optional[str] = ..., @@ -211,10 +211,10 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ForeignKey[_M]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: ForeignKey[Optional[_M]], to: Union[Type[_M], str], on_delete: _OnDeleteOptions, to_field: Optional[str] = ..., @@ -247,7 +247,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ForeignKey[Optional[_M]]: ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor: ... @@ -269,8 +269,8 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): many_to_one: Literal[False] = ... # type: ignore [assignment] related_model: Type[_M] = ... @overload - def __new__( - cls, + def __init__( + self: OneToOneField[_M], to: Union[Type[_M], str], on_delete: _OnDeleteOptions, to_field: Optional[str] = ..., @@ -303,10 +303,10 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> OneToOneField[_M]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: OneToOneField[Optional[_M]], to: Union[Type[_M], str], on_delete: _OnDeleteOptions, to_field: Optional[str] = ..., @@ -339,7 +339,7 @@ class OneToOneField(Generic[_M], ForeignKey[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> OneToOneField[Optional[_M]]: ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ForwardOneToOneDescriptor: ... @@ -371,8 +371,8 @@ class ManyToManyField( swappable: bool = ... related_model: Type[_MM] = ... # type: ignore [assignment] through: Type[_MN] - def __new__( - cls, + def __init__( + self: ManyToManyField[_MM, _MN], to: Union[Type[_MM], str], through: Union[Type[_MN], str] = ..., to_field: Optional[str] = ..., @@ -405,7 +405,7 @@ class ManyToManyField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ManyToManyField[_MM, _MN]: ... + ) -> None: ... def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... def get_reverse_path_info( self, filtered_relation: None = ... diff --git a/django-stubs/urls/conf.pyi b/django-stubs/urls/conf.pyi index 3e0e32438..2d221c5b9 100644 --- a/django-stubs/urls/conf.pyi +++ b/django-stubs/urls/conf.pyi @@ -14,7 +14,9 @@ from ..conf.urls import IncludedURLConf from ..http.response import HttpResponseBase from .resolvers import URLPattern, URLResolver -_ResponseType = Union[HttpResponseBase, Coroutine[Any, Any, HttpResponseBase], Coroutine[Any, Any, None]] +_ResponseType = Union[ + HttpResponseBase, Coroutine[Any, Any, HttpResponseBase], Coroutine[Any, Any, None] +] def include( arg: Any, namespace: Optional[str] = ... diff --git a/django-stubs/utils/feedgenerator.pyi b/django-stubs/utils/feedgenerator.pyi index edc0ef070..f4567eb8c 100644 --- a/django-stubs/utils/feedgenerator.pyi +++ b/django-stubs/utils/feedgenerator.pyi @@ -1,6 +1,6 @@ from datetime import date, datetime from typing import Any, Dict, List, Optional, Tuple, Union -from xml.sax import ContentHandler # type: ignore +from xml.sax import ContentHandler def rfc2822_date(date: date) -> str: ... def rfc3339_date(date: date) -> str: ... @@ -47,9 +47,9 @@ class SyndicationFeed: ) -> None: ... def num_items(self) -> Any: ... def root_attributes(self) -> Dict[Any, Any]: ... - def add_root_elements(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] + def add_root_elements(self, handler: ContentHandler) -> None: ... def item_attributes(self, item: Dict[str, Any]) -> Dict[Any, Any]: ... - def add_item_elements( # type: ignore [no-any-unimported] + def add_item_elements( self, handler: ContentHandler, item: Dict[str, Any] ) -> None: ... def write(self, outfile: Any, encoding: Any) -> None: ... @@ -64,8 +64,8 @@ class Enclosure: class RssFeed(SyndicationFeed): content_type: str = ... - def write_items(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] - def endChannelElement(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] + def write_items(self, handler: ContentHandler) -> None: ... + def endChannelElement(self, handler: ContentHandler) -> None: ... class RssUserland091Feed(RssFeed): ... class Rss201rev2Feed(RssFeed): ... @@ -73,6 +73,6 @@ class Rss201rev2Feed(RssFeed): ... class Atom1Feed(SyndicationFeed): content_type: str = ... ns: str = ... - def write_items(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] + def write_items(self, handler: ContentHandler) -> None: ... DefaultFeed = Rss201rev2Feed diff --git a/django-stubs/utils/html.pyi b/django-stubs/utils/html.pyi index bf3b9c8b6..4c268349d 100644 --- a/django-stubs/utils/html.pyi +++ b/django-stubs/utils/html.pyi @@ -17,7 +17,9 @@ def json_script(value: Any, element_id: str) -> SafeText: ... def conditional_escape(text: Any) -> str: ... def format_html(format_string: str, *args: Any, **kwargs: Any) -> SafeText: ... def format_html_join( - sep: str, format_string: str, args_generator: Union[Iterable[Any], Iterable[Tuple[str]]] + sep: str, + format_string: str, + args_generator: Union[Iterable[Any], Iterable[Tuple[str]]], ) -> SafeText: ... def linebreaks(value: Any, autoescape: bool = ...) -> str: ... diff --git a/package.json b/package.json index f95141d58..adb11ee2a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "1.1.234" + "pyright": "^1.1.274" } } diff --git a/poetry.lock b/poetry.lock index 36dcd8ce1..3e9a889b2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -169,15 +169,15 @@ python-versions = "*" [[package]] name = "mypy" -version = "0.942" +version = "0.982" description = "Optional static typing for Python" category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" [package.dependencies] mypy-extensions = ">=0.4.3" -tomli = ">=1.1.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} typing-extensions = ">=3.10" @@ -237,8 +237,8 @@ python-versions = ">=3.6" importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] -testing = ["pytest-benchmark", "pytest"] -dev = ["tox", "pre-commit"] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] [[package]] name = "psycopg2-binary" @@ -376,7 +376,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "633f1b4aa9e377af6a9ed5052d7fd7da3d479e3b99937217176d20da8b932573" +content-hash = "1f44be2d8571ee2d51a066a34e78539342e5570150ec03c162ac5938e391a079" [metadata.files] asgiref = [] @@ -412,72 +412,24 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] -packaging = [] +packaging = [ + {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, + {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, +] pathspec = [ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, ] platformdirs = [] -pluggy = [] -psycopg2-binary = [ - {file = "psycopg2-binary-2.9.3.tar.gz", hash = "sha256:761df5313dc15da1502b21453642d7599d26be88bff659382f8f9747c7ebea4e"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-macosx_10_14_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:539b28661b71da7c0e428692438efbcd048ca21ea81af618d845e06ebfd29478"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e82d38390a03da28c7985b394ec3f56873174e2c88130e6966cb1c946508e65"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57804fc02ca3ce0dbfbef35c4b3a4a774da66d66ea20f4bda601294ad2ea6092"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-manylinux_2_24_aarch64.whl", hash = "sha256:083a55275f09a62b8ca4902dd11f4b33075b743cf0d360419e2051a8a5d5ff76"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-manylinux_2_24_ppc64le.whl", hash = "sha256:0a29729145aaaf1ad8bafe663131890e2111f13416b60e460dae0a96af5905c9"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:3a79d622f5206d695d7824cbf609a4f5b88ea6d6dab5f7c147fc6d333a8787e4"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:090f3348c0ab2cceb6dfbe6bf721ef61262ddf518cd6cc6ecc7d334996d64efa"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:a9e1f75f96ea388fbcef36c70640c4efbe4650658f3d6a2967b4cc70e907352e"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c3ae8e75eb7160851e59adc77b3a19a976e50622e44fd4fd47b8b18208189d42"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-win32.whl", hash = "sha256:7b1e9b80afca7b7a386ef087db614faebbf8839b7f4db5eb107d0f1a53225029"}, - {file = "psycopg2_binary-2.9.3-cp310-cp310-win_amd64.whl", hash = "sha256:8b344adbb9a862de0c635f4f0425b7958bf5a4b927c8594e6e8d261775796d53"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-macosx_10_14_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:e847774f8ffd5b398a75bc1c18fbb56564cda3d629fe68fd81971fece2d3c67e"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:68641a34023d306be959101b345732360fc2ea4938982309b786f7be1b43a4a1"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3303f8807f342641851578ee7ed1f3efc9802d00a6f83c101d21c608cb864460"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-manylinux_2_24_aarch64.whl", hash = "sha256:e3699852e22aa68c10de06524a3721ade969abf382da95884e6a10ff798f9281"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-manylinux_2_24_ppc64le.whl", hash = "sha256:526ea0378246d9b080148f2d6681229f4b5964543c170dd10bf4faaab6e0d27f"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:b1c8068513f5b158cf7e29c43a77eb34b407db29aca749d3eb9293ee0d3103ca"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:15803fa813ea05bef089fa78835118b5434204f3a17cb9f1e5dbfd0b9deea5af"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:152f09f57417b831418304c7f30d727dc83a12761627bb826951692cc6491e57"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:404224e5fef3b193f892abdbf8961ce20e0b6642886cfe1fe1923f41aaa75c9d"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-win32.whl", hash = "sha256:1f6b813106a3abdf7b03640d36e24669234120c72e91d5cbaeb87c5f7c36c65b"}, - {file = "psycopg2_binary-2.9.3-cp36-cp36m-win_amd64.whl", hash = "sha256:2d872e3c9d5d075a2e104540965a1cf898b52274a5923936e5bfddb58c59c7c2"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-macosx_10_14_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:10bb90fb4d523a2aa67773d4ff2b833ec00857f5912bafcfd5f5414e45280fb1"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:874a52ecab70af13e899f7847b3e074eeb16ebac5615665db33bce8a1009cf33"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a29b3ca4ec9defec6d42bf5feb36bb5817ba3c0230dd83b4edf4bf02684cd0ae"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-manylinux_2_24_aarch64.whl", hash = "sha256:12b11322ea00ad8db8c46f18b7dfc47ae215e4df55b46c67a94b4effbaec7094"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-manylinux_2_24_ppc64le.whl", hash = "sha256:53293533fcbb94c202b7c800a12c873cfe24599656b341f56e71dd2b557be063"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c381bda330ddf2fccbafab789d83ebc6c53db126e4383e73794c74eedce855ef"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:9d29409b625a143649d03d0fd7b57e4b92e0ecad9726ba682244b73be91d2fdb"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:183a517a3a63503f70f808b58bfbf962f23d73b6dccddae5aa56152ef2bcb232"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:15c4e4cfa45f5a60599d9cec5f46cd7b1b29d86a6390ec23e8eebaae84e64554"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-win32.whl", hash = "sha256:adf20d9a67e0b6393eac162eb81fb10bc9130a80540f4df7e7355c2dd4af9fba"}, - {file = "psycopg2_binary-2.9.3-cp37-cp37m-win_amd64.whl", hash = "sha256:2f9ffd643bc7349eeb664eba8864d9e01f057880f510e4681ba40a6532f93c71"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-macosx_10_14_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:def68d7c21984b0f8218e8a15d514f714d96904265164f75f8d3a70f9c295667"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dffc08ca91c9ac09008870c9eb77b00a46b3378719584059c034b8945e26b272"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:280b0bb5cbfe8039205c7981cceb006156a675362a00fe29b16fbc264e242834"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-manylinux_2_24_aarch64.whl", hash = "sha256:af9813db73395fb1fc211bac696faea4ca9ef53f32dc0cfa27e4e7cf766dcf24"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-manylinux_2_24_ppc64le.whl", hash = "sha256:63638d875be8c2784cfc952c9ac34e2b50e43f9f0a0660b65e2a87d656b3116c"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ffb7a888a047696e7f8240d649b43fb3644f14f0ee229077e7f6b9f9081635bd"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:0c9d5450c566c80c396b7402895c4369a410cab5a82707b11aee1e624da7d004"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:d1c1b569ecafe3a69380a94e6ae09a4789bbb23666f3d3a08d06bbd2451f5ef1"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8fc53f9af09426a61db9ba357865c77f26076d48669f2e1bb24d85a22fb52307"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-win32.whl", hash = "sha256:6472a178e291b59e7f16ab49ec8b4f3bdada0a879c68d3817ff0963e722a82ce"}, - {file = "psycopg2_binary-2.9.3-cp38-cp38-win_amd64.whl", hash = "sha256:35168209c9d51b145e459e05c31a9eaeffa9a6b0fd61689b48e07464ffd1a83e"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-macosx_10_14_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:47133f3f872faf28c1e87d4357220e809dfd3fa7c64295a4a148bcd1e6e34ec9"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:91920527dea30175cc02a1099f331aa8c1ba39bf8b7762b7b56cbf54bc5cce42"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:887dd9aac71765ac0d0bac1d0d4b4f2c99d5f5c1382d8b770404f0f3d0ce8a39"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-manylinux_2_24_aarch64.whl", hash = "sha256:1f14c8b0942714eb3c74e1e71700cbbcb415acbc311c730370e70c578a44a25c"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-manylinux_2_24_ppc64le.whl", hash = "sha256:7af0dd86ddb2f8af5da57a976d27cd2cd15510518d582b478fbb2292428710b4"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:93cd1967a18aa0edd4b95b1dfd554cf15af657cb606280996d393dadc88c3c35"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bda845b664bb6c91446ca9609fc69f7db6c334ec5e4adc87571c34e4f47b7ddb"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:01310cf4cf26db9aea5158c217caa92d291f0500051a6469ac52166e1a16f5b7"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:99485cab9ba0fa9b84f1f9e1fef106f44a46ef6afdeec8885e0b88d0772b49e8"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-win32.whl", hash = "sha256:46f0e0a6b5fa5851bbd9ab1bc805eef362d3a230fbdfbc209f4a236d0a7a990d"}, - {file = "psycopg2_binary-2.9.3-cp39-cp39-win_amd64.whl", hash = "sha256:accfe7e982411da3178ec690baaceaad3c278652998b2c45828aaac66cd8285f"}, +pluggy = [ + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, +] +psycopg2-binary = [] +py = [ + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] -py = [] pycodestyle = [] pyflakes = [] pyparsing = [] diff --git a/pyproject.toml b/pyproject.toml index 7877a2071..6b1a633dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ python = "^3.7" black = "22.3.0" pytest = "7.1.1" wheel = "0.35.1" -mypy = "0.942" +mypy = "^0.982" isort = "5.10.1" Django = "3.1.7" flake8 = "4.0.1" diff --git a/yarn.lock b/yarn.lock index db1c1abfd..55939d7df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -pyright@1.1.234: - version "1.1.234" - resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.234.tgz#f304666fd9b0676b0e76e5971e4f61ce6c8fdc2d" - integrity sha512-09aeuMkxJj86Y2BPbAE1xkf6yKalIxq2hZHwBegiryBeLUsGOnpPmBWXD34luTZnQWeni9wllOdaD8xhl+Yh4A== +pyright@^1.1.274: + version "1.1.274" + resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.274.tgz#19cab8a1fd7b9da33bb6981b853df26d2a4ca6d5" + integrity sha512-+MEiHktoAxlehWbBAF2vwJkJxV5tObbLK6vnc7u+iDBH06vuHqTqY33AV+YGNwfDEU35chw5zu7H3EpGROXsGQ==