diff --git a/django-stubs/apps/config.pyi b/django-stubs/apps/config.pyi index 2c259a864..9f31754e0 100644 --- a/django-stubs/apps/config.pyi +++ b/django-stubs/apps/config.pyi @@ -24,7 +24,9 @@ class AppConfig: def __init__(self, app_name: str, app_module: types.ModuleType | None) -> None: ... @classmethod def create(cls, entry: str) -> AppConfig: ... - def get_model(self, model_name: str, require_ready: bool = ...) -> type[Model]: ... - def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[type[Model]]: ... + def get_model(self, model_name: str, require_ready: bool = True) -> type[Model]: ... + def get_models( + self, include_auto_created: bool = False, include_swapped: bool = False + ) -> Iterator[type[Model]]: ... def import_models(self) -> None: ... def ready(self) -> None: ... diff --git a/django-stubs/apps/registry.pyi b/django-stubs/apps/registry.pyi index 4c0948a79..7da72a7cf 100644 --- a/django-stubs/apps/registry.pyi +++ b/django-stubs/apps/registry.pyi @@ -16,15 +16,15 @@ class Apps: _pending_operations: dict[tuple[str, str], list] models_ready: bool ready: bool - def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ...) -> None: ... - def populate(self, installed_apps: Iterable[AppConfig | str] | None = ...) -> None: ... + def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ()) -> None: ... + def populate(self, installed_apps: Iterable[AppConfig | str] | None = None) -> None: ... def check_apps_ready(self) -> None: ... def check_models_ready(self) -> None: ... def get_app_configs(self) -> Iterable[AppConfig]: ... def get_app_config(self, app_label: str) -> AppConfig: ... # it's not possible to support it in plugin properly now - def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> list[type[Model]]: ... - def get_model(self, app_label: str, model_name: str | None = ..., require_ready: bool = ...) -> type[Any]: ... + def get_models(self, include_auto_created: bool = False, include_swapped: bool = False) -> list[type[Model]]: ... + def get_model(self, app_label: str, model_name: str | None = None, require_ready: bool = True) -> type[Any]: ... def register_model(self, app_label: str, model: type[Model]) -> None: ... def is_installed(self, app_name: str) -> bool: ... def get_containing_app_config(self, object_name: str) -> AppConfig | None: ... diff --git a/django-stubs/contrib/contenttypes/checks.pyi b/django-stubs/contrib/contenttypes/checks.pyi index 635665a5b..1a4e38012 100644 --- a/django-stubs/contrib/contenttypes/checks.pyi +++ b/django-stubs/contrib/contenttypes/checks.pyi @@ -5,8 +5,8 @@ from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage def check_generic_foreign_keys( - app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any + app_configs: Sequence[AppConfig] | None = None, **kwargs: Any ) -> Sequence[CheckMessage]: ... def check_model_name_lengths( - app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any + app_configs: Sequence[AppConfig] | None = None, **kwargs: Any ) -> Sequence[CheckMessage]: ... diff --git a/django-stubs/contrib/contenttypes/management/__init__.pyi b/django-stubs/contrib/contenttypes/management/__init__.pyi index d5e25c3d1..9e5a7c928 100644 --- a/django-stubs/contrib/contenttypes/management/__init__.pyi +++ b/django-stubs/contrib/contenttypes/management/__init__.pyi @@ -18,16 +18,16 @@ class RenameContentType(migrations.RunPython): def rename_backward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ... def inject_rename_contenttypes_operations( - plan: list[tuple[Migration, bool]] | None = ..., apps: StateApps = ..., using: str = ..., **kwargs: Any + plan: list[tuple[Migration, bool]] | None = None, apps: StateApps = ..., using: str = "default", **kwargs: Any ) -> None: ... def get_contenttypes_and_models( app_config: AppConfig, using: str, ContentType: type[ContentType] ) -> tuple[dict[str, ContentType], dict[str, type[Model]]]: ... def create_contenttypes( app_config: AppConfig, - verbosity: int = ..., - interactive: bool = ..., - using: str = ..., + verbosity: int = 2, + interactive: bool = True, + using: str = "default", apps: Apps = ..., **kwargs: Any, ) -> None: ... diff --git a/django-stubs/contrib/contenttypes/prefetch.pyi b/django-stubs/contrib/contenttypes/prefetch.pyi index f645e8cd3..a444150ac 100644 --- a/django-stubs/contrib/contenttypes/prefetch.pyi +++ b/django-stubs/contrib/contenttypes/prefetch.pyi @@ -4,6 +4,6 @@ from django.db.models import Prefetch from django.db.models.query import QuerySet class GenericPrefetch(Prefetch): - def __init__(self, lookup: str, querysets: list[QuerySet], to_attr: str | None = ...) -> None: ... + def __init__(self, lookup: str, querysets: list[QuerySet], to_attr: str | None = None) -> None: ... def __getstate__(self) -> dict[str, Any]: ... def get_current_querysets(self, level: int) -> list[QuerySet] | None: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi index b655ac23e..4a3416b73 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi @@ -17,7 +17,7 @@ class SpatialiteSchemaEditor(DatabaseSchemaEditor): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def geo_quote_name(self, name: Any) -> Any: ... def column_sql( - self, model: type[Model], field: Field, include_default: bool = ... + self, model: type[Model], field: Field, include_default: bool = False ) -> tuple[None, None] | tuple[str, list[Any]]: ... def remove_geometry_metadata(self, model: type[Model], field: Field) -> None: ... def create_model(self, model: type[Model]) -> None: ... diff --git a/django-stubs/contrib/gis/db/backends/utils.pyi b/django-stubs/contrib/gis/db/backends/utils.pyi index e83aca1c9..1632d5bab 100644 --- a/django-stubs/contrib/gis/db/backends/utils.pyi +++ b/django-stubs/contrib/gis/db/backends/utils.pyi @@ -9,7 +9,7 @@ class SpatialOperator: sql_template: Any op: Any func: Any - def __init__(self, op: Any | None = ..., func: Any | None = ...) -> None: ... + def __init__(self, op: Any | None = None, func: Any | None = None) -> None: ... @property def default_template(self) -> Any: ... def as_sql( diff --git a/django-stubs/contrib/gis/measure.pyi b/django-stubs/contrib/gis/measure.pyi index 1745f3591..3cdd78577 100644 --- a/django-stubs/contrib/gis/measure.pyi +++ b/django-stubs/contrib/gis/measure.pyi @@ -10,7 +10,7 @@ class MeasureBase: UNITS: dict[str, float] ALIAS: dict[str, str] LALIAS: dict[str, str] - def __init__(self, default_unit: str | None = ..., **kwargs: Any) -> None: ... + def __init__(self, default_unit: str | None = None, **kwargs: Any) -> None: ... standard: Any def __getattr__(self, name: str) -> float: ... def __eq__(self, other: object) -> bool: ... diff --git a/django-stubs/contrib/humanize/templatetags/humanize.pyi b/django-stubs/contrib/humanize/templatetags/humanize.pyi index 9ab333904..46804d54f 100644 --- a/django-stubs/contrib/humanize/templatetags/humanize.pyi +++ b/django-stubs/contrib/humanize/templatetags/humanize.pyi @@ -7,13 +7,13 @@ from django import template register: template.Library def ordinal(value: str | SupportsInt | None) -> str | None: ... -def intcomma(value: str | SupportsInt | None, use_l10n: bool = ...) -> str: ... +def intcomma(value: str | SupportsInt | None, use_l10n: bool = True) -> str: ... intword_converters: tuple[tuple[int, Callable]] def intword(value: str | SupportsInt | None) -> int | str | None: ... def apnumber(value: str | SupportsInt | None) -> int | str | None: ... -def naturalday(value: date | str | None, arg: str | None = ...) -> str | None: ... +def naturalday(value: date | str | None, arg: str | None = None) -> str | None: ... def naturaltime(value: datetime) -> str: ... class NaturalTimeFormatter: diff --git a/django-stubs/contrib/messages/api.pyi b/django-stubs/contrib/messages/api.pyi index 9eb2f4fe5..f71febff2 100644 --- a/django-stubs/contrib/messages/api.pyi +++ b/django-stubs/contrib/messages/api.pyi @@ -10,8 +10,8 @@ def add_message( request: HttpRequest | None, level: int, message: _StrOrPromise, - extra_tags: str = ..., - fail_silently: bool | str = ..., + extra_tags: str = "", + fail_silently: bool | str = False, ) -> None: ... def get_messages(request: HttpRequest) -> list[Any] | BaseStorage: ... def get_level(request: HttpRequest) -> int: ... @@ -19,30 +19,30 @@ def set_level(request: HttpRequest, level: int) -> bool: ... def debug( request: HttpRequest, message: _StrOrPromise, - extra_tags: str = ..., - fail_silently: bool | str = ..., + extra_tags: str = "", + fail_silently: bool | str = False, ) -> None: ... def info( request: HttpRequest, message: _StrOrPromise, - extra_tags: str = ..., - fail_silently: bool | str = ..., + extra_tags: str = "", + fail_silently: bool | str = False, ) -> None: ... def success( request: HttpRequest, message: _StrOrPromise, - extra_tags: str = ..., - fail_silently: bool | str = ..., + extra_tags: str = "", + fail_silently: bool | str = False, ) -> None: ... def warning( request: HttpRequest, message: _StrOrPromise, - extra_tags: str = ..., - fail_silently: bool | str = ..., + extra_tags: str = "", + fail_silently: bool | str = False, ) -> None: ... def error( request: HttpRequest, message: _StrOrPromise, - extra_tags: str = ..., - fail_silently: bool | str = ..., + extra_tags: str = "", + fail_silently: bool | str = False, ) -> None: ... diff --git a/django-stubs/contrib/messages/storage/base.pyi b/django-stubs/contrib/messages/storage/base.pyi index 08d46625f..17b2e83c4 100644 --- a/django-stubs/contrib/messages/storage/base.pyi +++ b/django-stubs/contrib/messages/storage/base.pyi @@ -10,7 +10,7 @@ class Message: level: int message: str extra_tags: str - def __init__(self, level: int, message: str, extra_tags: str | None = ...) -> None: ... + def __init__(self, level: int, message: str, extra_tags: str | None = None) -> None: ... @property def tags(self) -> str: ... @property @@ -25,5 +25,5 @@ class BaseStorage: def __iter__(self) -> Iterator[Message]: ... def __contains__(self, item: Any) -> bool: ... def update(self, response: HttpResponseBase) -> list[Message] | None: ... - def add(self, level: int, message: str, extra_tags: str | None = ...) -> None: ... + def add(self, level: int, message: str, extra_tags: str | None = "") -> None: ... level: Any diff --git a/django-stubs/contrib/messages/test.pyi b/django-stubs/contrib/messages/test.pyi index e680d9548..152c4a8f2 100644 --- a/django-stubs/contrib/messages/test.pyi +++ b/django-stubs/contrib/messages/test.pyi @@ -5,5 +5,5 @@ from django.http.response import HttpResponse class MessagesTestMixin: def assertMessages( - self, response: HttpResponse, expected_messages: list[Any] | BaseStorage, *, ordered: bool = ... + self, response: HttpResponse, expected_messages: list[Any] | BaseStorage, *, ordered: bool = True ) -> None: ... diff --git a/django-stubs/contrib/postgres/constraints.pyi b/django-stubs/contrib/postgres/constraints.pyi index fbbf4646d..edf8c461d 100644 --- a/django-stubs/contrib/postgres/constraints.pyi +++ b/django-stubs/contrib/postgres/constraints.pyi @@ -21,14 +21,14 @@ class ExclusionConstraint(BaseConstraint): *, name: str, expressions: Sequence[tuple[str | Combinable, str]], - index_type: str | None = ..., - condition: Q | None = ..., - deferrable: Deferrable | None = ..., - include: list[str] | tuple[str] | None = ..., - violation_error_code: str | None = ..., - violation_error_message: _StrOrPromise | None = ..., + index_type: str | None = None, + condition: Q | None = None, + deferrable: Deferrable | None = None, + include: list[str] | tuple[str] | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, ) -> None: ... def check_supported(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... def validate( - self, model: type[Model], instance: Model, exclude: Iterable[str] | None = ..., using: str = ... + self, model: type[Model], instance: Model, exclude: Iterable[str] | None = None, using: str = "default" ) -> None: ... diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index b71faba3f..8b2094ab3 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -30,7 +30,7 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): def __init__( self, base_field: Field, - size: int | None = ..., + size: int | None = None, *, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., diff --git a/django-stubs/contrib/postgres/forms/array.pyi b/django-stubs/contrib/postgres/forms/array.pyi index f12bc2559..65adef545 100644 --- a/django-stubs/contrib/postgres/forms/array.pyi +++ b/django-stubs/contrib/postgres/forms/array.pyi @@ -19,9 +19,9 @@ class SimpleArrayField(forms.CharField): self, base_field: forms.Field, *, - delimiter: str = ..., - max_length: int | None = ..., - min_length: int | None = ..., + delimiter: str = ",", + max_length: int | None = None, + min_length: int | None = None, **kwargs: Any, ) -> None: ... def clean(self, value: Any) -> Sequence[Any]: ... @@ -41,7 +41,7 @@ class SplitArrayWidget(forms.Widget): def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... def id_for_label(self, id_: str) -> str: ... - def get_context(self, name: str, value: Any, attrs: _OptAttrs | None = ...) -> dict[str, Any]: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None = None) -> dict[str, Any]: ... @property def needs_multipart_form(self) -> bool: ... # type: ignore[override] @@ -51,7 +51,7 @@ class SplitArrayField(forms.Field): size: int remove_trailing_nulls: bool def __init__( - self, base_field: forms.Field, size: int, *, remove_trailing_nulls: bool = ..., **kwargs: Any + self, base_field: forms.Field, size: int, *, remove_trailing_nulls: bool = False, **kwargs: Any ) -> None: ... def to_python(self, value: Any) -> Sequence[Any]: ... def clean(self, value: Any) -> Sequence[Any]: ... diff --git a/django-stubs/contrib/postgres/forms/ranges.pyi b/django-stubs/contrib/postgres/forms/ranges.pyi index 476820175..0a2b2c8e6 100644 --- a/django-stubs/contrib/postgres/forms/ranges.pyi +++ b/django-stubs/contrib/postgres/forms/ranges.pyi @@ -6,11 +6,11 @@ from django.forms.widgets import MultiWidget, _OptAttrs from psycopg2.extras import Range # type: ignore [import-untyped] class RangeWidget(MultiWidget): - def __init__(self, base_widget: forms.Widget | type[forms.Widget], attrs: _OptAttrs | None = ...) -> None: ... + def __init__(self, base_widget: forms.Widget | type[forms.Widget], attrs: _OptAttrs | None = None) -> None: ... def decompress(self, value: Any) -> tuple[Any | None, Any | None]: ... class HiddenRangeWidget(RangeWidget): - def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... class BaseRangeField(forms.MultiValueField): default_error_messages: _ErrorMessagesDict diff --git a/django-stubs/contrib/postgres/indexes.pyi b/django-stubs/contrib/postgres/indexes.pyi index cc064c996..00bd95114 100644 --- a/django-stubs/contrib/postgres/indexes.pyi +++ b/django-stubs/contrib/postgres/indexes.pyi @@ -13,7 +13,7 @@ class PostgresIndex(Index): @cached_property def max_name_length(self) -> int: ... # type: ignore[override] def create_sql( - self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = ..., **kwargs: Any + self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = "", **kwargs: Any ) -> Statement: ... def check_supported(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... def get_with_params(self) -> Sequence[str]: ... @@ -22,8 +22,8 @@ class BloomIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - length: int | None = ..., - columns: _ListOrTuple[int] = ..., + length: int | None = None, + columns: _ListOrTuple[int] = (), fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., @@ -36,8 +36,8 @@ class BrinIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - autosummarize: bool | None = ..., - pages_per_range: int | None = ..., + autosummarize: bool | None = None, + pages_per_range: int | None = None, fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., @@ -50,7 +50,7 @@ class BTreeIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - fillfactor: int | None = ..., + fillfactor: int | None = None, fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., @@ -63,8 +63,8 @@ class GinIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - fastupdate: bool | None = ..., - gin_pending_list_limit: int | None = ..., + fastupdate: bool | None = None, + gin_pending_list_limit: int | None = None, fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., @@ -77,8 +77,8 @@ class GistIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - buffering: bool | None = ..., - fillfactor: int | None = ..., + buffering: bool | None = None, + fillfactor: int | None = None, fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., @@ -91,7 +91,7 @@ class HashIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - fillfactor: int | None = ..., + fillfactor: int | None = None, fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., @@ -104,7 +104,7 @@ class SpGistIndex(PostgresIndex): def __init__( self, *expressions: BaseExpression | Combinable | str, - fillfactor: int | None = ..., + fillfactor: int | None = None, fields: Sequence[str] = ..., name: str | None = ..., db_tablespace: str | None = ..., diff --git a/django-stubs/contrib/postgres/operations.pyi b/django-stubs/contrib/postgres/operations.pyi index 8b6747563..8b86cd576 100644 --- a/django-stubs/contrib/postgres/operations.pyi +++ b/django-stubs/contrib/postgres/operations.pyi @@ -48,7 +48,7 @@ class CollationOperation(Operation): locale: str provider: str deterministic: bool - def __init__(self, name: str, locale: str, *, provider: str = ..., deterministic: bool = ...) -> None: ... + def __init__(self, name: str, locale: str, *, provider: str = "libc", deterministic: bool = True) -> None: ... def create_collation(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... def remove_collation(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... diff --git a/django-stubs/contrib/postgres/search.pyi b/django-stubs/contrib/postgres/search.pyi index c90bdc110..92335c203 100644 --- a/django-stubs/contrib/postgres/search.pyi +++ b/django-stubs/contrib/postgres/search.pyi @@ -31,14 +31,14 @@ class SearchVector(SearchVectorCombinable, Func): arg_joiner: str output_field: ClassVar[SearchVectorField] def __init__( - self, *expressions: _Expression, config: _Expression | None = ..., weight: Any | None = ... + self, *expressions: _Expression, config: _Expression | None = None, weight: Any | None = None ) -> None: ... def as_sql( # type: ignore[override] self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, - function: str | None = ..., - template: str | None = ..., + function: str | None = None, + template: str | None = None, ) -> _AsSqlType: ... class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): @@ -48,7 +48,7 @@ class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): connector: str, rhs: Combinable, config: _Expression | None, - output_field: Field | None = ..., + output_field: Field | None = None, ) -> None: ... class SearchQueryCombinable: @@ -65,18 +65,18 @@ class SearchQuery(SearchQueryCombinable, Func): # type: ignore[misc] def __init__( self, value: _Expression, - output_field: Field | None = ..., + output_field: Field | None = None, *, - config: _Expression | None = ..., - invert: bool = ..., - search_type: str = ..., + config: _Expression | None = None, + invert: bool = False, + search_type: str = "plain", ) -> None: ... def as_sql( # type: ignore[override] self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, - function: str | None = ..., - template: str | None = ..., + function: str | None = None, + template: str | None = None, ) -> _AsSqlType: ... def __invert__(self) -> Self: ... # type: ignore[override] @@ -87,7 +87,7 @@ class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: i connector: str, rhs: Combinable, config: _Expression | None, - output_field: Field | None = ..., + output_field: Field | None = None, ) -> None: ... class SearchRank(Func): @@ -96,9 +96,9 @@ class SearchRank(Func): self, vector: SearchVector | _Expression, query: SearchQuery | _Expression, - weights: Any | None = ..., - normalization: Any | None = ..., - cover_density: bool = ..., + weights: Any | None = None, + normalization: Any | None = None, + cover_density: bool = False, ) -> None: ... class SearchHeadline(Func): @@ -110,22 +110,22 @@ class SearchHeadline(Func): expression: _Expression, query: _Expression, *, - config: _Expression | None = ..., - start_sel: Any | None = ..., - stop_sel: Any | None = ..., - max_words: int | None = ..., - min_words: int | None = ..., - short_word: str | None = ..., - highlight_all: bool | None = ..., - max_fragments: int | None = ..., - fragment_delimiter: str | None = ..., + config: _Expression | None = None, + start_sel: Any | None = None, + stop_sel: Any | None = None, + max_words: int | None = None, + min_words: int | None = None, + short_word: str | None = None, + highlight_all: bool | None = None, + max_fragments: int | None = None, + fragment_delimiter: str | None = None, ) -> None: ... def as_sql( # type: ignore[override] self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, - function: str | None = ..., - template: str | None = ..., + function: str | None = None, + template: str | None = None, ) -> _AsSqlType: ... class TrigramBase(Func): diff --git a/django-stubs/contrib/postgres/validators.pyi b/django-stubs/contrib/postgres/validators.pyi index 2c95a9096..c9963baa9 100644 --- a/django-stubs/contrib/postgres/validators.pyi +++ b/django-stubs/contrib/postgres/validators.pyi @@ -10,7 +10,9 @@ class ArrayMinLengthValidator(MinLengthValidator): ... class KeysValidator(_Deconstructible): messages: dict[str, str] strict: bool - def __init__(self, keys: Iterable[str], strict: bool = ..., messages: Mapping[str, str] | None = ...) -> None: ... + def __init__( + self, keys: Iterable[str], strict: bool = False, messages: Mapping[str, str] | None = None + ) -> None: ... def __call__(self, value: Any) -> None: ... class RangeMaxValueValidator(MaxValueValidator): ... diff --git a/django-stubs/contrib/sessions/backends/base.pyi b/django-stubs/contrib/sessions/backends/base.pyi index 156c17cd2..0898f7c08 100644 --- a/django-stubs/contrib/sessions/backends/base.pyi +++ b/django-stubs/contrib/sessions/backends/base.pyi @@ -12,7 +12,7 @@ class SessionBase(dict[str, Any]): accessed: bool modified: bool serializer: Any - def __init__(self, session_key: str | None = ...) -> None: ... + def __init__(self, session_key: str | None = None) -> None: ... @property def key_salt(self) -> str: ... def set_test_cookie(self) -> None: ... @@ -43,8 +43,8 @@ class SessionBase(dict[str, Any]): def cycle_key(self) -> None: ... def exists(self, session_key: str) -> bool: ... def create(self) -> None: ... - def save(self, must_create: bool = ...) -> None: ... - def delete(self, session_key: str | None = ...) -> None: ... + def save(self, must_create: bool = False) -> None: ... + def delete(self, session_key: str | None = None) -> None: ... def load(self) -> dict[str, Any]: ... @classmethod def clear_expired(cls) -> None: ... diff --git a/django-stubs/contrib/sessions/backends/cache.pyi b/django-stubs/contrib/sessions/backends/cache.pyi index 9fcdf4d36..1ae59120c 100644 --- a/django-stubs/contrib/sessions/backends/cache.pyi +++ b/django-stubs/contrib/sessions/backends/cache.pyi @@ -6,6 +6,6 @@ KEY_PREFIX: str class SessionStore(SessionBase): cache_key_prefix: Any - def __init__(self, session_key: str | None = ...) -> None: ... + def __init__(self, session_key: str | None = None) -> None: ... @property def cache_key(self) -> str: ... diff --git a/django-stubs/contrib/sessions/backends/cached_db.pyi b/django-stubs/contrib/sessions/backends/cached_db.pyi index 11995d0e8..07a871428 100644 --- a/django-stubs/contrib/sessions/backends/cached_db.pyi +++ b/django-stubs/contrib/sessions/backends/cached_db.pyi @@ -6,6 +6,6 @@ KEY_PREFIX: str class SessionStore(DBStore): cache_key_prefix: Any - def __init__(self, session_key: str | None = ...) -> None: ... + def __init__(self, session_key: str | None = None) -> None: ... @property def cache_key(self) -> str: ... diff --git a/django-stubs/contrib/sessions/backends/db.pyi b/django-stubs/contrib/sessions/backends/db.pyi index 5357c1ef7..397ea32b6 100644 --- a/django-stubs/contrib/sessions/backends/db.pyi +++ b/django-stubs/contrib/sessions/backends/db.pyi @@ -5,7 +5,7 @@ from django.contrib.sessions.base_session import AbstractBaseSession from django.utils.functional import cached_property class SessionStore(SessionBase): - def __init__(self, session_key: str | None = ...) -> None: ... + def __init__(self, session_key: str | None = None) -> None: ... @classmethod def get_model_class(cls) -> type[AbstractBaseSession]: ... @cached_property diff --git a/django-stubs/contrib/sessions/backends/file.pyi b/django-stubs/contrib/sessions/backends/file.pyi index 6e72a95bf..0a5f89744 100644 --- a/django-stubs/contrib/sessions/backends/file.pyi +++ b/django-stubs/contrib/sessions/backends/file.pyi @@ -3,5 +3,5 @@ from django.contrib.sessions.backends.base import SessionBase class SessionStore(SessionBase): storage_path: str file_prefix: str - def __init__(self, session_key: str | None = ...) -> None: ... + def __init__(self, session_key: str | None = None) -> None: ... def clean(self) -> None: ... diff --git a/django-stubs/contrib/sitemaps/__init__.pyi b/django-stubs/contrib/sitemaps/__init__.pyi index 4973453a9..782341fbd 100644 --- a/django-stubs/contrib/sitemaps/__init__.pyi +++ b/django-stubs/contrib/sitemaps/__init__.pyi @@ -22,10 +22,10 @@ class Sitemap(Generic[_ItemT]): @property def paginator(self) -> Paginator: ... def get_languages_for_item(self, item: _ItemT) -> list[str]: ... - def get_protocol(self, protocol: str | None = ...) -> str: ... - def get_domain(self, site: Site | RequestSite | None = ...) -> str: ... + def get_protocol(self, protocol: str | None = None) -> str: ... + def get_domain(self, site: Site | RequestSite | None = None) -> str: ... def get_urls( - self, page: int | str = ..., site: Site | RequestSite | None = ..., protocol: str | None = ... + self, page: int | str = 1, site: Site | RequestSite | None = None, protocol: str | None = None ) -> list[dict[str, Any]]: ... def get_latest_lastmod(self) -> datetime | None: ... @@ -40,9 +40,9 @@ class GenericSitemap(Sitemap[_ModelT]): def __init__( self, info_dict: Mapping[str, datetime | QuerySet[_ModelT] | str], - priority: float | None = ..., - changefreq: str | None = ..., - protocol: str | None = ..., + priority: float | None = None, + changefreq: str | None = None, + protocol: str | None = None, ) -> None: ... def items(self) -> QuerySet[_ModelT]: ... def lastmod(self, item: _ModelT) -> datetime | None: ... diff --git a/django-stubs/contrib/sites/management.pyi b/django-stubs/contrib/sites/management.pyi index 26c187773..20c545f5b 100644 --- a/django-stubs/contrib/sites/management.pyi +++ b/django-stubs/contrib/sites/management.pyi @@ -5,9 +5,9 @@ from django.apps.registry import Apps def create_default_site( app_config: AppConfig, - verbosity: int = ..., - interactive: bool = ..., - using: str = ..., + verbosity: int = 2, + interactive: bool = True, + using: str = "default", apps: Apps = ..., **kwargs: Any, ) -> None: ... diff --git a/django-stubs/contrib/sites/managers.pyi b/django-stubs/contrib/sites/managers.pyi index bdf0e8492..b9872d212 100644 --- a/django-stubs/contrib/sites/managers.pyi +++ b/django-stubs/contrib/sites/managers.pyi @@ -5,4 +5,4 @@ from django.db import models _T = TypeVar("_T", bound=models.Model) class CurrentSiteManager(models.Manager[_T]): - def __init__(self, field_name: str | None = ...) -> None: ... + def __init__(self, field_name: str | None = None) -> None: ... diff --git a/django-stubs/contrib/sites/requests.pyi b/django-stubs/contrib/sites/requests.pyi index 0cb73d7ce..90dbace5a 100644 --- a/django-stubs/contrib/sites/requests.pyi +++ b/django-stubs/contrib/sites/requests.pyi @@ -7,5 +7,5 @@ class RequestSite: name: str domain: str def __init__(self, request: HttpRequest) -> None: ... - def save(self, force_insert: bool | tuple[ModelBase, ...] = ..., force_update: bool = ...) -> NoReturn: ... + def save(self, force_insert: bool | tuple[ModelBase, ...] = False, force_update: bool = False) -> NoReturn: ... def delete(self) -> NoReturn: ... diff --git a/django-stubs/contrib/staticfiles/checks.pyi b/django-stubs/contrib/staticfiles/checks.pyi index 203471582..da7008158 100644 --- a/django-stubs/contrib/staticfiles/checks.pyi +++ b/django-stubs/contrib/staticfiles/checks.pyi @@ -6,5 +6,5 @@ from django.core.checks.messages import CheckMessage, Error E005: Error -def check_finders(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> list[CheckMessage]: ... -def check_storages(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> list[CheckMessage]: ... +def check_finders(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> list[CheckMessage]: ... +def check_storages(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> list[CheckMessage]: ... diff --git a/django-stubs/contrib/staticfiles/finders.pyi b/django-stubs/contrib/staticfiles/finders.pyi index 5db965b1a..24bbbcefa 100644 --- a/django-stubs/contrib/staticfiles/finders.pyi +++ b/django-stubs/contrib/staticfiles/finders.pyi @@ -17,8 +17,8 @@ class BaseFinder: class FileSystemFinder(BaseFinder): locations: list[tuple[str, str]] storages: dict[str, Any] - def __init__(self, app_names: Sequence[str] | None = ..., *args: Any, **kwargs: Any) -> None: ... - def find_location(self, root: str, path: str, prefix: str | None = ...) -> str | None: ... + def __init__(self, app_names: Sequence[str] | None = None, *args: Any, **kwargs: Any) -> None: ... + def find_location(self, root: str, path: str, prefix: str | None = None) -> str | None: ... @overload def find(self, path: str, all: Literal[False] = False) -> str | None: ... @overload @@ -30,7 +30,7 @@ class AppDirectoriesFinder(BaseFinder): source_dir: str apps: list[str] storages: dict[str, FileSystemStorage] - def __init__(self, app_names: Iterable[str] | None = ..., *args: Any, **kwargs: Any) -> None: ... + def __init__(self, app_names: Iterable[str] | None = None, *args: Any, **kwargs: Any) -> None: ... def find_in_app(self, app: str, path: str) -> str | None: ... @overload def find(self, path: str, all: Literal[False] = False) -> str | None: ... @@ -40,7 +40,7 @@ class AppDirectoriesFinder(BaseFinder): class BaseStorageFinder(BaseFinder): storage: Storage - def __init__(self, storage: Storage | None = ..., *args: Any, **kwargs: Any) -> None: ... + def __init__(self, storage: Storage | None = None, *args: Any, **kwargs: Any) -> None: ... @overload def find(self, path: str, all: Literal[False] = False) -> str | None: ... @overload diff --git a/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi b/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi index 602a75c63..ecd423481 100644 --- a/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi +++ b/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi @@ -23,7 +23,7 @@ class Command(BaseCommand): def set_options(self, **options: Any) -> None: ... def collect(self) -> dict[str, list[str]]: ... def handle(self, **options: Any) -> str | None: ... - def log(self, msg: str, level: int = ...) -> None: ... + def log(self, msg: str, level: int = 2) -> None: ... def is_local_storage(self) -> bool: ... def clear_dir(self, path: str) -> None: ... def delete_file(self, path: str, prefixed_path: str, source_storage: Storage) -> bool: ... diff --git a/django-stubs/contrib/staticfiles/storage.pyi b/django-stubs/contrib/staticfiles/storage.pyi index 2999c4a96..41ff56916 100644 --- a/django-stubs/contrib/staticfiles/storage.pyi +++ b/django-stubs/contrib/staticfiles/storage.pyi @@ -12,7 +12,7 @@ _PostProcessT: TypeAlias = Iterator[tuple[str, str, bool] | tuple[str, None, Run class StaticFilesStorage(FileSystemStorage): def __init__( - self, location: _PathCompatible | None = ..., base_url: str | None = ..., *args: Any, **kwargs: Any + self, location: _PathCompatible | None = None, base_url: str | None = None, *args: Any, **kwargs: Any ) -> None: ... def path(self, name: _PathCompatible) -> str: ... @@ -24,13 +24,13 @@ class HashedFilesMixin: hashed_files: Any keep_intermediate_files: bool def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def file_hash(self, name: str, content: File | None = ...) -> str | None: ... - def hashed_name(self, name: str, content: File | None = ..., filename: str | None = ...) -> str: ... - def url(self, name: str, force: bool = ...) -> str: ... + def file_hash(self, name: str, content: File | None = None) -> str | None: ... + def hashed_name(self, name: str, content: File | None = None, filename: str | None = None) -> str: ... + def url(self, name: str, force: bool = False) -> str: ... def url_converter( - self, name: str, hashed_files: dict[str, Any], template: str | None = ... + self, name: str, hashed_files: dict[str, Any], template: str | None = None ) -> Callable[[Match], str]: ... - def post_process(self, paths: dict[str, Any], dry_run: bool = ..., **options: Any) -> _PostProcessT: ... + def post_process(self, paths: dict[str, Any], dry_run: bool = False, **options: Any) -> _PostProcessT: ... def clean_name(self, name: str) -> str: ... def hash_key(self, name: str) -> str: ... def stored_name(self, name: str) -> str: ... @@ -43,7 +43,7 @@ class ManifestFilesMixin(HashedFilesMixin): manifest_storage: Storage | None hashed_files: dict[str, str] manifest_hash: str - def __init__(self, *args: Any, manifest_storage: Storage | None = ..., **kwargs: Any) -> None: ... + def __init__(self, *args: Any, manifest_storage: Storage | None = None, **kwargs: Any) -> None: ... def read_manifest(self) -> str: ... def load_manifest(self) -> dict[str, Any]: ... def save_manifest(self) -> None: ... diff --git a/django-stubs/contrib/staticfiles/utils.pyi b/django-stubs/contrib/staticfiles/utils.pyi index a9e54fd5e..e076d0ab3 100644 --- a/django-stubs/contrib/staticfiles/utils.pyi +++ b/django-stubs/contrib/staticfiles/utils.pyi @@ -3,5 +3,5 @@ from collections.abc import Iterable, Iterator from django.core.files.storage import Storage def matches_patterns(path: str, patterns: Iterable[str]) -> bool: ... -def get_files(storage: Storage, ignore_patterns: Iterable[str] | None = ..., location: str = ...) -> Iterator[str]: ... -def check_settings(base_url: str | None = ...) -> None: ... +def get_files(storage: Storage, ignore_patterns: Iterable[str] | None = None, location: str = "") -> Iterator[str]: ... +def check_settings(base_url: str | None = None) -> None: ... diff --git a/django-stubs/core/cache/__init__.pyi b/django-stubs/core/cache/__init__.pyi index 5102a5768..3c236e325 100644 --- a/django-stubs/core/cache/__init__.pyi +++ b/django-stubs/core/cache/__init__.pyi @@ -13,7 +13,7 @@ class CacheHandler(BaseConnectionHandler[BaseCache]): settings_name: str exception_class: type[Exception] def create_connection(self, alias: str) -> BaseCache: ... - def all(self, initialized_only: bool = ...) -> list[BaseCache]: ... + def all(self, initialized_only: bool = False) -> list[BaseCache]: ... def close_caches(**kwargs: Any) -> None: ... diff --git a/django-stubs/core/cache/backends/base.pyi b/django-stubs/core/cache/backends/base.pyi index 6bebf72a0..c87be3333 100644 --- a/django-stubs/core/cache/backends/base.pyi +++ b/django-stubs/core/cache/backends/base.pyi @@ -24,46 +24,46 @@ class BaseCache: key_func: Callable def __init__(self, params: dict[str, Any]) -> None: ... def get_backend_timeout(self, timeout: float | None = ...) -> float | None: ... - def make_key(self, key: Any, version: int | None = ...) -> str: ... + def make_key(self, key: Any, version: int | None = None) -> str: ... def validate_key(self, key: Any) -> None: ... - def make_and_validate_key(self, key: Any, version: int | None = ...) -> str: ... - def add(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ... - async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ... - def get(self, key: Any, default: Any | None = ..., version: int | None = ...) -> Any: ... - async def aget(self, key: Any, default: Any | None = ..., version: int | None = ...) -> Any: ... - def set(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> None: ... - async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> None: ... - def touch(self, key: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ... - async def atouch(self, key: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ... - def delete(self, key: Any, version: int | None = ...) -> bool: ... - async def adelete(self, key: Any, version: int | None = ...) -> bool: ... - def get_many(self, keys: Iterable[Any], version: int | None = ...) -> dict[Any, Any]: ... - async def aget_many(self, keys: Iterable[Any], version: int | None = ...) -> dict[Any, Any]: ... + def make_and_validate_key(self, key: Any, version: int | None = None) -> str: ... + def add(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + def get(self, key: Any, default: Any | None = None, version: int | None = None) -> Any: ... + async def aget(self, key: Any, default: Any | None = None, version: int | None = None) -> Any: ... + def set(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> None: ... + async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> None: ... + def touch(self, key: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + async def atouch(self, key: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + def delete(self, key: Any, version: int | None = None) -> bool: ... + async def adelete(self, key: Any, version: int | None = None) -> bool: ... + def get_many(self, keys: Iterable[Any], version: int | None = None) -> dict[Any, Any]: ... + async def aget_many(self, keys: Iterable[Any], version: int | None = None) -> dict[Any, Any]: ... def get_or_set( - self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = ... + self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = None ) -> Any | None: ... async def aget_or_set( - self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = ... + self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = None ) -> Any | None: ... - def has_key(self, key: Any, version: int | None = ...) -> bool: ... - async def ahas_key(self, key: Any, version: int | None = ...) -> bool: ... - def incr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... - async def aincr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... - def decr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... - async def adecr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... + def has_key(self, key: Any, version: int | None = None) -> bool: ... + async def ahas_key(self, key: Any, version: int | None = None) -> bool: ... + def incr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def aincr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + def decr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def adecr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... def __contains__(self, key: Any) -> bool: ... - def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = ...) -> list[Any]: ... + def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = None) -> list[Any]: ... async def aset_many( - self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = ... + self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = None ) -> list[Any]: ... - def delete_many(self, keys: Iterable[Any], version: int | None = ...) -> None: ... - async def adelete_many(self, keys: Iterable[Any], version: int | None = ...) -> None: ... + def delete_many(self, keys: Iterable[Any], version: int | None = None) -> None: ... + async def adelete_many(self, keys: Iterable[Any], version: int | None = None) -> None: ... def clear(self) -> None: ... async def aclear(self) -> None: ... - def incr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... - async def aincr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... - def decr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... - async def adecr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ... + def incr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def aincr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + def decr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def adecr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... def close(self, **kwargs: Any) -> None: ... async def aclose(self, **kwargs: Any) -> None: ... diff --git a/django-stubs/core/cache/utils.pyi b/django-stubs/core/cache/utils.pyi index 7a5e8b6ae..3be305227 100644 --- a/django-stubs/core/cache/utils.pyi +++ b/django-stubs/core/cache/utils.pyi @@ -3,4 +3,4 @@ from typing import Any TEMPLATE_FRAGMENT_KEY_TEMPLATE: str -def make_template_fragment_key(fragment_name: str, vary_on: Iterable[Any] | None = ...) -> str: ... +def make_template_fragment_key(fragment_name: str, vary_on: Iterable[Any] | None = None) -> str: ... diff --git a/django-stubs/core/checks/database.pyi b/django-stubs/core/checks/database.pyi index 707bcec01..da958d70a 100644 --- a/django-stubs/core/checks/database.pyi +++ b/django-stubs/core/checks/database.pyi @@ -3,4 +3,4 @@ from typing import Any from django.core.checks import CheckMessage -def check_database_backends(databases: Iterable[str] | None = ..., **kwargs: Any) -> Sequence[CheckMessage]: ... +def check_database_backends(databases: Iterable[str] | None = None, **kwargs: Any) -> Sequence[CheckMessage]: ... diff --git a/django-stubs/core/checks/messages.pyi b/django-stubs/core/checks/messages.pyi index e5d57e0fb..ff7e2614a 100644 --- a/django-stubs/core/checks/messages.pyi +++ b/django-stubs/core/checks/messages.pyi @@ -12,8 +12,10 @@ class CheckMessage: hint: str | None obj: Any id: str | None - def __init__(self, level: int, msg: str, hint: str | None = ..., obj: Any = ..., id: str | None = ...) -> None: ... - def is_serious(self, level: int = ...) -> bool: ... + def __init__( + self, level: int, msg: str, hint: str | None = None, obj: Any | None = None, id: str | None = None + ) -> None: ... + def is_serious(self, level: int = 40) -> bool: ... def is_silenced(self) -> bool: ... class Debug(CheckMessage): diff --git a/django-stubs/core/checks/model_checks.pyi b/django-stubs/core/checks/model_checks.pyi index cb9a9012a..23f2b674e 100644 --- a/django-stubs/core/checks/model_checks.pyi +++ b/django-stubs/core/checks/model_checks.pyi @@ -4,5 +4,5 @@ from typing import Any from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage -def check_all_models(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> Sequence[CheckMessage]: ... -def check_lazy_references(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> Sequence[CheckMessage]: ... +def check_all_models(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> Sequence[CheckMessage]: ... +def check_lazy_references(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> Sequence[CheckMessage]: ... diff --git a/django-stubs/core/checks/registry.pyi b/django-stubs/core/checks/registry.pyi index 5d9307c3f..f4987f041 100644 --- a/django-stubs/core/checks/registry.pyi +++ b/django-stubs/core/checks/registry.pyi @@ -49,14 +49,14 @@ class CheckRegistry: ) -> Callable[[_C], _ProcessedCheckCallable[_C]]: ... def run_checks( self, - app_configs: Sequence[AppConfig] | None = ..., - tags: Sequence[str] | None = ..., - include_deployment_checks: bool = ..., - databases: Sequence[str] | None = ..., + app_configs: Sequence[AppConfig] | None = None, + tags: Sequence[str] | None = None, + include_deployment_checks: bool = False, + databases: Sequence[str] | None = None, ) -> list[CheckMessage]: ... - def tag_exists(self, tag: str, include_deployment_checks: bool = ...) -> bool: ... - def tags_available(self, deployment_checks: bool = ...) -> set[str]: ... - def get_checks(self, include_deployment_checks: bool = ...) -> list[_ProcessedCheckCallable]: ... + def tag_exists(self, tag: str, include_deployment_checks: bool = False) -> bool: ... + def tags_available(self, deployment_checks: bool = False) -> set[str]: ... + def get_checks(self, include_deployment_checks: bool = False) -> list[_ProcessedCheckCallable]: ... registry: CheckRegistry = ... register = registry.register diff --git a/django-stubs/core/exceptions.pyi b/django-stubs/core/exceptions.pyi index 762850123..1a335aa5e 100644 --- a/django-stubs/core/exceptions.pyi +++ b/django-stubs/core/exceptions.pyi @@ -38,8 +38,8 @@ class ValidationError(Exception): self, # Accepts arbitrarily nested data structure, mypy doesn't allow describing it accurately. message: _StrOrPromise | ValidationError | dict[str, Any] | list[Any], - code: str | None = ..., - params: dict[str, Any] | None = ..., + code: str | None = None, + params: dict[str, Any] | None = None, ) -> None: ... @property def message_dict(self) -> dict[str, list[str]]: ... diff --git a/django-stubs/core/files/base.pyi b/django-stubs/core/files/base.pyi index 41d461d02..6ccf006e3 100644 --- a/django-stubs/core/files/base.pyi +++ b/django-stubs/core/files/base.pyi @@ -11,13 +11,13 @@ class File(FileProxyMixin[AnyStr], IO[AnyStr]): file: IO[AnyStr] | None name: str | None mode: str - def __init__(self, file: IO[AnyStr] | None, name: str | None = ...) -> None: ... + def __init__(self, file: IO[AnyStr] | None, name: str | None = None) -> None: ... def __bool__(self) -> bool: ... def __len__(self) -> int: ... @cached_property def size(self) -> int: ... - def chunks(self, chunk_size: int | None = ...) -> Iterator[AnyStr]: ... - def multiple_chunks(self, chunk_size: int | None = ...) -> bool | None: ... + def chunks(self, chunk_size: int | None = None) -> Iterator[AnyStr]: ... + def multiple_chunks(self, chunk_size: int | None = None) -> bool | None: ... def __iter__(self) -> Iterator[AnyStr]: ... def __enter__(self) -> Self: ... def __exit__( @@ -42,9 +42,9 @@ class File(FileProxyMixin[AnyStr], IO[AnyStr]): class ContentFile(File[AnyStr]): file: IO[AnyStr] - def __init__(self, content: AnyStr, name: str | None = ...) -> None: ... + def __init__(self, content: AnyStr, name: str | None = None) -> None: ... def __bool__(self) -> bool: ... - def open(self, mode: str | None = ...) -> Self: ... # type: ignore[override] + def open(self, mode: str | None = None) -> Self: ... # type: ignore[override] def close(self) -> None: ... def write(self, data: AnyStr) -> int: ... diff --git a/django-stubs/core/files/images.pyi b/django-stubs/core/files/images.pyi index 5a7bb8500..70fe9ace3 100644 --- a/django-stubs/core/files/images.pyi +++ b/django-stubs/core/files/images.pyi @@ -10,5 +10,5 @@ class ImageFile(File[bytes]): def height(self) -> int: ... def get_image_dimensions( - file_or_path: _PathCompatible | IO[bytes], close: bool = ... + file_or_path: _PathCompatible | IO[bytes], close: bool = False ) -> tuple[int | None, int | None]: ... diff --git a/django-stubs/core/files/move.pyi b/django-stubs/core/files/move.pyi index bdbfd17fb..7c216a79b 100644 --- a/django-stubs/core/files/move.pyi +++ b/django-stubs/core/files/move.pyi @@ -1,3 +1,3 @@ def file_move_safe( - old_file_name: str, new_file_name: str, chunk_size: int = ..., allow_overwrite: bool = ... + old_file_name: str, new_file_name: str, chunk_size: int = 65536, allow_overwrite: bool = False ) -> None: ... diff --git a/django-stubs/core/files/storage/__init__.pyi b/django-stubs/core/files/storage/__init__.pyi index abd413d8b..e4b8e0727 100644 --- a/django-stubs/core/files/storage/__init__.pyi +++ b/django-stubs/core/files/storage/__init__.pyi @@ -19,7 +19,7 @@ __all__ = ( GET_STORAGE_CLASS_DEPRECATED_MSG: str -def get_storage_class(import_path: str | None = ...) -> type[Storage]: ... +def get_storage_class(import_path: str | None = None) -> type[Storage]: ... class DefaultStorage(LazyObject): ... diff --git a/django-stubs/core/files/storage/base.pyi b/django-stubs/core/files/storage/base.pyi index ecaa2e6e7..25ca45156 100644 --- a/django-stubs/core/files/storage/base.pyi +++ b/django-stubs/core/files/storage/base.pyi @@ -5,11 +5,11 @@ from django.core.files.base import File from django.utils._os import _PathCompatible class Storage: - def open(self, name: str, mode: str = ...) -> File: ... - def save(self, name: str | None, content: IO[Any], max_length: int | None = ...) -> str: ... + def open(self, name: str, mode: str = "rb") -> File: ... + def save(self, name: str | None, content: IO[Any], max_length: int | None = None) -> str: ... def get_valid_name(self, name: str) -> str: ... def get_alternative_name(self, file_root: str, file_ext: str) -> str: ... - def get_available_name(self, name: str, max_length: int | None = ...) -> str: ... + def get_available_name(self, name: str, max_length: int | None = None) -> str: ... def generate_filename(self, filename: _PathCompatible) -> str: ... def path(self, name: str) -> str: ... def delete(self, name: str) -> None: ... diff --git a/django-stubs/core/files/storage/filesystem.pyi b/django-stubs/core/files/storage/filesystem.pyi index e9d0c132c..31448c7bf 100644 --- a/django-stubs/core/files/storage/filesystem.pyi +++ b/django-stubs/core/files/storage/filesystem.pyi @@ -10,10 +10,10 @@ class FileSystemStorage(_Deconstructible, Storage, StorageSettingsMixin): def __init__( self, - location: _PathCompatible | None = ..., - base_url: str | None = ..., - file_permissions_mode: int | None = ..., - directory_permissions_mode: int | None = ..., + location: _PathCompatible | None = None, + base_url: str | None = None, + file_permissions_mode: int | None = None, + directory_permissions_mode: int | None = None, ) -> None: ... @cached_property def base_location(self) -> _PathCompatible: ... diff --git a/django-stubs/core/files/storage/handler.pyi b/django-stubs/core/files/storage/handler.pyi index dcdcece2d..02ca26273 100644 --- a/django-stubs/core/files/storage/handler.pyi +++ b/django-stubs/core/files/storage/handler.pyi @@ -8,7 +8,7 @@ from .base import Storage class InvalidStorageError(ImproperlyConfigured): ... class StorageHandler: - def __init__(self, backends: dict[str, Storage] | None = ...) -> None: ... + def __init__(self, backends: dict[str, Storage] | None = None) -> None: ... @cached_property def backends(self) -> dict[str, Storage]: ... def __getitem__(self, alias: str) -> Storage: ... diff --git a/django-stubs/core/files/storage/memory.pyi b/django-stubs/core/files/storage/memory.pyi index 32ab895d7..64a318ef6 100644 --- a/django-stubs/core/files/storage/memory.pyi +++ b/django-stubs/core/files/storage/memory.pyi @@ -8,10 +8,10 @@ from .mixins import StorageSettingsMixin class InMemoryStorage(_Deconstructible, Storage, StorageSettingsMixin): def __init__( self, - location: _PathCompatible | None = ..., - base_url: str | None = ..., - file_permissions_mode: int | None = ..., - directory_permissions_mode: int | None = ..., + location: _PathCompatible | None = None, + base_url: str | None = None, + file_permissions_mode: int | None = None, + directory_permissions_mode: int | None = None, ) -> None: ... @cached_property def base_location(self) -> _PathCompatible: ... diff --git a/django-stubs/core/files/uploadedfile.pyi b/django-stubs/core/files/uploadedfile.pyi index 80c12acea..4dcb71e99 100644 --- a/django-stubs/core/files/uploadedfile.pyi +++ b/django-stubs/core/files/uploadedfile.pyi @@ -11,12 +11,12 @@ class UploadedFile(File): name: str | None def __init__( self, - file: IO | None = ..., - name: str | None = ..., - content_type: str | None = ..., - size: int | None = ..., - charset: str | None = ..., - content_type_extra: dict[str, str] | None = ..., + file: IO | None = None, + name: str | None = None, + content_type: str | None = None, + size: int | None = None, + charset: str | None = None, + content_type_extra: dict[str, str] | None = None, ) -> None: ... class TemporaryUploadedFile(UploadedFile): @@ -26,7 +26,7 @@ class TemporaryUploadedFile(UploadedFile): content_type: str | None, size: int | None, charset: str | None, - content_type_extra: dict[str, str] | None = ..., + content_type_extra: dict[str, str] | None = None, ) -> None: ... def temporary_file_path(self) -> str: ... @@ -40,11 +40,11 @@ class InMemoryUploadedFile(UploadedFile): content_type: str | None, size: int | None, charset: str | None, - content_type_extra: dict[str, str] | None = ..., + content_type_extra: dict[str, str] | None = None, ) -> None: ... - def open(self, mode: str | None = ...) -> Self: ... # type: ignore[override] + def open(self, mode: str | None = None) -> Self: ... # type: ignore[override] class SimpleUploadedFile(InMemoryUploadedFile): - def __init__(self, name: str, content: bytes | None, content_type: str = ...) -> None: ... + def __init__(self, name: str, content: bytes | None, content_type: str = "text/plain") -> None: ... @classmethod def from_dict(cls, file_dict: dict[str, str | bytes]) -> Self: ... diff --git a/django-stubs/core/files/uploadhandler.pyi b/django-stubs/core/files/uploadhandler.pyi index 1135d0215..5dccbecf9 100644 --- a/django-stubs/core/files/uploadhandler.pyi +++ b/django-stubs/core/files/uploadhandler.pyi @@ -10,7 +10,7 @@ class UploadFileException(Exception): ... class StopUpload(UploadFileException): connection_reset: bool - def __init__(self, connection_reset: bool = ...) -> None: ... + def __init__(self, connection_reset: bool = False) -> None: ... class SkipFile(UploadFileException): ... class StopFutureHandlers(UploadFileException): ... @@ -24,14 +24,14 @@ class FileUploadHandler: content_type_extra: dict[str, str] | None request: HttpRequest | None field_name: str - def __init__(self, request: HttpRequest | None = ...) -> None: ... + def __init__(self, request: HttpRequest | None = None) -> None: ... def handle_raw_input( self, input_data: IO[bytes], META: dict[str, str], content_length: int, boundary: str, - encoding: str | None = ..., + encoding: str | None = None, ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ... def new_file( self, @@ -39,8 +39,8 @@ class FileUploadHandler: file_name: str, content_type: str, content_length: int | None, - charset: str | None = ..., - content_type_extra: dict[str, str] | None = ..., + charset: str | None = None, + content_type_extra: dict[str, str] | None = None, ) -> None: ... def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... def file_complete(self, file_size: int) -> UploadedFile | None: ... @@ -71,7 +71,7 @@ class MemoryFileUploadHandler(FileUploadHandler): META: dict[str, str], content_length: int, boundary: str, - encoding: str | None = ..., + encoding: str | None = None, ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ... def new_file( self, diff --git a/django-stubs/core/files/utils.pyi b/django-stubs/core/files/utils.pyi index 5f937cc77..68fd9c769 100644 --- a/django-stubs/core/files/utils.pyi +++ b/django-stubs/core/files/utils.pyi @@ -3,7 +3,7 @@ from typing import IO, Any, AnyStr, Generic from django.utils._os import _PathCompatible -def validate_file_name(name: _PathCompatible, allow_relative_path: bool = ...) -> _PathCompatible: ... +def validate_file_name(name: _PathCompatible, allow_relative_path: bool = False) -> _PathCompatible: ... class FileProxyMixin(Generic[AnyStr]): file: IO[AnyStr] | None diff --git a/django-stubs/core/mail/__init__.pyi b/django-stubs/core/mail/__init__.pyi index f9da39b9a..63de22ae6 100644 --- a/django-stubs/core/mail/__init__.pyi +++ b/django-stubs/core/mail/__init__.pyi @@ -13,38 +13,38 @@ from .message import forbid_multi_line_headers as forbid_multi_line_headers from .utils import DNS_NAME as DNS_NAME from .utils import CachedDnsName as CachedDnsName -def get_connection(backend: str | None = ..., fail_silently: bool = ..., **kwds: Any) -> Any: ... +def get_connection(backend: str | None = None, fail_silently: bool = False, **kwds: Any) -> Any: ... def send_mail( subject: _StrOrPromise, message: _StrOrPromise, from_email: str | None, recipient_list: Sequence[str], - fail_silently: bool = ..., - auth_user: str | None = ..., - auth_password: str | None = ..., - connection: Any | None = ..., - html_message: str | None = ..., + fail_silently: bool = False, + auth_user: str | None = None, + auth_password: str | None = None, + connection: Any | None = None, + html_message: str | None = None, ) -> int: ... def send_mass_mail( datatuple: Iterable[tuple[str, str, str | None, list[str]]], - fail_silently: bool = ..., - auth_user: str | None = ..., - auth_password: str | None = ..., - connection: Any | None = ..., + fail_silently: bool = False, + auth_user: str | None = None, + auth_password: str | None = None, + connection: Any | None = None, ) -> int: ... def mail_admins( subject: _StrOrPromise, message: _StrOrPromise, - fail_silently: bool = ..., - connection: Any | None = ..., - html_message: str | None = ..., + fail_silently: bool = False, + connection: Any | None = None, + html_message: str | None = None, ) -> None: ... def mail_managers( subject: _StrOrPromise, message: _StrOrPromise, - fail_silently: bool = ..., - connection: Any | None = ..., - html_message: str | None = ..., + fail_silently: bool = False, + connection: Any | None = None, + html_message: str | None = None, ) -> None: ... outbox: list[EmailMessage] diff --git a/django-stubs/core/mail/backends/base.pyi b/django-stubs/core/mail/backends/base.pyi index 16eae5c28..a282c4515 100644 --- a/django-stubs/core/mail/backends/base.pyi +++ b/django-stubs/core/mail/backends/base.pyi @@ -7,7 +7,7 @@ from typing_extensions import Self class BaseEmailBackend: fail_silently: bool - def __init__(self, fail_silently: bool = ..., **kwargs: Any) -> None: ... + def __init__(self, fail_silently: bool = False, **kwargs: Any) -> None: ... def open(self) -> bool | None: ... def close(self) -> None: ... def __enter__(self) -> Self: ... diff --git a/django-stubs/core/mail/message.pyi b/django-stubs/core/mail/message.pyi index b530454ca..581b4a1aa 100644 --- a/django-stubs/core/mail/message.pyi +++ b/django-stubs/core/mail/message.pyi @@ -22,23 +22,23 @@ def forbid_multi_line_headers(name: str, val: str, encoding: str) -> tuple[str, def sanitize_address(addr: tuple[str, str] | str, encoding: str) -> str: ... class MIMEMixin: - def as_string(self, unixfrom: bool = ..., linesep: str = ...) -> str: ... - def as_bytes(self, unixfrom: bool = ..., linesep: str = ...) -> bytes: ... + def as_string(self, unixfrom: bool = False, linesep: str = "\n") -> str: ... + def as_bytes(self, unixfrom: bool = False, linesep: str = "\n") -> bytes: ... class SafeMIMEMessage(MIMEMixin, MIMEMessage): ... # type: ignore[misc] class SafeMIMEText(MIMEMixin, MIMEText): # type: ignore[misc] encoding: str - def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ... + def __init__(self, _text: str, _subtype: str = "plain", _charset: str | None = None) -> None: ... class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): # type: ignore[misc] encoding: str def __init__( self, - _subtype: str = ..., - boundary: Any | None = ..., - _subparts: Any | None = ..., - encoding: str = ..., + _subtype: str = "mixed", + boundary: Any | None = None, + _subparts: Any | None = None, + encoding: str | None = None, **_params: Any, ) -> None: ... @@ -63,45 +63,49 @@ class EmailMessage: connection: Any def __init__( self, - subject: _StrOrPromise = ..., - body: _StrOrPromise | None = ..., - from_email: str | None = ..., - to: Sequence[str] | None = ..., - bcc: Sequence[str] | None = ..., - connection: Any | None = ..., - attachments: Sequence[MIMEBase | _AttachmentTuple] | None = ..., - headers: dict[str, str] | None = ..., - cc: Sequence[str] | None = ..., - reply_to: Sequence[str] | None = ..., + subject: _StrOrPromise = "", + body: _StrOrPromise | None = "", + from_email: str | None = None, + to: Sequence[str] | None = None, + bcc: Sequence[str] | None = None, + connection: Any | None = None, + attachments: Sequence[MIMEBase | _AttachmentTuple] | None = None, + headers: dict[str, str] | None = None, + cc: Sequence[str] | None = None, + reply_to: Sequence[str] | None = None, ) -> None: ... - def get_connection(self, fail_silently: bool = ...) -> Any: ... + def get_connection(self, fail_silently: bool = False) -> Any: ... # TODO: when typeshed gets more types for email.Message, move it to MIMEMessage, now it has too many false-positives def message(self) -> Any: ... def recipients(self) -> list[str]: ... - def send(self, fail_silently: bool = ...) -> int: ... + def send(self, fail_silently: bool = False) -> int: ... @overload - def attach(self, filename: MIMEBase = ..., content: None = None, mimetype: None = None) -> None: ... + def attach(self, filename: MIMEBase | None = None, content: None = None, mimetype: None = None) -> None: ... @overload - def attach(self, filename: None = None, content: _AttachmentContent = ..., mimetype: str = ...) -> None: ... + def attach( + self, filename: None = None, content: _AttachmentContent | None = None, mimetype: str | None = None + ) -> None: ... @overload - def attach(self, filename: str = ..., content: _AttachmentContent = ..., mimetype: str | None = ...) -> None: ... - def attach_file(self, path: str, mimetype: str | None = ...) -> None: ... + def attach( + self, filename: str | None = None, content: _AttachmentContent | None = None, mimetype: str | None = None + ) -> None: ... + def attach_file(self, path: str, mimetype: str | None = None) -> None: ... class EmailMultiAlternatives(EmailMessage): alternative_subtype: str alternatives: list[tuple[_AttachmentContent, str]] def __init__( self, - subject: _StrOrPromise = ..., - body: _StrOrPromise | None = ..., - from_email: str | None = ..., - to: Sequence[str] | None = ..., - bcc: Sequence[str] | None = ..., - connection: Any | None = ..., - attachments: Sequence[MIMEBase | _AttachmentTuple] | None = ..., - headers: dict[str, str] | None = ..., - alternatives: list[tuple[_AttachmentContent, str]] | None = ..., - cc: Sequence[str] | None = ..., - reply_to: Sequence[str] | None = ..., + subject: _StrOrPromise = "", + body: _StrOrPromise | None = "", + from_email: str | None = None, + to: Sequence[str] | None = None, + bcc: Sequence[str] | None = None, + connection: Any | None = None, + attachments: Sequence[MIMEBase | _AttachmentTuple] | None = None, + headers: dict[str, str] | None = None, + alternatives: list[tuple[_AttachmentContent, str]] | None = None, + cc: Sequence[str] | None = None, + reply_to: Sequence[str] | None = None, ) -> None: ... def attach_alternative(self, content: _AttachmentContent, mimetype: str) -> None: ... diff --git a/django-stubs/core/management/__init__.pyi b/django-stubs/core/management/__init__.pyi index ad954d4ec..297019b6c 100644 --- a/django-stubs/core/management/__init__.pyi +++ b/django-stubs/core/management/__init__.pyi @@ -14,10 +14,10 @@ class ManagementUtility: argv: list[str] prog_name: str settings_exception: Exception | None - def __init__(self, argv: list[str] | None = ...) -> None: ... - def main_help_text(self, commands_only: bool = ...) -> str: ... + def __init__(self, argv: list[str] | None = None) -> None: ... + def main_help_text(self, commands_only: bool = False) -> str: ... def fetch_command(self, subcommand: str) -> BaseCommand: ... def autocomplete(self) -> None: ... def execute(self) -> None: ... -def execute_from_command_line(argv: list[str] | None = ...) -> None: ... +def execute_from_command_line(argv: list[str] | None = None) -> None: ... diff --git a/django-stubs/core/management/base.pyi b/django-stubs/core/management/base.pyi index cd19e04a5..c65d0dbb0 100644 --- a/django-stubs/core/management/base.pyi +++ b/django-stubs/core/management/base.pyi @@ -11,7 +11,7 @@ ALL_CHECKS: Literal["__all__"] class CommandError(Exception): returncode: int - def __init__(self, *args: Any, returncode: int = ..., **kwargs: Any) -> None: ... + def __init__(self, *args: Any, returncode: int = 1, **kwargs: Any) -> None: ... class SystemCheckError(CommandError): ... @@ -19,7 +19,7 @@ class CommandParser(ArgumentParser): missing_args_message: str | None called_from_command_line: bool | None def __init__( - self, *, missing_args_message: str | None = ..., called_from_command_line: bool | None = ..., **kwargs: Any + self, *, missing_args_message: str | None = None, called_from_command_line: bool | None = None, **kwargs: Any ) -> None: ... def error(self, message: str) -> Any: ... @@ -37,12 +37,12 @@ class OutputWrapper(TextIOBase): @style_func.setter def style_func(self, style_func: Callable[[str], str] | None) -> None: ... ending: str - def __init__(self, out: TextIO, ending: str = ...) -> None: ... + def __init__(self, out: TextIO, ending: str = "\n") -> None: ... def __getattr__(self, name: str) -> Callable: ... def flush(self) -> None: ... def isatty(self) -> bool: ... def write( # type: ignore[override] - self, msg: str = ..., style_func: Callable[[str], str] | None = ..., ending: str | None = ... + self, msg: str = "", style_func: Callable[[str], str] | None = None, ending: str | None = None ) -> None: ... class BaseCommand: @@ -58,10 +58,10 @@ class BaseCommand: style: Style def __init__( self, - stdout: TextIO | None = ..., - stderr: TextIO | None = ..., - no_color: bool = ..., - force_color: bool = ..., + stdout: TextIO | None = None, + stderr: TextIO | None = None, + no_color: bool = False, + force_color: bool = False, ) -> None: ... def get_version(self) -> str: ... def create_parser(self, prog_name: str, subcommand: str, **kwargs: Any) -> CommandParser: ... @@ -72,12 +72,12 @@ class BaseCommand: def execute(self, *args: Any, **options: Any) -> str | None: ... def check( self, - app_configs: Sequence[AppConfig] | None = ..., - tags: Sequence[str] | None = ..., - display_num_errors: bool = ..., - include_deployment_checks: bool = ..., - fail_level: int = ..., - databases: Sequence[str] | None = ..., + app_configs: Sequence[AppConfig] | None = None, + tags: Sequence[str] | None = None, + display_num_errors: bool = False, + include_deployment_checks: bool = False, + fail_level: int = 40, + databases: Sequence[str] | None = None, ) -> None: ... def check_migrations(self) -> None: ... def handle(self, *args: Any, **options: Any) -> str | None: ... diff --git a/django-stubs/core/management/color.pyi b/django-stubs/core/management/color.pyi index 55383b1e8..9fd033c42 100644 --- a/django-stubs/core/management/color.pyi +++ b/django-stubs/core/management/color.pyi @@ -23,6 +23,6 @@ class Style: def MIGRATE_LABEL(self, text: str) -> str: ... def ERROR_OUTPUT(self, text: str) -> str: ... -def make_style(config_string: str = ...) -> Style: ... +def make_style(config_string: str = "") -> Style: ... def no_style() -> Style: ... -def color_style(force_color: bool = ...) -> Style: ... +def color_style(force_color: bool = False) -> Style: ... diff --git a/django-stubs/core/management/commands/makemigrations.pyi b/django-stubs/core/management/commands/makemigrations.pyi index d144d24a8..fc6a8432c 100644 --- a/django-stubs/core/management/commands/makemigrations.pyi +++ b/django-stubs/core/management/commands/makemigrations.pyi @@ -18,7 +18,7 @@ class Command(BaseCommand): def log(self, msg: str) -> None: ... def write_to_last_migration_files(self, changes: dict[str, Any]) -> None: ... def write_migration_files( - self, changes: dict[str, Any], update_previous_migration_paths: dict[str, str] | None = ... + self, changes: dict[str, Any], update_previous_migration_paths: dict[str, str] | None = None ) -> None: ... @staticmethod def get_relative_path(path: str) -> str: ... diff --git a/django-stubs/core/management/commands/migrate.pyi b/django-stubs/core/management/commands/migrate.pyi index b8b88b5c9..7b82595af 100644 --- a/django-stubs/core/management/commands/migrate.pyi +++ b/django-stubs/core/management/commands/migrate.pyi @@ -9,7 +9,7 @@ class Command(BaseCommand): verbosity: int interactive: bool start: float - def migration_progress_callback(self, action: str, migration: Any | None = ..., fake: bool = ...) -> None: ... + def migration_progress_callback(self, action: str, migration: Any | None = None, fake: bool = False) -> None: ... def sync_apps(self, connection: BaseDatabaseWrapper, app_labels: Container[str]) -> None: ... @staticmethod def describe_operation(operation: Operation, backwards: bool) -> tuple[str, bool]: ... diff --git a/django-stubs/core/management/commands/showmigrations.pyi b/django-stubs/core/management/commands/showmigrations.pyi index 384d156e5..7162edd51 100644 --- a/django-stubs/core/management/commands/showmigrations.pyi +++ b/django-stubs/core/management/commands/showmigrations.pyi @@ -3,5 +3,5 @@ from django.db.backends.base.base import BaseDatabaseWrapper class Command(BaseCommand): verbosity: int - def show_list(self, connection: BaseDatabaseWrapper, app_names: list[str] | None = ...) -> None: ... - def show_plan(self, connection: BaseDatabaseWrapper, app_names: list[str] | None = ...) -> None: ... + def show_list(self, connection: BaseDatabaseWrapper, app_names: list[str] | None = None) -> None: ... + def show_plan(self, connection: BaseDatabaseWrapper, app_names: list[str] | None = None) -> None: ... diff --git a/django-stubs/core/management/sql.pyi b/django-stubs/core/management/sql.pyi index e2ca2eb60..a14f83a9f 100644 --- a/django-stubs/core/management/sql.pyi +++ b/django-stubs/core/management/sql.pyi @@ -6,8 +6,8 @@ from django.db.backends.base.base import BaseDatabaseWrapper def sql_flush( style: Style, connection: BaseDatabaseWrapper, - reset_sequences: bool = ..., - allow_cascade: bool = ..., + reset_sequences: bool = True, + allow_cascade: bool = False, ) -> list[str]: ... def emit_pre_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs: Any) -> None: ... def emit_post_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs: Any) -> None: ... diff --git a/django-stubs/core/management/utils.pyi b/django-stubs/core/management/utils.pyi index e121fcd16..578c58c65 100644 --- a/django-stubs/core/management/utils.pyi +++ b/django-stubs/core/management/utils.pyi @@ -5,12 +5,12 @@ from _typeshed import StrOrBytesPath, StrPath from django.apps.config import AppConfig from django.db.models.base import Model -def popen_wrapper(args: list[str], stdout_encoding: str = ...) -> tuple[str, str, int]: ... +def popen_wrapper(args: list[str], stdout_encoding: str = "utf-8") -> tuple[str, str, int]: ... def handle_extensions(extensions: Iterable[str]) -> set[str]: ... def find_command( cmd: str, - path: str | Iterable[str] | None = ..., - pathext: str | Iterable[str] | None = ..., + path: str | Iterable[str] | None = None, + pathext: str | Iterable[str] | None = None, ) -> str | None: ... def get_random_secret_key() -> str: ... def parse_apps_and_model_labels(labels: Iterable[str]) -> tuple[set[type[Model]], set[AppConfig]]: ... diff --git a/django-stubs/core/paginator.pyi b/django-stubs/core/paginator.pyi index 752865c32..be57dad72 100644 --- a/django-stubs/core/paginator.pyi +++ b/django-stubs/core/paginator.pyi @@ -30,9 +30,9 @@ class Paginator(Generic[_T]): self, object_list: _SupportsPagination[_T], per_page: int | str, - orphans: int = ..., - allow_empty_first_page: bool = ..., - error_messages: _ErrorMessagesDict | None = ..., + orphans: int = 0, + allow_empty_first_page: bool = True, + error_messages: _ErrorMessagesDict | None = None, ) -> None: ... def __iter__(self) -> Iterator[Page[_T]]: ... def validate_number(self, number: int | float | str) -> int: ... @@ -45,7 +45,7 @@ class Paginator(Generic[_T]): @property def page_range(self) -> range: ... def get_elided_page_range( - self, number: int | float | str = ..., *, on_each_side: int = ..., on_ends: int = ... + self, number: int | float | str = 1, *, on_each_side: int = 3, on_ends: int = 2 ) -> Iterator[str | int]: ... class Page(Sequence[_T]): diff --git a/django-stubs/core/serializers/__init__.pyi b/django-stubs/core/serializers/__init__.pyi index aa3bc4b0c..f8db005c4 100644 --- a/django-stubs/core/serializers/__init__.pyi +++ b/django-stubs/core/serializers/__init__.pyi @@ -14,7 +14,7 @@ class BadSerializer: def __init__(self, exception: BaseException) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... -def register_serializer(format: str, serializer_module: str, serializers: dict[str, Any] | None = ...) -> None: ... +def register_serializer(format: str, serializer_module: str, serializers: dict[str, Any] | None = None) -> None: ... def unregister_serializer(format: str) -> None: ... def get_serializer(format: str) -> type[Serializer] | BadSerializer: ... def get_serializer_formats() -> list[str]: ... @@ -22,4 +22,4 @@ def get_public_serializer_formats() -> list[str]: ... def get_deserializer(format: str) -> Callable | type[Deserializer]: ... def serialize(format: str, queryset: Iterable[Model], **options: Any) -> Any: ... def deserialize(format: str, stream_or_string: Any, **options: Any) -> Iterator[DeserializedObject]: ... -def sort_dependencies(app_list: Iterable[Any], allow_cycles: bool = ...) -> list[type[Model]]: ... +def sort_dependencies(app_list: Iterable[Any], allow_cycles: bool = False) -> list[type[Model]]: ... diff --git a/django-stubs/core/serializers/base.pyi b/django-stubs/core/serializers/base.pyi index 715400206..ecc3e167b 100644 --- a/django-stubs/core/serializers/base.pyi +++ b/django-stubs/core/serializers/base.pyi @@ -43,12 +43,12 @@ class Serializer: self, queryset: Iterable[Model], *, - stream: IO[str] | None = ..., - fields: Collection[str] | None = ..., - use_natural_foreign_keys: bool = ..., - use_natural_primary_keys: bool = ..., - progress_output: IO[str] | None = ..., - object_count: int = ..., + stream: IO[str] | None = None, + fields: Collection[str] | None = None, + use_natural_foreign_keys: bool = False, + use_natural_primary_keys: bool = False, + progress_output: IO[str] | None = None, + object_count: int = 0, **options: Any, ) -> Any: ... def start_serialization(self) -> None: ... @@ -74,11 +74,11 @@ class DeserializedObject: def __init__( self, obj: Model, - m2m_data: dict[str, Sequence[Any]] | None = ..., - deferred_fields: dict[Field, Any] | None = ..., + m2m_data: dict[str, Sequence[Any]] | None = None, + deferred_fields: dict[Field, Any] | None = None, ) -> None: ... - def save(self, save_m2m: bool = ..., using: str | None = ..., **kwargs: Any) -> None: ... - def save_deferred_fields(self, using: str | None = ...) -> None: ... + def save(self, save_m2m: bool = True, using: str | None = None, **kwargs: Any) -> None: ... + def save_deferred_fields(self, using: str | None = None) -> None: ... def build_instance(Model: type[Model], data: dict[str, Any], db: str) -> Model: ... def deserialize_m2m_values( diff --git a/django-stubs/core/serializers/python.pyi b/django-stubs/core/serializers/python.pyi index c25c910ed..c7a106cd6 100644 --- a/django-stubs/core/serializers/python.pyi +++ b/django-stubs/core/serializers/python.pyi @@ -10,5 +10,5 @@ class Serializer(base.Serializer): def get_dump_object(self, obj: Model) -> dict[str, Any]: ... def Deserializer( - object_list: list[dict[str, Any]], *, using: str = ..., ignorenonexistent: bool = ..., **options: Any + object_list: list[dict[str, Any]], *, using: str = "default", ignorenonexistent: bool = False, **options: Any ) -> Iterator[DeserializedObject]: ... diff --git a/django-stubs/core/signing.pyi b/django-stubs/core/signing.pyi index 494437d6e..2b5fa75fa 100644 --- a/django-stubs/core/signing.pyi +++ b/django-stubs/core/signing.pyi @@ -12,8 +12,8 @@ def b62_encode(s: int) -> str: ... def b62_decode(s: str) -> int: ... def b64_encode(s: bytes) -> bytes: ... def b64_decode(s: bytes) -> bytes: ... -def base64_hmac(salt: bytes | str, value: bytes | str, key: bytes | str, algorithm: str = ...) -> str: ... -def get_cookie_signer(salt: str = ...) -> TimestampSigner: ... +def base64_hmac(salt: bytes | str, value: bytes | str, key: bytes | str, algorithm: str = "sha1") -> str: ... +def get_cookie_signer(salt: str = "django.core.signing.get_cookie_signer") -> TimestampSigner: ... @type_check_only class Serializer(Protocol): def dumps(self, obj: Any) -> bytes: ... @@ -25,18 +25,18 @@ class JSONSerializer: def dumps( obj: Any, - key: bytes | str | None = ..., - salt: bytes | str = ..., + key: bytes | str | None = None, + salt: bytes | str = "django.core.signing", serializer: type[Serializer] = ..., - compress: bool = ..., + compress: bool = False, ) -> str: ... def loads( s: str, - key: bytes | str | None = ..., - salt: bytes | str = ..., + key: bytes | str | None = None, + salt: bytes | str = "django.core.signing", serializer: type[Serializer] = ..., - max_age: int | timedelta | None = ..., - fallback_keys: list[str | bytes] | None = ..., + max_age: int | timedelta | None = None, + fallback_keys: list[str | bytes] | None = None, ) -> Any: ... class Signer: @@ -49,31 +49,31 @@ class Signer: def __init__( self, *, - key: bytes | str | None = ..., - sep: str = ..., - salt: bytes | str | None = ..., - algorithm: str | None = ..., - fallback_keys: list[bytes | str] | None = ..., + key: bytes | str | None = None, + sep: str = ":", + salt: bytes | str | None = None, + algorithm: str | None = None, + fallback_keys: list[bytes | str] | None = None, ) -> None: ... @overload @deprecated("Passing positional arguments to Signer is deprecated and will be removed in Django 5.1") def __init__( self, *args: Any, - key: bytes | str | None = ..., - sep: str = ..., - salt: bytes | str | None = ..., - algorithm: str | None = ..., - fallback_keys: list[bytes | str] | None = ..., + key: bytes | str | None = None, + sep: str = ":", + salt: bytes | str | None = None, + algorithm: str | None = None, + fallback_keys: list[bytes | str] | None = None, ) -> None: ... - def signature(self, value: bytes | str, key: bytes | str | None = ...) -> str: ... + def signature(self, value: bytes | str, key: bytes | str | None = None) -> str: ... def sign(self, value: str) -> str: ... def unsign(self, signed_value: str) -> str: ... def sign_object( self, obj: Any, serializer: type[Serializer] = ..., - compress: bool = ..., + compress: bool = False, ) -> str: ... def unsign_object( self, @@ -85,4 +85,4 @@ class Signer: class TimestampSigner(Signer): def timestamp(self) -> str: ... def sign(self, value: str) -> str: ... - def unsign(self, value: str, max_age: int | timedelta | None = ...) -> str: ... + def unsign(self, value: str, max_age: int | timedelta | None = None) -> str: ... diff --git a/django-stubs/core/validators.pyi b/django-stubs/core/validators.pyi index 586fbfd52..cbe29a1b0 100644 --- a/django-stubs/core/validators.pyi +++ b/django-stubs/core/validators.pyi @@ -22,11 +22,11 @@ class RegexValidator(_Deconstructible): flags: int def __init__( self, - regex: _Regex | None = ..., - message: _StrOrPromise | None = ..., - code: str | None = ..., - inverse_match: bool | None = ..., - flags: RegexFlag | None = ..., + regex: _Regex | None = None, + message: _StrOrPromise | None = None, + code: str | None = None, + inverse_match: bool | None = None, + flags: RegexFlag | None = None, ) -> None: ... def __call__(self, value: Any) -> None: ... @@ -41,7 +41,7 @@ class URLValidator(RegexValidator): schemes: Sequence[str] unsafe_chars: frozenset[str] max_length: int - def __init__(self, schemes: Sequence[str] | None = ..., **kwargs: Any) -> None: ... + def __init__(self, schemes: Sequence[str] | None = None, **kwargs: Any) -> None: ... def __call__(self, value: Any) -> None: ... integer_validator: RegexValidator @@ -57,9 +57,9 @@ class EmailValidator(_Deconstructible): domain_allowlist: Sequence[str] def __init__( self, - message: _StrOrPromise | None = ..., - code: str | None = ..., - allowlist: Sequence[str] | None = ..., + message: _StrOrPromise | None = None, + code: str | None = None, + allowlist: Sequence[str] | None = None, ) -> None: ... def __call__(self, value: str | None) -> None: ... def validate_domain_part(self, domain_part: str) -> bool: ... @@ -80,7 +80,7 @@ ip_address_validator_map: dict[str, _IPValidator] def ip_address_validators(protocol: str, unpack_ipv4: bool) -> _IPValidator: ... def int_list_validator( - sep: str = ..., message: _StrOrPromise | None = ..., code: str = ..., allow_negative: bool = ... + sep: str = ",", message: _StrOrPromise | None = None, code: str = "invalid", allow_negative: bool = False ) -> RegexValidator: ... validate_comma_separated_integer_list: RegexValidator @@ -89,7 +89,7 @@ class BaseValidator(_Deconstructible): message: _StrOrPromise code: str limit_value: Any - def __init__(self, limit_value: Any | Callable[[], Any], message: _StrOrPromise | None = ...) -> None: ... + def __init__(self, limit_value: Any | Callable[[], Any], message: _StrOrPromise | None = None) -> None: ... def __call__(self, value: Any) -> None: ... def compare(self, a: Any, b: Any) -> bool: ... def clean(self, x: Any) -> Any: ... @@ -101,7 +101,7 @@ class MinValueValidator(BaseValidator): ... class StepValueValidator(BaseValidator): offset: int | None def __init__( - self, limit_value: Any | Callable[[], Any], message: _StrOrPromise | None = ..., offset: int | None = ... + self, limit_value: Any | Callable[[], Any], message: _StrOrPromise | None = None, offset: int | None = None ) -> None: ... class MinLengthValidator(BaseValidator): @@ -124,9 +124,9 @@ class FileExtensionValidator(_Deconstructible): allowed_extensions: Collection[str] | None def __init__( self, - allowed_extensions: Collection[str] | None = ..., - message: _StrOrPromise | None = ..., - code: str | None = ..., + allowed_extensions: Collection[str] | None = None, + message: _StrOrPromise | None = None, + code: str | None = None, ) -> None: ... def __call__(self, value: File) -> None: ... @@ -136,5 +136,5 @@ def validate_image_file_extension(value: File) -> None: ... class ProhibitNullCharactersValidator(_Deconstructible): message: _StrOrPromise code: str - def __init__(self, message: _StrOrPromise | None = ..., code: str | None = ...) -> None: ... + def __init__(self, message: _StrOrPromise | None = None, code: str | None = None) -> None: ... def __call__(self, value: Any) -> None: ... diff --git a/django-stubs/db/backends/base/base.pyi b/django-stubs/db/backends/base/base.pyi index dbe86cd73..0626d1949 100644 --- a/django-stubs/db/backends/base/base.pyi +++ b/django-stubs/db/backends/base/base.pyi @@ -64,7 +64,7 @@ class BaseDatabaseWrapper: validation: BaseDatabaseValidation operators: MutableMapping[str, str] atomic_blocks: list[Atomic] - def __init__(self, settings_dict: dict[str, Any], alias: str = ...) -> None: ... + def __init__(self, settings_dict: dict[str, Any], alias: str = "default") -> None: ... def ensure_timezone(self) -> bool: ... @cached_property def timezone(self) -> tzinfo | None: ... @@ -79,7 +79,7 @@ class BaseDatabaseWrapper: def get_connection_params(self) -> dict[str, Any]: ... def get_new_connection(self, conn_params: Any) -> Any: ... def init_connection_state(self) -> None: ... - def create_cursor(self, name: Any | None = ...) -> Any: ... + def create_cursor(self, name: Any | None = None) -> Any: ... def connect(self) -> None: ... def check_settings(self) -> None: ... def ensure_connection(self) -> None: ... @@ -92,7 +92,9 @@ class BaseDatabaseWrapper: def savepoint_commit(self, sid: str) -> None: ... def clean_savepoints(self) -> None: ... def get_autocommit(self) -> bool: ... - def set_autocommit(self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = ...) -> None: ... + def set_autocommit( + self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = False + ) -> None: ... def get_rollback(self) -> bool: ... def set_rollback(self, rollback: bool) -> None: ... def validate_no_atomic_block(self) -> None: ... @@ -101,7 +103,7 @@ class BaseDatabaseWrapper: def constraint_checks_disabled(self) -> Iterator[None]: ... def disable_constraint_checking(self) -> bool: ... def enable_constraint_checking(self) -> None: ... - def check_constraints(self, table_names: Any | None = ...) -> None: ... + def check_constraints(self, table_names: Any | None = None) -> None: ... def is_usable(self) -> bool: ... def close_if_health_check_failed(self) -> None: ... def close_if_unusable_or_obsolete(self) -> None: ... @@ -121,8 +123,8 @@ class BaseDatabaseWrapper: @contextmanager def _nodb_cursor(self) -> Generator[CursorWrapper, None, None]: ... def schema_editor(self, *args: Any, **kwargs: Any) -> BaseDatabaseSchemaEditor: ... - def on_commit(self, func: Callable[[], object], robust: bool = ...) -> None: ... + def on_commit(self, func: Callable[[], object], robust: bool = False) -> None: ... def run_and_clear_commit_hooks(self) -> None: ... @contextmanager def execute_wrapper(self, wrapper: _ExecuteWrapper) -> Generator[None, None, None]: ... - def copy(self, alias: str | None = ...) -> Self: ... + def copy(self, alias: str | None = None) -> Self: ... diff --git a/django-stubs/db/backends/base/creation.pyi b/django-stubs/db/backends/base/creation.pyi index 94d089661..3203de77f 100644 --- a/django-stubs/db/backends/base/creation.pyi +++ b/django-stubs/db/backends/base/creation.pyi @@ -9,19 +9,21 @@ class BaseDatabaseCreation: def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def log(self, msg: str) -> None: ... def create_test_db( - self, verbosity: int = ..., autoclobber: bool = ..., serialize: bool = ..., keepdb: bool = ... + self, verbosity: int = 1, autoclobber: bool = False, serialize: bool = True, keepdb: bool = False ) -> str: ... def set_as_test_mirror(self, primary_settings_dict: dict[str, dict[str, None] | int | str | None]) -> None: ... def serialize_db_to_string(self) -> str: ... def deserialize_db_from_string(self, data: str) -> None: ... - def clone_test_db(self, suffix: Any, verbosity: int = ..., autoclobber: bool = ..., keepdb: bool = ...) -> None: ... + def clone_test_db( + self, suffix: Any, verbosity: int = 1, autoclobber: bool = False, keepdb: bool = False + ) -> None: ... def get_test_db_clone_settings(self, suffix: str) -> dict[str, Any]: ... def destroy_test_db( self, - old_database_name: str | None = ..., - verbosity: int = ..., - keepdb: bool = ..., - suffix: str | None = ..., + old_database_name: str | None = None, + verbosity: int = 1, + keepdb: bool = False, + suffix: str | None = None, ) -> None: ... def mark_expected_failures_and_skips(self) -> None: ... def sql_table_creation_suffix(self) -> str: ... diff --git a/django-stubs/db/backends/base/introspection.pyi b/django-stubs/db/backends/base/introspection.pyi index ea8096b9d..a7040840b 100644 --- a/django-stubs/db/backends/base/introspection.pyi +++ b/django-stubs/db/backends/base/introspection.pyi @@ -19,14 +19,14 @@ class BaseDatabaseIntrospection: def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def get_field_type(self, data_type: str, description: FieldInfo) -> str: ... def identifier_converter(self, name: str) -> str: ... - def table_names(self, cursor: CursorWrapper | None = ..., include_views: bool = ...) -> list[str]: ... + def table_names(self, cursor: CursorWrapper | None = None, include_views: bool = False) -> list[str]: ... def get_table_list(self, cursor: CursorWrapper | None) -> Any: ... def get_table_description(self, cursor: CursorWrapper | None, table_name: str) -> Any: ... def get_migratable_models(self) -> Iterable[type[Model]]: ... - def django_table_names(self, only_existing: bool = ..., include_views: bool = ...) -> list[str]: ... + def django_table_names(self, only_existing: bool = False, include_views: bool = True) -> list[str]: ... def installed_models(self, tables: list[str]) -> set[type[Model]]: ... def sequence_list(self) -> list[dict[str, str]]: ... - def get_sequences(self, cursor: CursorWrapper | None, table_name: str, table_fields: Any = ...) -> Any: ... + def get_sequences(self, cursor: CursorWrapper | None, table_name: str, table_fields: Any = ()) -> Any: ... def get_relations(self, cursor: CursorWrapper | None, table_name: str) -> dict[str, tuple[str, str]]: ... def get_primary_key_column(self, cursor: CursorWrapper | None, table_name: str) -> str | None: ... def get_primary_key_columns(self, cursor: CursorWrapper | None, table_name: str) -> list[str] | None: ... diff --git a/django-stubs/db/backends/base/operations.pyi b/django-stubs/db/backends/base/operations.pyi index ac3a1981b..c07186645 100644 --- a/django-stubs/db/backends/base/operations.pyi +++ b/django-stubs/db/backends/base/operations.pyi @@ -34,23 +34,25 @@ class BaseDatabaseOperations: def unification_cast_sql(self, output_field: Field) -> str: ... def date_extract_sql(self, lookup_type: str, sql: Any, params: Any) -> tuple[str, Any]: ... # def date_interval_sql(self, timedelta: None) -> Any: ... - def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = ...) -> tuple[str, Any]: ... + def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> tuple[str, Any]: ... def datetime_cast_date_sql(self, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... def datetime_cast_time_sql(self, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... def datetime_extract_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... def datetime_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> str: ... - def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = ...) -> str: ... + def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> str: ... def time_extract_sql(self, lookup_type: str, sql: str, params: Any) -> str: ... def deferrable_sql(self) -> str: ... def distinct_sql(self, fields: list[str], params: list[Any] | None) -> tuple[list[str], list[str]]: ... def fetch_returned_insert_columns(self, cursor: Any, returning_params: Any) -> Any: ... def field_cast_sql(self, db_type: str | None, internal_type: str) -> str: ... def force_no_ordering(self) -> list[Any]: ... - def for_update_sql(self, nowait: bool = ..., skip_locked: bool = ..., of: Any = ..., no_key: bool = ...) -> str: ... + def for_update_sql( + self, nowait: bool = False, skip_locked: bool = False, of: Any = (), no_key: bool = False + ) -> str: ... def limit_offset_sql(self, low_mark: int, high_mark: int | None) -> str: ... def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> str: ... def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ... - def lookup_cast(self, lookup_type: str, internal_type: str | None = ...) -> str: ... + def lookup_cast(self, lookup_type: str, internal_type: str | None = None) -> str: ... def max_in_list_size(self) -> int | None: ... def max_name_length(self) -> int | None: ... def no_limit_value(self) -> str | None: ... @@ -66,14 +68,14 @@ class BaseDatabaseOperations: def savepoint_rollback_sql(self, sid: str) -> str: ... def set_time_zone_sql(self) -> str: ... def sql_flush( - self, style: Any, tables: Sequence[str], *, reset_sequences: bool = ..., allow_cascade: bool = ... + self, style: Any, tables: Sequence[str], *, reset_sequences: bool = False, allow_cascade: bool = False ) -> list[str]: ... def execute_sql_flush(self, sql_list: Iterable[str]) -> None: ... def sequence_reset_by_name_sql(self, style: Style | None, sequences: list[Any]) -> list[Any]: ... def sequence_reset_sql(self, style: Style, model_list: Sequence[type[Model]]) -> list[Any]: ... def start_transaction_sql(self) -> str: ... - def end_transaction_sql(self, success: bool = ...) -> str: ... - def tablespace_sql(self, tablespace: str | None, inline: bool = ...) -> str: ... + def end_transaction_sql(self, success: bool = True) -> str: ... + def tablespace_sql(self, tablespace: str | None, inline: bool = False) -> str: ... def prep_for_like_query(self, x: str) -> str: ... prep_for_iexact_query: Any def validate_autopk_value(self, value: int) -> int: ... @@ -82,13 +84,13 @@ class BaseDatabaseOperations: def adapt_datetimefield_value(self, value: real_datetime | None) -> str | None: ... def adapt_timefield_value(self, value: real_datetime | time | None) -> str | None: ... def adapt_decimalfield_value( - self, value: Decimal | None, max_digits: int | None = ..., decimal_places: int | None = ... + self, value: Decimal | None, max_digits: int | None = None, decimal_places: int | None = None ) -> str | None: ... def adapt_ipaddressfield_value(self, value: str | None) -> str | None: ... def adapt_json_value(self, value: Any, encoder: type[json.JSONEncoder] | None) -> str: ... def adapt_integerfield_value(self, value: Any, internal_type: Any) -> Any: ... - def year_lookup_bounds_for_date_field(self, value: int, iso_year: bool = ...) -> list[str]: ... - def year_lookup_bounds_for_datetime_field(self, value: int, iso_year: bool = ...) -> list[str]: ... + def year_lookup_bounds_for_date_field(self, value: int, iso_year: bool = False) -> list[str]: ... + def year_lookup_bounds_for_datetime_field(self, value: int, iso_year: bool = False) -> list[str]: ... def get_db_converters(self, expression: Expression) -> list[Any]: ... def convert_durationfield_value( self, value: float | None, expression: Expression, connection: BaseDatabaseWrapper @@ -103,10 +105,10 @@ class BaseDatabaseOperations: def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> tuple[str, tuple[Any, ...]]: ... def window_frame_start(self, start: Any) -> str: ... def window_frame_end(self, end: Any) -> str: ... - def window_frame_rows_start_end(self, start: int | None = ..., end: int | None = ...) -> tuple[str, str]: ... - def window_frame_range_start_end(self, start: int | None = ..., end: int | None = ...) -> tuple[str, str]: ... - def explain_query_prefix(self, format: str | None = ..., **options: Any) -> str: ... - def insert_statement(self, on_conflict: OnConflict | None = ...) -> str: ... + def window_frame_rows_start_end(self, start: int | None = None, end: int | None = None) -> tuple[str, str]: ... + def window_frame_range_start_end(self, start: int | None = None, end: int | None = None) -> tuple[str, str]: ... + def explain_query_prefix(self, format: str | None = None, **options: Any) -> str: ... + def insert_statement(self, on_conflict: OnConflict | None = None) -> str: ... def on_conflict_suffix_sql( self, fields: Any, on_conflict: Any, update_fields: Any, unique_fields: Any ) -> str | Any: ... diff --git a/django-stubs/db/backends/base/schema.pyi b/django-stubs/db/backends/base/schema.pyi index c9db75875..118920f3b 100644 --- a/django-stubs/db/backends/base/schema.pyi +++ b/django-stubs/db/backends/base/schema.pyi @@ -58,7 +58,7 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]): collect_sql: bool collected_sql: Any atomic_migration: Any - def __init__(self, connection: BaseDatabaseWrapper, collect_sql: bool = ..., atomic: bool = ...) -> None: ... + def __init__(self, connection: BaseDatabaseWrapper, collect_sql: bool = False, atomic: bool = True) -> None: ... deferred_sql: Any atomic: Any def __enter__(self) -> Self: ... @@ -68,11 +68,11 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]): exc_value: BaseException | None, exc_tb: TracebackType | None, ) -> None: ... - def execute(self, sql: Statement | str, params: Sequence[Any] | None = ...) -> None: ... + def execute(self, sql: Statement | str, params: Sequence[Any] | None = ()) -> None: ... def quote_name(self, name: str) -> str: ... def table_sql(self, model: type[Model]) -> tuple[str, list[Any]]: ... def column_sql( - self, model: type[Model], field: Field, include_default: bool = ... + self, model: type[Model], field: Field, include_default: bool = False ) -> tuple[None, None] | tuple[str, list[Any]]: ... def skip_default(self, field: Field) -> bool: ... def skip_default_on_alter(self, field: Field) -> bool: ... @@ -106,5 +106,5 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]): def alter_db_tablespace(self, model: type[Model], old_db_tablespace: str, new_db_tablespace: str) -> None: ... def add_field(self, model: type[Model], field: Field) -> None: ... def remove_field(self, model: type[Model], field: Field) -> None: ... - def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ... - def remove_procedure(self, procedure_name: Any, param_types: Any = ...) -> None: ... + def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = False) -> None: ... + def remove_procedure(self, procedure_name: Any, param_types: Any = ()) -> None: ... diff --git a/django-stubs/db/backends/ddl_references.pyi b/django-stubs/db/backends/ddl_references.pyi index c4bfa6655..d122b2151 100644 --- a/django-stubs/db/backends/ddl_references.pyi +++ b/django-stubs/db/backends/ddl_references.pyi @@ -33,7 +33,7 @@ class Columns(TableColumns): quote_name: _QuoteCallable col_suffixes: Sequence[str] def __init__( - self, table: str, columns: list[str], quote_name: _QuoteCallable, col_suffixes: Sequence[str] = ... + self, table: str, columns: list[str], quote_name: _QuoteCallable, col_suffixes: Sequence[str] = () ) -> None: ... @type_check_only @@ -52,7 +52,7 @@ class IndexName(TableColumns): class IndexColumns(Columns): opclasses: Any def __init__( - self, table: Any, columns: Any, quote_name: Any, col_suffixes: Any = ..., opclasses: Any = ... + self, table: Any, columns: Any, quote_name: Any, col_suffixes: Any = (), opclasses: Any = () ) -> None: ... class ForeignKeyName(TableColumns): diff --git a/django-stubs/db/backends/mysql/operations.pyi b/django-stubs/db/backends/mysql/operations.pyi index 7c330c9ad..195af2b69 100644 --- a/django-stubs/db/backends/mysql/operations.pyi +++ b/django-stubs/db/backends/mysql/operations.pyi @@ -12,12 +12,12 @@ class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length: str explain_prefix: str def date_extract_sql(self, lookup_type: str, sql: str, params: Any) -> tuple[str, Any]: ... - def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = ...) -> Any: ... + def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> Any: ... def datetime_cast_date_sql(self, sql: str, params: Any, tzname: str | None) -> Any: ... def datetime_cast_time_sql(self, sql: str, params: Any, tzname: str | None) -> Any: ... def datetime_extract_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> Any: ... def datetime_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> Any: ... - def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = ...) -> Any: ... + def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> Any: ... def fetch_returned_insert_rows(self, cursor: Any) -> Any: ... def format_for_duration_arithmetic(self, sql: Any) -> Any: ... def force_no_ordering(self) -> Any: ... @@ -38,7 +38,7 @@ class DatabaseOperations(BaseDatabaseOperations): def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... def binary_placeholder_sql(self, value: Any) -> Any: ... def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... - def explain_query_prefix(self, format: Any | None = ..., **options: Any) -> Any: ... + def explain_query_prefix(self, format: Any | None = None, **options: Any) -> Any: ... def regex_lookup(self, lookup_type: str) -> Any: ... - def insert_statement(self, on_conflict: OnConflict | None = ...) -> str: ... - def lookup_cast(self, lookup_type: str, internal_type: Any | None = ...) -> Any: ... + def insert_statement(self, on_conflict: OnConflict | None = None) -> str: ... + def lookup_cast(self, lookup_type: str, internal_type: Any | None = None) -> Any: ... diff --git a/django-stubs/db/backends/oracle/base.pyi b/django-stubs/db/backends/oracle/base.pyi index 0ed0d0c5c..0d80f93c5 100644 --- a/django-stubs/db/backends/oracle/base.pyi +++ b/django-stubs/db/backends/oracle/base.pyi @@ -15,7 +15,7 @@ from .validation import DatabaseValidation def wrap_oracle_errors() -> Generator[None, None, None]: ... class _UninitializedOperatorsDescriptor: - def __get__(self, instance: Any, cls: Any | None = ...) -> Any: ... + def __get__(self, instance: Any, cls: Any | None = None) -> Any: ... class DatabaseWrapper(BaseDatabaseWrapper): client: DatabaseClient @@ -45,8 +45,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): def get_new_connection(self, conn_params: Any) -> Any: ... pattern_ops: Any def init_connection_state(self) -> None: ... - def create_cursor(self, name: Any | None = ...) -> Any: ... - def check_constraints(self, table_names: Any | None = ...) -> None: ... + def create_cursor(self, name: Any | None = None) -> Any: ... + def check_constraints(self, table_names: Any | None = None) -> None: ... def is_usable(self) -> Any: ... @property def oracle_version(self) -> Any: ... @@ -54,7 +54,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): class OracleParam: force_bytes: Any input_size: Any - def __init__(self, param: Any, cursor: Any, strings_only: bool = ...) -> None: ... + def __init__(self, param: Any, cursor: Any, strings_only: bool = False) -> None: ... class VariableWrapper: var: Any @@ -68,8 +68,8 @@ class FormatStylePlaceholderCursor: cursor: Any database: BaseDatabaseWrapper def __init__(self, connection: Any, database: BaseDatabaseWrapper) -> None: ... - def execute(self, query: Any, params: Any | None = ...) -> Any: ... - def executemany(self, query: Any, params: Any | None = ...) -> Any: ... + def execute(self, query: Any, params: Any | None = None) -> Any: ... + def executemany(self, query: Any, params: Any | None = None) -> Any: ... def close(self) -> None: ... def var(self, *args: Any) -> Any: ... def arrayvar(self, *args: Any) -> Any: ... diff --git a/django-stubs/db/backends/oracle/functions.pyi b/django-stubs/db/backends/oracle/functions.pyi index df9fcad92..d642ccaec 100644 --- a/django-stubs/db/backends/oracle/functions.pyi +++ b/django-stubs/db/backends/oracle/functions.pyi @@ -5,9 +5,9 @@ from django.db.models import Func class IntervalToSeconds(Func): function: str template: str - def __init__(self, expression: Any, *, output_field: Any | None = ..., **extra: Any) -> None: ... + def __init__(self, expression: Any, *, output_field: Any | None = None, **extra: Any) -> None: ... class SecondsToInterval(Func): function: str template: str - def __init__(self, expression: Any, *, output_field: Any | None = ..., **extra: Any) -> None: ... + def __init__(self, expression: Any, *, output_field: Any | None = None, **extra: Any) -> None: ... diff --git a/django-stubs/db/backends/oracle/schema.pyi b/django-stubs/db/backends/oracle/schema.pyi index 885f65453..be1b90295 100644 --- a/django-stubs/db/backends/oracle/schema.pyi +++ b/django-stubs/db/backends/oracle/schema.pyi @@ -20,6 +20,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def quote_value(self, value: Any) -> str: ... def remove_field(self, model: type[Model], field: Field) -> None: ... def delete_model(self, model: type[Model]) -> None: ... - def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ... + def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = False) -> None: ... def normalize_name(self, name: Any) -> str: ... def prepare_default(self, value: Any) -> Any: ... diff --git a/django-stubs/db/backends/postgresql/schema.pyi b/django-stubs/db/backends/postgresql/schema.pyi index 99eccb6ff..5aa7e3d26 100644 --- a/django-stubs/db/backends/postgresql/schema.pyi +++ b/django-stubs/db/backends/postgresql/schema.pyi @@ -19,5 +19,5 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_delete_fk: str sql_delete_procedure: str def quote_value(self, value: Any) -> str: ... - def add_index(self, model: type[Model], index: Index, concurrently: bool = ...) -> None: ... - def remove_index(self, model: type[Model], index: Index, concurrently: bool = ...) -> None: ... + def add_index(self, model: type[Model], index: Index, concurrently: bool = False) -> None: ... + def remove_index(self, model: type[Model], index: Index, concurrently: bool = False) -> None: ... diff --git a/django-stubs/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi index f05d461ae..912a49ae7 100644 --- a/django-stubs/db/backends/utils.pyi +++ b/django-stubs/db/backends/utils.pyi @@ -54,9 +54,9 @@ class CursorWrapper: exc_tb: TracebackType | None, ) -> None: ... def callproc( - self, procname: str, params: Sequence[Any] | None = ..., kparams: dict[str, int] | None = ... + self, procname: str, params: Sequence[Any] | None = None, kparams: dict[str, int] | None = None ) -> Any: ... - def execute(self, sql: _ExecuteQuery, params: _ExecuteParameters = ...) -> Any: ... + def execute(self, sql: _ExecuteQuery, params: _ExecuteParameters | None = None) -> Any: ... def executemany(self, sql: _ExecuteQuery, param_list: Sequence[_ExecuteParameters]) -> Any: ... class CursorDebugWrapper(CursorWrapper): @@ -65,10 +65,10 @@ class CursorDebugWrapper(CursorWrapper): @contextmanager def debug_sql( self, - sql: str | None = ..., - params: _ExecuteParameters | Sequence[_ExecuteParameters] | None = ..., - use_last_executed_query: bool = ..., - many: bool = ..., + sql: str | None = None, + params: _ExecuteParameters | Sequence[_ExecuteParameters] | None = None, + use_last_executed_query: bool = False, + many: bool = False, ) -> Generator[None, None, None]: ... @overload @@ -84,6 +84,6 @@ def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore[overl @overload def typecast_timestamp(s: str) -> datetime.datetime: ... def split_identifier(identifier: str) -> tuple[str, str]: ... -def truncate_name(identifier: str, length: int | None = ..., hash_len: int = ...) -> str: ... +def truncate_name(identifier: str, length: int | None = None, hash_len: int = 4) -> str: ... def format_number(value: Decimal | None, max_digits: int | None, decimal_places: int | None) -> str | None: ... def strip_quotes(table_name: str) -> str: ... diff --git a/django-stubs/db/migrations/autodetector.pyi b/django-stubs/db/migrations/autodetector.pyi index 4cb0b52f2..8448276a0 100644 --- a/django-stubs/db/migrations/autodetector.pyi +++ b/django-stubs/db/migrations/autodetector.pyi @@ -14,14 +14,14 @@ class MigrationAutodetector: questioner: MigrationQuestioner existing_apps: set[Any] def __init__( - self, from_state: ProjectState, to_state: ProjectState, questioner: MigrationQuestioner | None = ... + self, from_state: ProjectState, to_state: ProjectState, questioner: MigrationQuestioner | None = None ) -> None: ... def changes( self, graph: MigrationGraph, - trim_to_apps: set[str] | None = ..., - convert_apps: set[str] | None = ..., - migration_name: str | None = ..., + trim_to_apps: set[str] | None = None, + convert_apps: set[str] | None = None, + migration_name: str | None = None, ) -> dict[str, list[Migration]]: ... def deep_deconstruct(self, obj: Any) -> Any: ... def only_relation_agnostic_fields( @@ -32,8 +32,8 @@ class MigrationAutodetector: self, app_label: str, operation: Operation, - dependencies: Iterable[tuple[str, str, str | None, bool | str]] | None = ..., - beginning: bool = ..., + dependencies: Iterable[tuple[str, str, str | None, bool | str]] | None = None, + beginning: bool = False, ) -> None: ... def swappable_first_key(self, item: tuple[str, str]) -> tuple[str, str]: ... renamed_models: Any @@ -65,7 +65,7 @@ class MigrationAutodetector: def generate_altered_order_with_respect_to(self) -> None: ... def generate_altered_managers(self) -> None: ... def arrange_for_graph( - self, changes: dict[str, list[Migration]], graph: MigrationGraph, migration_name: str | None = ... + self, changes: dict[str, list[Migration]], graph: MigrationGraph, migration_name: str | None = None ) -> dict[str, list[Migration]]: ... @classmethod def parse_number(cls, name: str) -> int: ... diff --git a/django-stubs/db/migrations/exceptions.pyi b/django-stubs/db/migrations/exceptions.pyi index 4f2099f1a..5715c449a 100644 --- a/django-stubs/db/migrations/exceptions.pyi +++ b/django-stubs/db/migrations/exceptions.pyi @@ -12,7 +12,7 @@ class NodeNotFoundError(LookupError): message: str origin: Migration | None node: tuple[str, str] - def __init__(self, message: str, node: tuple[str, str], origin: Migration | None = ...) -> None: ... + def __init__(self, message: str, node: tuple[str, str], origin: Migration | None = None) -> None: ... class MigrationSchemaMissing(DatabaseError): ... class InvalidMigrationPlan(ValueError): ... diff --git a/django-stubs/db/migrations/executor.pyi b/django-stubs/db/migrations/executor.pyi index 778bcf1fd..21a72570c 100644 --- a/django-stubs/db/migrations/executor.pyi +++ b/django-stubs/db/migrations/executor.pyi @@ -20,24 +20,24 @@ class MigrationExecutor: def __init__( self, connection: BaseDatabaseWrapper | None, - progress_callback: _ProgressCallbackT | None = ..., + progress_callback: _ProgressCallbackT | None = None, ) -> None: ... def migration_plan( - self, targets: Sequence[tuple[str, str | None]] | set[tuple[str, str]], clean_start: bool = ... + self, targets: Sequence[tuple[str, str | None]] | set[tuple[str, str]], clean_start: bool = False ) -> list[tuple[Migration, bool]]: ... def migrate( self, targets: Sequence[tuple[str, str | None]] | None, - plan: Sequence[tuple[Migration, bool]] | None = ..., - state: ProjectState | None = ..., - fake: bool = ..., - fake_initial: bool = ..., + plan: Sequence[tuple[Migration, bool]] | None = None, + state: ProjectState | None = None, + fake: bool = False, + fake_initial: bool = False, ) -> ProjectState: ... def apply_migration( - self, state: ProjectState, migration: Migration, fake: bool = ..., fake_initial: bool = ... + self, state: ProjectState, migration: Migration, fake: bool = False, fake_initial: bool = False ) -> ProjectState: ... def record_migration(self, migration: Migration) -> None: ... - def unapply_migration(self, state: ProjectState, migration: Migration, fake: bool = ...) -> ProjectState: ... + def unapply_migration(self, state: ProjectState, migration: Migration, fake: bool = False) -> ProjectState: ... def check_replacements(self) -> None: ... def detect_soft_applied( self, project_state: ProjectState | None, migration: Migration diff --git a/django-stubs/db/migrations/graph.pyi b/django-stubs/db/migrations/graph.pyi index f0d8b9a3b..a219fa61e 100644 --- a/django-stubs/db/migrations/graph.pyi +++ b/django-stubs/db/migrations/graph.pyi @@ -36,21 +36,21 @@ class MigrationGraph: migration: Migration | str | None, child: tuple[str, str], parent: tuple[str, str], - skip_validation: bool = ..., + skip_validation: bool = False, ) -> None: ... def remove_replaced_nodes(self, replacement: tuple[str, str], replaced: list[tuple[str, str]]) -> None: ... def remove_replacement_node(self, replacement: tuple[str, str], replaced: list[tuple[str, str]]) -> None: ... def validate_consistency(self) -> None: ... def forwards_plan(self, target: tuple[str, str]) -> list[tuple[str, str]]: ... def backwards_plan(self, target: tuple[str, str]) -> list[tuple[str, str]]: ... - def iterative_dfs(self, start: Any, forwards: bool = ...) -> list[tuple[str, str]]: ... - def root_nodes(self, app: str | None = ...) -> list[tuple[str, str]]: ... - def leaf_nodes(self, app: str | None = ...) -> list[tuple[str, str]]: ... + def iterative_dfs(self, start: Any, forwards: bool = True) -> list[tuple[str, str]]: ... + def root_nodes(self, app: str | None = None) -> list[tuple[str, str]]: ... + def leaf_nodes(self, app: str | None = None) -> list[tuple[str, str]]: ... def ensure_not_cyclic(self) -> None: ... def make_state( self, - nodes: None | tuple[str, str] | Sequence[tuple[str, str]] = ..., - at_end: bool = ..., - real_apps: list[str] = ..., + nodes: None | tuple[str, str] | Sequence[tuple[str, str]] = None, + at_end: bool = True, + real_apps: list[str] | None = None, ) -> ProjectState: ... def __contains__(self, node: tuple[str, str]) -> bool: ... diff --git a/django-stubs/db/migrations/loader.pyi b/django-stubs/db/migrations/loader.pyi index 7e6d8151b..fbc6cfa0b 100644 --- a/django-stubs/db/migrations/loader.pyi +++ b/django-stubs/db/migrations/loader.pyi @@ -20,9 +20,9 @@ class MigrationLoader: def __init__( self, connection: BaseDatabaseWrapper | None, - load: bool = ..., - ignore_no_migrations: bool = ..., - replace_migrations: bool = ..., + load: bool = True, + ignore_no_migrations: bool = False, + replace_migrations: bool = True, ) -> None: ... @classmethod def migrations_module(cls, app_label: str) -> tuple[str | None, bool]: ... @@ -40,5 +40,5 @@ class MigrationLoader: def check_consistent_history(self, connection: BaseDatabaseWrapper) -> None: ... def detect_conflicts(self) -> dict[str, list[str]]: ... def project_state( - self, nodes: tuple[str, str] | Sequence[tuple[str, str]] | None = ..., at_end: bool = ... + self, nodes: tuple[str, str] | Sequence[tuple[str, str]] | None = None, at_end: bool = True ) -> ProjectState: ... diff --git a/django-stubs/db/migrations/migration.pyi b/django-stubs/db/migrations/migration.pyi index 13ab99841..83fa7906c 100644 --- a/django-stubs/db/migrations/migration.pyi +++ b/django-stubs/db/migrations/migration.pyi @@ -15,12 +15,12 @@ class Migration: name: str app_label: str def __init__(self, name: str, app_label: str) -> None: ... - def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ... + def mutate_state(self, project_state: ProjectState, preserve: bool = True) -> ProjectState: ... def apply( - self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ... + self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = False ) -> ProjectState: ... def unapply( - self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ... + self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = False ) -> ProjectState: ... class SwappableTuple(tuple[str, str]): diff --git a/django-stubs/db/migrations/operations/fields.pyi b/django-stubs/db/migrations/operations/fields.pyi index fda8b9b52..3b1a09d63 100644 --- a/django-stubs/db/migrations/operations/fields.pyi +++ b/django-stubs/db/migrations/operations/fields.pyi @@ -6,7 +6,7 @@ from .base import Operation class FieldOperation(Operation): model_name: str name: str - def __init__(self, model_name: str, name: str, field: Field | None = ...) -> None: ... + def __init__(self, model_name: str, name: str, field: Field | None = None) -> None: ... @cached_property def name_lower(self) -> str: ... @cached_property @@ -17,14 +17,14 @@ class FieldOperation(Operation): class AddField(FieldOperation): field: Field preserve_default: bool - def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = ...) -> None: ... + def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = True) -> None: ... class RemoveField(FieldOperation): ... class AlterField(FieldOperation): field: Field preserve_default: bool - def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = ...) -> None: ... + def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = True) -> None: ... class RenameField(FieldOperation): old_name: str diff --git a/django-stubs/db/migrations/operations/models.pyi b/django-stubs/db/migrations/operations/models.pyi index f4883e8cf..794a1479e 100644 --- a/django-stubs/db/migrations/operations/models.pyi +++ b/django-stubs/db/migrations/operations/models.pyi @@ -27,9 +27,9 @@ class CreateModel(ModelOperation): self, name: str, fields: list[tuple[str, Field]], - options: dict[str, Any] | None = ..., - bases: Sequence[type[Any] | str] | None = ..., - managers: Sequence[tuple[str, Manager]] | None = ..., + options: dict[str, Any] | None = None, + bases: Sequence[type[Any] | str] | None = None, + managers: Sequence[tuple[str, Manager]] | None = None, ) -> None: ... class DeleteModel(ModelOperation): ... @@ -132,8 +132,8 @@ class RenameIndex(IndexOperation): self, model_name: str, new_name: str, - old_name: str | None = ..., - old_fields: Sequence[str] | None = ..., + old_name: str | None = None, + old_fields: Sequence[str] | None = None, ) -> None: ... @cached_property def old_name_lower(self) -> str: ... diff --git a/django-stubs/db/migrations/operations/special.pyi b/django-stubs/db/migrations/operations/special.pyi index 74dab5f4d..71f81aee1 100644 --- a/django-stubs/db/migrations/operations/special.pyi +++ b/django-stubs/db/migrations/operations/special.pyi @@ -15,7 +15,9 @@ class SeparateDatabaseAndState(Operation): state_operations: Sequence[Operation] def __init__( - self, database_operations: Sequence[Operation] | None = ..., state_operations: Sequence[Operation] | None = ... + self, + database_operations: Sequence[Operation] | None = None, + state_operations: Sequence[Operation] | None = None, ) -> None: ... class RunSQL(Operation): @@ -27,10 +29,10 @@ class RunSQL(Operation): def __init__( self, sql: _SqlOperations, - reverse_sql: _SqlOperations | None = ..., - state_operations: Sequence[Operation] | None = ..., - hints: Mapping[str, Any] | None = ..., - elidable: bool = ..., + reverse_sql: _SqlOperations | None = None, + state_operations: Sequence[Operation] | None = None, + hints: Mapping[str, Any] | None = None, + elidable: bool = False, ) -> None: ... @property def reversible(self) -> bool: ... # type: ignore[override] @@ -46,10 +48,10 @@ class RunPython(Operation): def __init__( self, code: _CodeCallable, - reverse_code: _CodeCallable | None = ..., - atomic: bool | None = ..., - hints: Mapping[str, Any] | None = ..., - elidable: bool = ..., + reverse_code: _CodeCallable | None = None, + atomic: bool | None = None, + hints: Mapping[str, Any] | None = None, + elidable: bool = False, ) -> None: ... @staticmethod def noop(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: ... diff --git a/django-stubs/db/migrations/questioner.pyi b/django-stubs/db/migrations/questioner.pyi index 542cd2ac6..60b6bac6b 100644 --- a/django-stubs/db/migrations/questioner.pyi +++ b/django-stubs/db/migrations/questioner.pyi @@ -9,9 +9,9 @@ class MigrationQuestioner: dry_run: bool | None def __init__( self, - defaults: dict[str, bool] | None = ..., - specified_apps: set[str] | None = ..., - dry_run: bool | None = ..., + defaults: dict[str, bool] | None = None, + specified_apps: set[str] | None = None, + dry_run: bool | None = None, ) -> None: ... def ask_initial(self, app_label: str) -> bool: ... def ask_not_null_addition(self, field_name: str, model_name: str) -> Any: ... diff --git a/django-stubs/db/migrations/state.pyi b/django-stubs/db/migrations/state.pyi index 87167f99d..9828f1196 100644 --- a/django-stubs/db/migrations/state.pyi +++ b/django-stubs/db/migrations/state.pyi @@ -24,14 +24,14 @@ class ModelState: app_label: str, name: str, fields: list[tuple[str, Field]] | dict[str, Field], - options: dict[str, Any] | None = ..., - bases: Sequence[type[Model] | str] | None = ..., - managers: list[tuple[str, Manager]] | None = ..., + options: dict[str, Any] | None = None, + bases: Sequence[type[Model] | str] | None = None, + managers: list[tuple[str, Manager]] | None = None, ) -> None: ... def clone(self) -> ModelState: ... def construct_managers(self) -> Iterator[tuple[str, Manager]]: ... @classmethod - def from_model(cls, model: type[Model], exclude_rels: bool = ...) -> ModelState: ... + def from_model(cls, model: type[Model], exclude_rels: bool = False) -> ModelState: ... def get_field(self, field_name: str) -> Field: ... @cached_property def name_lower(self) -> str: ... @@ -48,7 +48,7 @@ class ProjectState: models: dict[Any, Any] real_apps: set[str] def __init__( - self, models: dict[tuple[str, str], ModelState] | None = ..., real_apps: set[str] | None = ... + self, models: dict[tuple[str, str], ModelState] | None = None, real_apps: set[str] | None = None ) -> None: ... @property def relations(self) -> Any: ... @@ -59,12 +59,12 @@ class ProjectState: def clone(self) -> ProjectState: ... @classmethod def from_apps(cls, apps: Apps) -> ProjectState: ... - def reload_model(self, app_label: str, model_name: str, delay: bool = ...) -> None: ... - def reload_models(self, models: list[Any], delay: bool = ...) -> None: ... + def reload_model(self, app_label: str, model_name: str, delay: bool = False) -> None: ... + def reload_models(self, models: list[Any], delay: bool = True) -> None: ... def remove_model(self, app_label: str, model_name: str) -> None: ... def rename_model(self, app_label: str, old_name: str, new_name: str) -> None: ... def alter_model_options( - self, app_label: str, model_name: str, options: dict[str, Any], option_keys: Iterable[str] | None = ... + self, app_label: str, model_name: str, options: dict[str, Any], option_keys: Iterable[str] | None = None ) -> None: ... def remove_model_options(self, app_label: str, model_name: str, option_name: str, value_to_remove: Any) -> None: ... def alter_model_managers(self, app_label: str, model_name: str, managers: list[tuple[str, Manager]]) -> None: ... @@ -81,16 +81,16 @@ class ProjectState: self, model: type[Model], model_key: tuple[str, str], field_name: str, field: Field, concretes: Any ) -> None: ... def resolve_model_field_relations( - self, model_key: tuple[str, str], field_name: str, field: Field, concretes: Any | None = ... + self, model_key: tuple[str, str], field_name: str, field: Field, concretes: Any | None = None ) -> None: ... - def resolve_model_relations(self, model_key: tuple[str, str], concretes: Any | None = ...) -> None: ... + def resolve_model_relations(self, model_key: tuple[str, str], concretes: Any | None = None) -> None: ... def resolve_fields_and_relations(self) -> None: ... def get_concrete_model_key(self, model: type[Model]) -> Any: ... class StateApps(Apps): real_models: list[ModelState] def __init__( - self, real_apps: list[str], models: dict[tuple[str, str], ModelState], ignore_swappable: bool = ... + self, real_apps: list[str], models: dict[tuple[str, str], ModelState], ignore_swappable: bool = False ) -> None: ... @contextmanager def bulk_update(self) -> Iterator[None]: ... diff --git a/django-stubs/db/migrations/writer.pyi b/django-stubs/db/migrations/writer.pyi index edd58e6b1..ed22d5445 100644 --- a/django-stubs/db/migrations/writer.pyi +++ b/django-stubs/db/migrations/writer.pyi @@ -8,7 +8,7 @@ class OperationWriter: operation: Operation buff: list[Any] indentation: int - def __init__(self, operation: Operation, indentation: int = ...) -> None: ... + def __init__(self, operation: Operation, indentation: int = 2) -> None: ... def serialize(self) -> tuple[str, set[str]]: ... def indent(self) -> None: ... def unindent(self) -> None: ... @@ -18,7 +18,7 @@ class OperationWriter: class MigrationWriter: migration: Migration needs_manual_porting: bool - def __init__(self, migration: Migration, include_header: bool = ...) -> None: ... + def __init__(self, migration: Migration, include_header: bool = True) -> None: ... def as_string(self) -> str: ... @property def basedir(self) -> str: ... diff --git a/django-stubs/db/models/aggregates.pyi b/django-stubs/db/models/aggregates.pyi index 1d9621764..788ee75a4 100644 --- a/django-stubs/db/models/aggregates.pyi +++ b/django-stubs/db/models/aggregates.pyi @@ -9,7 +9,7 @@ class Aggregate(Func): filter: Any allow_distinct: bool empty_result_set_value: int | None - def __init__(self, *expressions: Any, distinct: bool = ..., filter: Any | None = ..., **extra: Any) -> None: ... + def __init__(self, *expressions: Any, distinct: bool = False, filter: Any | None = None, **extra: Any) -> None: ... class Avg(FixDurationInputMixin, NumericOutputFieldMixin, Aggregate): ... diff --git a/django-stubs/db/models/base.pyi b/django-stubs/db/models/base.pyi index 38ac288ab..776bea7a2 100644 --- a/django-stubs/db/models/base.pyi +++ b/django-stubs/db/models/base.pyi @@ -57,42 +57,42 @@ class Model(metaclass=ModelBase): update_fields: Iterable[str] | None, forced_update: bool, ) -> bool: ... - def delete(self, using: Any = ..., keep_parents: bool = ...) -> tuple[int, dict[str, int]]: ... - async def adelete(self, using: Any = ..., keep_parents: bool = ...) -> tuple[int, dict[str, int]]: ... + def delete(self, using: Any | None = None, keep_parents: bool = False) -> tuple[int, dict[str, int]]: ... + async def adelete(self, using: Any | None = None, keep_parents: bool = False) -> tuple[int, dict[str, int]]: ... def full_clean( - self, exclude: Iterable[str] | None = ..., validate_unique: bool = ..., validate_constraints: bool = ... + self, exclude: Iterable[str] | None = None, validate_unique: bool = True, validate_constraints: bool = True ) -> None: ... def clean(self) -> None: ... - def clean_fields(self, exclude: Collection[str] | None = ...) -> None: ... - def validate_unique(self, exclude: Collection[str] | None = ...) -> None: ... + def clean_fields(self, exclude: Collection[str] | None = None) -> None: ... + def validate_unique(self, exclude: Collection[str] | None = None) -> None: ... def date_error_message(self, lookup_type: str, field_name: str, unique_for: str) -> ValidationError: ... def unique_error_message(self, model_class: type[Self], unique_check: Sequence[str]) -> ValidationError: ... - def validate_constraints(self, exclude: Collection[str] | None = ...) -> None: ... + def validate_constraints(self, exclude: Collection[str] | None = None) -> None: ... def get_constraints(self) -> list[tuple[type[Model], Sequence[BaseConstraint]]]: ... def save( self, - force_insert: bool | tuple[ModelBase, ...] = ..., - force_update: bool = ..., - using: str | None = ..., - update_fields: Iterable[str] | None = ..., + force_insert: bool | tuple[ModelBase, ...] = False, + force_update: bool = False, + using: str | None = None, + update_fields: Iterable[str] | None = None, ) -> None: ... async def asave( self, - force_insert: bool | tuple[ModelBase, ...] = ..., - force_update: bool = ..., - using: str | None = ..., - update_fields: Iterable[str] | None = ..., + force_insert: bool | tuple[ModelBase, ...] = False, + force_update: bool = False, + using: str | None = None, + update_fields: Iterable[str] | None = None, ) -> None: ... def save_base( self, - raw: bool = ..., - force_insert: bool | tuple[ModelBase, ...] = ..., - force_update: bool = ..., - using: str | None = ..., - update_fields: Iterable[str] | None = ..., + raw: bool = False, + force_insert: bool | tuple[ModelBase, ...] = False, + force_update: bool = False, + using: str | None = None, + update_fields: Iterable[str] | None = None, ) -> None: ... - def refresh_from_db(self, using: str | None = ..., fields: Iterable[str] | None = ...) -> None: ... - async def arefresh_from_db(self, using: str | None = ..., fields: Iterable[str] | None = ...) -> None: ... + def refresh_from_db(self, using: str | None = None, fields: Iterable[str] | None = None) -> None: ... + async def arefresh_from_db(self, using: str | None = None, fields: Iterable[str] | None = None) -> None: ... def serializable_value(self, field_name: str) -> Any: ... def prepare_database_save(self, field: Field) -> Any: ... def get_deferred_fields(self) -> set[str]: ... diff --git a/django-stubs/db/models/constraints.pyi b/django-stubs/db/models/constraints.pyi index e37f50c8b..7b96ada72 100644 --- a/django-stubs/db/models/constraints.pyi +++ b/django-stubs/db/models/constraints.pyi @@ -20,16 +20,20 @@ class BaseConstraint: default_violation_error_message: _StrOrPromise @overload def __init__( - self, *, name: str, violation_error_code: str | None = ..., violation_error_message: _StrOrPromise | None = ... + self, + *, + name: str, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, ) -> None: ... @overload @deprecated("Passing positional arguments to BaseConstraint is deprecated and will be removed in Django 6.0") def __init__( self, *args: Any, - name: str | None = ..., - violation_error_code: str | None = ..., - violation_error_message: _StrOrPromise | None = ..., + name: str | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, ) -> None: ... def constraint_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... def create_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... @@ -45,8 +49,8 @@ class CheckConstraint(BaseConstraint): *, check: Q | BaseExpression, name: str, - violation_error_code: str | None = ..., - violation_error_message: _StrOrPromise | None = ..., + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, ) -> None: ... class UniqueConstraint(BaseConstraint): @@ -61,26 +65,26 @@ class UniqueConstraint(BaseConstraint): self, *expressions: str | BaseExpression | Combinable, fields: None = None, - name: str | None = ..., - condition: Q | None = ..., - deferrable: Deferrable | None = ..., - include: Sequence[str] | None = ..., - opclasses: Sequence[Any] = ..., - nulls_distinct: bool | None = ..., - violation_error_code: str | None = ..., - violation_error_message: _StrOrPromise | None = ..., + name: str | None = None, + condition: Q | None = None, + deferrable: Deferrable | None = None, + include: Sequence[str] | None = None, + opclasses: Sequence[Any] = (), + nulls_distinct: bool | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, ) -> None: ... @overload def __init__( self, *, fields: Sequence[str], - name: str | None = ..., - condition: Q | None = ..., - deferrable: Deferrable | None = ..., - include: Sequence[str] | None = ..., - opclasses: Sequence[Any] = ..., - nulls_distinct: bool | None = ..., - violation_error_code: str | None = ..., - violation_error_message: _StrOrPromise | None = ..., + name: str | None = None, + condition: Q | None = None, + deferrable: Deferrable | None = None, + include: Sequence[str] | None = None, + opclasses: Sequence[Any] = (), + nulls_distinct: bool | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, ) -> None: ... diff --git a/django-stubs/db/models/deletion.pyi b/django-stubs/db/models/deletion.pyi index d27a4258f..56143fe9c 100644 --- a/django-stubs/db/models/deletion.pyi +++ b/django-stubs/db/models/deletion.pyi @@ -68,29 +68,29 @@ class Collector: def add( self, objs: _IndexableCollection[Model], - source: type[Model] | None = ..., - nullable: bool = ..., - reverse_dependency: bool = ..., + source: type[Model] | None = None, + nullable: bool = False, + reverse_dependency: bool = False, ) -> list[Model]: ... - def add_dependency(self, model: type[Model], dependency: type[Model], reverse_dependency: bool = ...) -> None: ... + def add_dependency(self, model: type[Model], dependency: type[Model], reverse_dependency: bool = False) -> None: ... def add_field_update(self, field: Field, value: Any, objs: _IndexableCollection[Model]) -> None: ... def add_restricted_objects(self, field: Field, objs: _IndexableCollection[Model]) -> None: ... def clear_restricted_objects_from_set(self, model: type[Model], objs: set[Model]) -> None: ... def clear_restricted_objects_from_queryset(self, model: type[Model], qs: QuerySet[Model]) -> None: ... - def can_fast_delete(self, objs: Model | Iterable[Model], from_field: Field | None = ...) -> bool: ... + def can_fast_delete(self, objs: Model | Iterable[Model], from_field: Field | None = None) -> bool: ... def get_del_batches( self, objs: _IndexableCollection[Model], fields: Iterable[Field] ) -> Sequence[Sequence[Model]]: ... def collect( self, objs: _IndexableCollection[Model | None], - source: type[Model] | None = ..., - nullable: bool = ..., - collect_related: bool = ..., - source_attr: str | None = ..., - reverse_dependency: bool = ..., - keep_parents: bool = ..., - fail_on_restricted: bool = ..., + source: type[Model] | None = None, + nullable: bool = False, + collect_related: bool = True, + source_attr: str | None = None, + reverse_dependency: bool = False, + keep_parents: bool = False, + fail_on_restricted: bool = True, ) -> None: ... def related_objects( self, related_model: type[Model], related_fields: Iterable[Field], objs: _IndexableCollection[Model] diff --git a/django-stubs/db/models/expressions.pyi b/django-stubs/db/models/expressions.pyi index fb438c4aa..85191cde4 100644 --- a/django-stubs/db/models/expressions.pyi +++ b/django-stubs/db/models/expressions.pyi @@ -62,7 +62,7 @@ class BaseExpression: filterable: bool window_compatible: bool allowed_default: bool - def __init__(self, output_field: Field | None = ...) -> None: ... + def __init__(self, output_field: Field | None = None) -> None: ... def get_db_converters(self, connection: BaseDatabaseWrapper) -> list[Callable]: ... def get_source_expressions(self) -> list[Any]: ... def set_source_expressions(self, exprs: Sequence[Combinable | Expression]) -> None: ... @@ -76,11 +76,11 @@ class BaseExpression: def contains_subquery(self) -> bool: ... def resolve_expression( self, - query: Any = ..., - allow_joins: bool = ..., - reuse: set[str] | None = ..., - summarize: bool = ..., - for_save: bool = ..., + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, ) -> Self: ... @property def conditional(self) -> bool: ... @@ -119,7 +119,7 @@ class CombinedExpression(SQLiteNumericMixin, Expression): connector: str lhs: Combinable rhs: Combinable - def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Field | None = ...) -> None: ... + def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Field | None = None) -> None: ... class DurationExpression(CombinedExpression): def compile(self, side: Combinable, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @@ -134,11 +134,11 @@ class F(_Deconstructible, Combinable): def __init__(self, name: str) -> None: ... def resolve_expression( self, - query: Any = ..., - allow_joins: bool = ..., - reuse: set[str] | None = ..., - summarize: bool = ..., - for_save: bool = ..., + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, ) -> Expression: ... def replace_expressions(self, replacements: Mapping[F, Any]) -> F: ... def asc( @@ -174,25 +174,25 @@ class Func(SQLiteNumericMixin, Expression): arity: int | None source_expressions: list[Expression] extra: dict[Any, Any] - def __init__(self, *expressions: Any, output_field: Field | None = ..., **extra: Any) -> None: ... + def __init__(self, *expressions: Any, output_field: Field | None = None, **extra: Any) -> None: ... def as_sql( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, - function: str | None = ..., - template: str | None = ..., - arg_joiner: str | None = ..., + function: str | None = None, + template: str | None = None, + arg_joiner: str | None = None, **extra_context: Any, ) -> _AsSqlType: ... class Value(Expression): value: Any - def __init__(self, value: Any, output_field: Field | None = ...) -> None: ... + def __init__(self, value: Any, output_field: Field | None = None) -> None: ... class RawSQL(Expression): params: list[Any] sql: str - def __init__(self, sql: str, params: Sequence[Any], output_field: Field | None = ...) -> None: ... + def __init__(self, sql: str, params: Sequence[Any], output_field: Field | None = None) -> None: ... class Star(Expression): ... @@ -204,7 +204,7 @@ class Col(Expression): alias: str contains_column_references: Literal[True] possibly_multivalued: Literal[False] - def __init__(self, alias: str, target: Field, output_field: Field | None = ...) -> None: ... + def __init__(self, alias: str, target: Field, output_field: Field | None = None) -> None: ... class Ref(Expression): def __init__(self, refs: str, source: Expression) -> None: ... @@ -228,7 +228,7 @@ class When(Expression): template: str condition: Any result: Any - def __init__(self, condition: Any = ..., then: Any = ..., **lookups: Any) -> None: ... + def __init__(self, condition: Any | None = None, then: Any | None = None, **lookups: Any) -> None: ... class Case(Expression): template: str @@ -237,7 +237,7 @@ class Case(Expression): default: Any extra: Any def __init__( - self, *cases: Any, default: Any | None = ..., output_field: Field | None = ..., **extra: Any + self, *cases: Any, default: Any | None = None, output_field: Field | None = None, **extra: Any ) -> None: ... class Subquery(BaseExpression, Combinable): @@ -245,7 +245,7 @@ class Subquery(BaseExpression, Combinable): subquery: bool query: Query extra: dict[Any, Any] - def __init__(self, queryset: Query | QuerySet, output_field: Field | None = ..., **extra: Any) -> None: ... + def __init__(self, queryset: Query | QuerySet, output_field: Field | None = None, **extra: Any) -> None: ... class Exists(Subquery): output_field: ClassVar[fields.BooleanField] @@ -260,9 +260,9 @@ class OrderBy(Expression): def __init__( self, expression: Expression | F | Subquery, - descending: bool = ..., - nulls_first: bool | None = ..., - nulls_last: bool | None = ..., + descending: bool = False, + nulls_first: bool | None = None, + nulls_last: bool | None = None, ) -> None: ... def asc(self) -> None: ... # type: ignore[override] def desc(self) -> None: ... # type: ignore[override] @@ -276,16 +276,16 @@ class Window(SQLiteNumericMixin, Expression): def __init__( self, expression: BaseExpression, - partition_by: str | Iterable[BaseExpression | F] | F | BaseExpression | None = ..., - order_by: Sequence[BaseExpression | F | str] | BaseExpression | F | str | None = ..., - frame: WindowFrame | None = ..., - output_field: Field | None = ..., + partition_by: str | Iterable[BaseExpression | F] | F | BaseExpression | None = None, + order_by: Sequence[BaseExpression | F | str] | BaseExpression | F | str | None = None, + frame: WindowFrame | None = None, + output_field: Field | None = None, ) -> None: ... class WindowFrame(Expression): template: str frame_type: str - def __init__(self, start: int | None = ..., end: int | None = ...) -> None: ... + def __init__(self, start: int | None = None, end: int | None = None) -> None: ... def window_frame_start_end( self, connection: BaseDatabaseWrapper, start: int | None, end: int | None ) -> tuple[int, int]: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index fa7413780..74111ee67 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -153,29 +153,29 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): non_db_attrs: tuple[str, ...] def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - primary_key: bool = ..., - max_length: int | None = ..., - unique: bool = ..., - blank: bool = ..., - null: bool = ..., - db_index: bool = ..., - rel: ForeignObjectRel | None = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + primary_key: bool = False, + max_length: int | None = None, + unique: bool = False, + blank: bool = False, + null: bool = False, + db_index: bool = False, + rel: ForeignObjectRel | None = None, default: Any = ..., - editable: bool = ..., - serialize: bool = ..., - unique_for_date: str | None = ..., - unique_for_month: str | None = ..., - unique_for_year: str | None = ..., - choices: _Choices | None = ..., - help_text: _StrOrPromise = ..., - db_column: str | None = ..., - db_tablespace: str | None = ..., - auto_created: bool = ..., - validators: Iterable[validators._ValidatorCallable] = ..., - error_messages: _ErrorMessagesMapping | None = ..., - db_comment: str | None = ..., + editable: bool = True, + serialize: bool = True, + unique_for_date: str | None = None, + unique_for_month: str | None = None, + unique_for_year: str | None = None, + choices: _Choices | None = None, + help_text: _StrOrPromise = "", + db_column: str | None = None, + db_tablespace: str | None = None, + auto_created: bool = False, + validators: Iterable[validators._ValidatorCallable] = (), + error_messages: _ErrorMessagesMapping | None = None, + db_comment: str | None = None, db_default: type[NOT_PROVIDED] | Expression | _ST = ..., ) -> None: ... def __set__(self, instance: Any, value: _ST) -> None: ... @@ -196,18 +196,18 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def db_parameters(self, connection: BaseDatabaseWrapper) -> dict[str, str | None]: ... def pre_save(self, model_instance: Model, add: bool) -> Any: ... def get_prep_value(self, value: Any) -> Any: ... - def get_db_prep_value(self, value: Any, connection: BaseDatabaseWrapper, prepared: bool = ...) -> Any: ... + def get_db_prep_value(self, value: Any, connection: BaseDatabaseWrapper, prepared: bool = False) -> Any: ... def get_db_prep_save(self, value: Any, connection: BaseDatabaseWrapper) -> Any: ... def get_internal_type(self) -> str: ... # TODO: plugin support def formfield( self, - form_class: type[forms.Field] | None = ..., - choices_form_class: type[forms.ChoiceField] | None = ..., + form_class: type[forms.Field] | None = None, + choices_form_class: type[forms.ChoiceField] | None = None, **kwargs: Any, ) -> forms.Field: ... def save_form_data(self, instance: Model, data: Any) -> None: ... - def contribute_to_class(self, cls: type[Model], name: str, private_only: bool = ...) -> None: ... + def contribute_to_class(self, cls: type[Model], name: str, private_only: bool = False) -> None: ... def to_python(self, value: Any) -> Any: ... @cached_property def validators(self) -> list[validators._ValidatorCallable]: ... @@ -216,10 +216,10 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def clean(self, value: Any, model_instance: Model | None) -> Any: ... def get_choices( self, - include_blank: bool = ..., + include_blank: bool = True, blank_choice: _ChoicesList = ..., - limit_choices_to: _LimitChoicesTo | None = ..., - ordering: Sequence[str] = ..., + limit_choices_to: _LimitChoicesTo | None = None, + ordering: Sequence[str] = (), ) -> BlankChoiceIterator | _ChoicesList: ... def _get_flatchoices(self) -> list[_Choice]: ... @property @@ -227,7 +227,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def has_default(self) -> bool: ... def get_default(self) -> Any: ... def check(self, **kwargs: Any) -> list[CheckMessage]: ... - def get_col(self, alias: str, output_field: Field | None = ...) -> Col: ... + def get_col(self, alias: str, output_field: Field | None = None) -> Col: ... @cached_property def cached_col(self) -> Col: ... def value_from_object(self, obj: Model) -> _GT: ... @@ -266,10 +266,10 @@ class DecimalField(Field[_ST, _GT]): decimal_places: int def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - max_digits: int | None = ..., - decimal_places: int | None = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + max_digits: int | None = None, + decimal_places: int | None = None, *, primary_key: bool = ..., unique: bool = ..., @@ -321,7 +321,7 @@ class CharField(Field[_ST, _GT]): validators: Iterable[validators._ValidatorCallable] = ..., error_messages: _ErrorMessagesMapping | None = ..., *, - db_collation: str | None = ..., + db_collation: str | None = None, ) -> None: ... class CommaSeparatedIntegerField(CharField[_ST, _GT]): ... @@ -351,9 +351,9 @@ class SlugField(CharField[_ST, _GT]): validators: Iterable[validators._ValidatorCallable] = ..., error_messages: _ErrorMessagesMapping | None = ..., *, - max_length: int | None = ..., - db_index: bool = ..., - allow_unicode: bool = ..., + max_length: int | None = 50, + db_index: bool = True, + allow_unicode: bool = False, ) -> None: ... class EmailField(CharField[_ST, _GT]): @@ -362,8 +362,8 @@ class EmailField(CharField[_ST, _GT]): class URLField(CharField[_ST, _GT]): def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, *, primary_key: bool = ..., max_length: int | None = ..., @@ -420,7 +420,7 @@ class TextField(Field[_ST, _GT]): validators: Iterable[validators._ValidatorCallable] = ..., error_messages: _ErrorMessagesMapping | None = ..., *, - db_collation: str | None = ..., + db_collation: str | None = None, ) -> None: ... class BooleanField(Field[_ST, _GT]): @@ -446,10 +446,10 @@ class GenericIPAddressField(Field[_ST, _GT]): protocol: str def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: Any | None = ..., - protocol: str = ..., - unpack_ipv4: bool = ..., + verbose_name: _StrOrPromise | None = None, + name: Any | None = None, + protocol: str = "both", + unpack_ipv4: bool = False, primary_key: bool = ..., unique: bool = ..., blank: bool = ..., @@ -479,10 +479,10 @@ class DateField(DateTimeCheckMixin, Field[_ST, _GT]): auto_now_add: bool def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + auto_now: bool = False, + auto_now_add: bool = False, *, primary_key: bool = ..., max_length: int | None = ..., @@ -511,10 +511,10 @@ class TimeField(DateTimeCheckMixin, Field[_ST, _GT]): auto_now_add: bool def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + auto_now: bool = False, + auto_now_add: bool = False, *, primary_key: bool = ..., unique: bool = ..., @@ -546,7 +546,7 @@ class UUIDField(Field[_ST, _GT]): _pyi_lookup_exact_type: uuid.UUID | str def __init__( self, - verbose_name: _StrOrPromise | None = ..., + verbose_name: _StrOrPromise | None = None, *, name: str | None = ..., primary_key: bool = ..., @@ -581,13 +581,13 @@ class FilePathField(Field[_ST, _GT]): allow_folders: bool def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - path: str | Callable[..., str] = ..., - match: str | None = ..., - recursive: bool = ..., - allow_files: bool = ..., - allow_folders: bool = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + path: str | Callable[..., str] = "", + match: str | None = None, + recursive: bool = False, + allow_files: bool = True, + allow_folders: bool = False, *, primary_key: bool = ..., max_length: int = ..., diff --git a/django-stubs/db/models/fields/files.pyi b/django-stubs/db/models/fields/files.pyi index 2cab00945..2e0540a3a 100644 --- a/django-stubs/db/models/fields/files.pyi +++ b/django-stubs/db/models/fields/files.pyi @@ -28,9 +28,9 @@ class FieldFile(File, AltersData): def url(self) -> str: ... @property def size(self) -> int: ... - def open(self, mode: str = ...) -> Self: ... # type: ignore[override] - def save(self, name: str, content: File, save: bool = ...) -> None: ... - def delete(self, save: bool = ...) -> None: ... + def open(self, mode: str = "rb") -> Self: ... # type: ignore[override] + def save(self, name: str, content: File, save: bool = True) -> None: ... + def delete(self, save: bool = True) -> None: ... @property def closed(self) -> bool: ... def __getstate__(self) -> dict[str, Any]: ... @@ -41,7 +41,7 @@ class FieldFile(File, AltersData): class FileDescriptor(DeferredAttribute): field: FileField def __set__(self, instance: Model, value: Any | None) -> None: ... - def __get__(self, instance: Model | None, cls: type[Model] | None = ...) -> FieldFile | FileDescriptor: ... + def __get__(self, instance: Model | None, cls: type[Model] | None = None) -> FieldFile | FileDescriptor: ... _M = TypeVar("_M", bound=Model, contravariant=True) @@ -54,10 +54,10 @@ class FileField(Field): upload_to: _PathCompatible | _UploadToCallable def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - upload_to: _PathCompatible | _UploadToCallable = ..., - storage: Storage | Callable[[], Storage] | None = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + upload_to: _PathCompatible | _UploadToCallable = "", + storage: Storage | Callable[[], Storage] | None = None, *, max_length: int | None = ..., unique: bool = ..., @@ -97,15 +97,15 @@ class ImageFileDescriptor(FileDescriptor): class ImageFieldFile(ImageFile, FieldFile): field: ImageField - def delete(self, save: bool = ...) -> None: ... + def delete(self, save: bool = True) -> None: ... class ImageField(FileField): def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - width_field: str | None = ..., - height_field: str | None = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + width_field: str | None = None, + height_field: str | None = None, **kwargs: Any, ) -> None: ... # class access @@ -117,4 +117,4 @@ class ImageField(FileField): # non-Model instances @overload def __get__(self, instance: Any, owner: Any) -> Self: ... - def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ... + def update_dimension_fields(self, instance: Model, force: bool = False, *args: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/db/models/fields/generated.pyi b/django-stubs/db/models/fields/generated.pyi index a9257017e..1be70f2ea 100644 --- a/django-stubs/db/models/fields/generated.pyi +++ b/django-stubs/db/models/fields/generated.pyi @@ -21,7 +21,7 @@ class GeneratedField(models.Field): *, expression: Expression, output_field: models.Field, - db_persist: bool | None = ..., + db_persist: bool | None = None, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., primary_key: bool = ..., diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index 3da0f590b..eff344b91 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -24,10 +24,10 @@ class JSONField(CheckFieldDefaultMixin, Field[_ST, _GT]): decoder: type[json.JSONDecoder] | None def __init__( self, - verbose_name: _StrOrPromise | None = ..., - name: str | None = ..., - encoder: type[json.JSONEncoder] | None = ..., - decoder: type[json.JSONDecoder] | None = ..., + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + encoder: type[json.JSONEncoder] | None = None, + decoder: type[json.JSONDecoder] | None = None, **kwargs: Any, ) -> None: ... def from_db_value(self, value: str | None, expression: Expression, connection: BaseDatabaseWrapper) -> Any: ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 04ff5df6a..a4579c3a1 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -43,9 +43,9 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): swappable: bool def __init__( self, - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, *, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., @@ -97,12 +97,12 @@ class ForeignObject(RelatedField[_ST, _GT]): on_delete: Callable[..., None], from_fields: Sequence[str], to_fields: Sequence[str], - rel: ForeignObjectRel | None = ..., - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - parent_link: bool = ..., - swappable: bool = ..., + rel: ForeignObjectRel | None = None, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + swappable: bool = True, *, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., @@ -155,12 +155,12 @@ class ForeignKey(ForeignObject[_ST, _GT]): self, to: type[Model] | str, on_delete: Callable[..., None], - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - parent_link: bool = ..., - to_field: str | None = ..., - db_constraint: bool = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + to_field: str | None = None, + db_constraint: bool = True, *, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., @@ -197,7 +197,7 @@ class OneToOneField(ForeignKey[_ST, _GT]): self, to: type[Model] | str, on_delete: Any, - to_field: str | None = ..., + to_field: str | None = None, *, related_name: str | None = ..., related_query_name: str | None = ..., @@ -256,15 +256,15 @@ class ManyToManyField(RelatedField[Any, Any], Generic[_To, _Through]): def __init__( self, to: type[_To] | str, - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - symmetrical: bool | None = ..., - through: type[_Through] | str | None = ..., - through_fields: tuple[str, str] | None = ..., - db_constraint: bool = ..., - db_table: str | None = ..., - swappable: bool = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + symmetrical: bool | None = None, + through: type[_Through] | str | None = None, + through_fields: tuple[str, str] | None = None, + db_constraint: bool = True, + db_table: str | None = None, + swappable: bool = True, *, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., @@ -296,8 +296,8 @@ class ManyToManyField(RelatedField[Any, Any], Generic[_To, _Through]): # non-Model instances @overload def __get__(self, instance: Any, owner: Any) -> Self: ... - def get_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ... - def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ... + def get_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... + def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... def contribute_to_related_class(self, cls: type[Model], related: RelatedField) -> None: ... def m2m_db_table(self) -> str: ... def m2m_column_name(self) -> str: ... diff --git a/django-stubs/db/models/fields/related_descriptors.pyi b/django-stubs/db/models/fields/related_descriptors.pyi index 8b37d3d31..4deec2d44 100644 --- a/django-stubs/db/models/fields/related_descriptors.pyi +++ b/django-stubs/db/models/fields/related_descriptors.pyi @@ -29,14 +29,14 @@ class ForwardManyToOneDescriptor(Generic[_F]): def is_cached(self, instance: Model) -> bool: ... def get_queryset(self, **hints: Any) -> QuerySet[Any]: ... def get_prefetch_queryset( - self, instances: list[Model], queryset: QuerySet[Any] | None = ... + self, instances: list[Model], queryset: QuerySet[Any] | None = None ) -> tuple[QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... def get_prefetch_querysets( - self, instances: list[Model], querysets: list[QuerySet[Any]] | None = ... + self, instances: list[Model], querysets: list[QuerySet[Any]] | None = None ) -> tuple[QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... def get_object(self, instance: Model) -> Model: ... def __get__( - self, instance: Model | None, cls: type[Model] | None = ... + self, instance: Model | None, cls: type[Model] | None = None ) -> Model | ForwardManyToOneDescriptor | None: ... def __set__(self, instance: Model, value: Model | None) -> None: ... def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[Model], str]]: ... @@ -61,15 +61,15 @@ class ReverseOneToOneDescriptor(Generic[_From, _To]): def is_cached(self, instance: _From) -> bool: ... def get_queryset(self, **hints: Any) -> QuerySet[_To]: ... def get_prefetch_queryset( - self, instances: list[_From], queryset: QuerySet[_To] | None = ... + self, instances: list[_From], queryset: QuerySet[_To] | None = None ) -> tuple[QuerySet[_To], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... def get_prefetch_querysets( - self, instances: list[_From], querysets: list[QuerySet[_To]] | None = ... + self, instances: list[_From], querysets: list[QuerySet[_To]] | None = None ) -> tuple[QuerySet[_To], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... @overload - def __get__(self, instance: None, cls: Any = ...) -> ReverseOneToOneDescriptor[_From, _To]: ... + def __get__(self, instance: None, cls: Any | None = None) -> ReverseOneToOneDescriptor[_From, _To]: ... @overload - def __get__(self, instance: _From, cls: Any = ...) -> _To: ... + def __get__(self, instance: _From, cls: Any | None = None) -> _To: ... def __set__(self, instance: _From, value: _To | None) -> None: ... def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[_To], str]]: ... @@ -89,9 +89,9 @@ class ReverseManyToOneDescriptor(Generic[_To]): @cached_property def related_manager_cls(self) -> type[RelatedManager[_To]]: ... @overload - def __get__(self, instance: None, cls: Any = ...) -> Self: ... + def __get__(self, instance: None, cls: Any | None = None) -> Self: ... @overload - def __get__(self, instance: Model, cls: Any = ...) -> RelatedManager[_To]: ... + def __get__(self, instance: Model, cls: Any | None = None) -> RelatedManager[_To]: ... def __set__(self, instance: Any, value: Any) -> NoReturn: ... # Fake class, Django defines 'RelatedManager' inside a function body @@ -127,15 +127,15 @@ class ManyToManyDescriptor(ReverseManyToOneDescriptor, Generic[_To, _Through]): rel: ManyToManyRel # type: ignore[assignment] field: ManyToManyField[_To, _Through] # type: ignore[assignment] reverse: bool - def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ... + def __init__(self, rel: ManyToManyRel, reverse: bool = False) -> None: ... @property def through(self) -> type[_Through]: ... @cached_property def related_manager_cls(self) -> type[ManyRelatedManager[_To, _Through]]: ... # type: ignore[override] @overload # type: ignore[override] - def __get__(self, instance: None, cls: Any = ...) -> Self: ... + def __get__(self, instance: None, cls: Any | None = None) -> Self: ... @overload - def __get__(self, instance: Model, cls: Any = ...) -> ManyRelatedManager[_To, _Through]: ... + def __get__(self, instance: Model, cls: Any | None = None) -> ManyRelatedManager[_To, _Through]: ... # Fake class, Django defines 'ManyRelatedManager' inside a function body @type_check_only diff --git a/django-stubs/db/models/fields/reverse_related.pyi b/django-stubs/db/models/fields/reverse_related.pyi index 077d44bf4..3db9e24df 100644 --- a/django-stubs/db/models/fields/reverse_related.pyi +++ b/django-stubs/db/models/fields/reverse_related.pyi @@ -37,11 +37,11 @@ class ForeignObjectRel(FieldCacheMixin): self, field: ForeignObject, to: type[Model] | str, - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - parent_link: bool = ..., - on_delete: Callable = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + on_delete: Callable | None = None, ) -> None: ... @cached_property def hidden(self) -> bool: ... @@ -71,10 +71,10 @@ class ForeignObjectRel(FieldCacheMixin): # and `self.limit_choices_to` is callable. def get_choices( self, - include_blank: bool = ..., + include_blank: bool = True, blank_choice: _ChoicesList = ..., - limit_choices_to: _LimitChoicesTo | None = ..., - ordering: Sequence[str] = ..., + limit_choices_to: _LimitChoicesTo | None = None, + ordering: Sequence[str] = (), ) -> _ChoicesList: ... def is_hidden(self) -> bool: ... def get_joining_columns(self) -> tuple: ... @@ -83,8 +83,8 @@ class ForeignObjectRel(FieldCacheMixin): self, where_class: type[WhereNode], alias: str, related_alias: str ) -> StartsWith | WhereNode | None: ... def set_field_name(self) -> None: ... - def get_accessor_name(self, model: type[Model] | None = ...) -> str | None: ... - def get_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ... + def get_accessor_name(self, model: type[Model] | None = None) -> str | None: ... + def get_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... class ManyToOneRel(ForeignObjectRel): field: ForeignKey @@ -93,14 +93,14 @@ class ManyToOneRel(ForeignObjectRel): field: ForeignKey, to: type[Model] | str, field_name: str, - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - parent_link: bool = ..., - on_delete: Callable = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + on_delete: Callable | None = None, ) -> None: ... def get_related_field(self) -> Field: ... - def get_accessor_name(self, model: type[Model] | None = ...) -> str: ... + def get_accessor_name(self, model: type[Model] | None = None) -> str: ... class OneToOneRel(ManyToOneRel): field: OneToOneField @@ -109,11 +109,11 @@ class OneToOneRel(ManyToOneRel): field: OneToOneField, to: type[Model] | str, field_name: str | None, - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - parent_link: bool = ..., - on_delete: Callable = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + on_delete: Callable | None = None, ) -> None: ... class ManyToManyRel(ForeignObjectRel): @@ -125,12 +125,12 @@ class ManyToManyRel(ForeignObjectRel): self, field: ManyToManyField[Any, Any], to: type[Model] | str, - related_name: str | None = ..., - related_query_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - symmetrical: bool = ..., - through: type[Model] | str | None = ..., - through_fields: tuple[str, str] | None = ..., - db_constraint: bool = ..., + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + symmetrical: bool = True, + through: type[Model] | str | None = None, + through_fields: tuple[str, str] | None = None, + db_constraint: bool = True, ) -> None: ... def get_related_field(self) -> Field: ... diff --git a/django-stubs/db/models/functions/datetime.pyi b/django-stubs/db/models/functions/datetime.pyi index fde368f62..4843ac389 100644 --- a/django-stubs/db/models/functions/datetime.pyi +++ b/django-stubs/db/models/functions/datetime.pyi @@ -16,7 +16,7 @@ class Extract(TimezoneMixin, Transform): lookup_name: str output_field: ClassVar[models.IntegerField] def __init__( - self, expression: Combinable | str, lookup_name: str | None = ..., tzinfo: Any | None = ..., **extra: Any + self, expression: Combinable | str, lookup_name: str | None = None, tzinfo: Any | None = None, **extra: Any ) -> None: ... class ExtractYear(Extract): ... @@ -41,7 +41,11 @@ class TruncBase(TimezoneMixin, Transform): tzinfo: Any def __init__( - self, expression: Combinable | str, output_field: Field | None = ..., tzinfo: tzinfo | None = ..., **extra: Any + self, + expression: Combinable | str, + output_field: Field | None = None, + tzinfo: tzinfo | None = None, + **extra: Any, ) -> None: ... def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] @@ -50,8 +54,8 @@ class Trunc(TruncBase): self, expression: Combinable | str, kind: str, - output_field: Field | None = ..., - tzinfo: tzinfo | None = ..., + output_field: Field | None = None, + tzinfo: tzinfo | None = None, **extra: Any, ) -> None: ... diff --git a/django-stubs/db/models/functions/math.pyi b/django-stubs/db/models/functions/math.pyi index bce9c23a3..eafb68f52 100644 --- a/django-stubs/db/models/functions/math.pyi +++ b/django-stubs/db/models/functions/math.pyi @@ -24,7 +24,7 @@ class Radians(NumericOutputFieldMixin, Transform): ... class Random(NumericOutputFieldMixin, Func): ... class Round(Transform): - def __init__(self, expression: Combinable | str, precision: int = ..., **extra: Any) -> None: ... + def __init__(self, expression: Combinable | str, precision: int = 0, **extra: Any) -> None: ... class Sin(NumericOutputFieldMixin, Transform): ... class Sqrt(NumericOutputFieldMixin, Transform): ... diff --git a/django-stubs/db/models/functions/text.pyi b/django-stubs/db/models/functions/text.pyi index 78d6093e6..d4e4f38e6 100644 --- a/django-stubs/db/models/functions/text.pyi +++ b/django-stubs/db/models/functions/text.pyi @@ -91,7 +91,7 @@ class StrIndex(Func): class Substr(Func): output_field: ClassVar[models.CharField] def __init__( - self, expression: Combinable | str, pos: Expression | int, length: Expression | int | None = ..., **extra: Any + self, expression: Combinable | str, pos: Expression | int, length: Expression | int | None = None, **extra: Any ) -> None: ... def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... diff --git a/django-stubs/db/models/functions/window.pyi b/django-stubs/db/models/functions/window.pyi index 59152c395..173d0427d 100644 --- a/django-stubs/db/models/functions/window.pyi +++ b/django-stubs/db/models/functions/window.pyi @@ -12,17 +12,17 @@ class DenseRank(Func): class FirstValue(Func): ... class LagLeadFunction(Func): - def __init__(self, expression: str | None, offset: int = ..., default: int | None = ..., **extra: Any) -> None: ... + def __init__(self, expression: str | None, offset: int = 1, default: int | None = None, **extra: Any) -> None: ... class Lag(LagLeadFunction): ... class LastValue(Func): ... class Lead(LagLeadFunction): ... class NthValue(Func): - def __init__(self, expression: str | None, nth: int = ..., **extra: Any) -> None: ... + def __init__(self, expression: str | None, nth: int = 1, **extra: Any) -> None: ... class Ntile(Func): - def __init__(self, num_buckets: int = ..., **extra: Any) -> None: ... + def __init__(self, num_buckets: int = 1, **extra: Any) -> None: ... output_field: ClassVar[models.IntegerField] class PercentRank(Func): diff --git a/django-stubs/db/models/indexes.pyi b/django-stubs/db/models/indexes.pyi index 9041eb6ed..eefdeb36b 100644 --- a/django-stubs/db/models/indexes.pyi +++ b/django-stubs/db/models/indexes.pyi @@ -24,17 +24,17 @@ class Index: def __init__( self, *expressions: BaseExpression | Combinable | str, - fields: Sequence[str] = ..., - name: str | None = ..., - db_tablespace: str | None = ..., - opclasses: Sequence[str] = ..., - condition: Q | None = ..., - include: Sequence[str] | None = ..., + fields: Sequence[str] = (), + name: str | None = None, + db_tablespace: str | None = None, + opclasses: Sequence[str] = (), + condition: Q | None = None, + include: Sequence[str] | None = None, ) -> None: ... @property def contains_expressions(self) -> bool: ... def create_sql( - self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = ..., **kwargs: Any + self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = "", **kwargs: Any ) -> Statement: ... def remove_sql(self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, **kwargs: Any) -> str: ... def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ... @@ -44,15 +44,15 @@ class Index: class IndexExpression(Func): template: str wrapper_classes: Sequence[Expression] - def set_wrapper_classes(self, connection: Any | None = ...) -> None: ... + def set_wrapper_classes(self, connection: Any | None = None) -> None: ... @classmethod def register_wrappers(cls, *wrapper_classes: Expression) -> None: ... def resolve_expression( self, - query: Any | None = ..., - allow_joins: bool = ..., - reuse: set[str] | None = ..., - summarize: bool = ..., - for_save: bool = ..., + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, ) -> IndexExpression: ... def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... diff --git a/django-stubs/db/models/lookups.pyi b/django-stubs/db/models/lookups.pyi index f863ae8ac..fe4ba2bc8 100644 --- a/django-stubs/db/models/lookups.pyi +++ b/django-stubs/db/models/lookups.pyi @@ -22,14 +22,14 @@ class Lookup(Expression, Generic[_T]): def __init__(self, lhs: Any, rhs: Any) -> None: ... def apply_bilateral_transforms(self, value: Expression) -> Expression: ... def batch_process_rhs( - self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet | None = ... + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet | None = None ) -> tuple[list[str], list[str]]: ... def get_source_expressions(self) -> list[Expression]: ... def set_source_expressions(self, new_exprs: Sequence[Combinable | Expression]) -> None: ... def get_prep_lookup(self) -> Any: ... def get_db_prep_lookup(self, value: _ParamT, connection: BaseDatabaseWrapper) -> _AsSqlType: ... def process_lhs( - self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Expression | None = ... + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Expression | None = None ) -> _AsSqlType: ... def process_rhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... def rhs_is_direct_value(self) -> bool: ... @@ -52,7 +52,7 @@ class Transform(RegisterLookupMixin, Func): class BuiltinLookup(Lookup[_T]): def process_lhs( - self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Expression | None = ... + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Expression | None = None ) -> _AsSqlType: ... def get_rhs_op(self, connection: BaseDatabaseWrapper, rhs: str) -> str: ... diff --git a/django-stubs/db/models/manager.pyi b/django-stubs/db/models/manager.pyi index 710badb23..d140eb806 100644 --- a/django-stubs/db/models/manager.pyi +++ b/django-stubs/db/models/manager.pyi @@ -24,11 +24,11 @@ class BaseManager(Generic[_T]): ) -> tuple[bool, str | None, str | None, Sequence[Any] | None, dict[str, Any] | None]: ... def check(self, **kwargs: Any) -> list[Any]: ... @classmethod - def from_queryset(cls, queryset_class: type[QuerySet[_T]], class_name: str | None = ...) -> type[Self]: ... + def from_queryset(cls, queryset_class: type[QuerySet[_T]], class_name: str | None = None) -> type[Self]: ... @classmethod def _get_queryset_methods(cls, queryset_class: type) -> dict[str, Any]: ... def contribute_to_class(self, cls: type[Model], name: str) -> None: ... - def db_manager(self, using: str | None = ..., hints: dict[str, Model] | None = ...) -> Self: ... + def db_manager(self, using: str | None = None, hints: dict[str, Model] | None = None) -> Self: ... @property def db(self) -> str: ... def get_queryset(self) -> QuerySet[_T]: ... @@ -151,9 +151,9 @@ class ManagerDescriptor: manager: BaseManager def __init__(self, manager: BaseManager) -> None: ... @overload - def __get__(self, instance: None, cls: type[Model] | None = ...) -> BaseManager: ... + def __get__(self, instance: None, cls: type[Model] | None = None) -> BaseManager: ... @overload - def __get__(self, instance: Model, cls: type[Model] | None = ...) -> NoReturn: ... + def __get__(self, instance: Model, cls: type[Model] | None = None) -> NoReturn: ... class EmptyManager(Manager[_T]): def __init__(self, model: type[_T]) -> None: ... diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index e2f269c7c..227b877ff 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -81,7 +81,7 @@ class Options(Generic[_M]): default_related_name: str | None model: type[Model] original_attrs: dict[str, Any] - def __init__(self, meta: type | None, app_label: str | None = ...) -> None: ... + def __init__(self, meta: type | None, app_label: str | None = None) -> None: ... @property def label(self) -> str: ... @property @@ -92,7 +92,7 @@ class Options(Generic[_M]): def installed(self) -> bool: ... def contribute_to_class(self, cls: type[Model], name: str) -> None: ... def add_manager(self, manager: Manager) -> None: ... - def add_field(self, field: GenericForeignKey | Field[Any, Any], private: bool = ...) -> None: ... + def add_field(self, field: GenericForeignKey | Field[Any, Any], private: bool = False) -> None: ... # if GenericForeignKey is passed as argument, it has primary_key = True set before def setup_pk(self, field: GenericForeignKey | Field[Any, Any]) -> None: ... def setup_proxy(self, target: type[Model]) -> None: ... @@ -120,15 +120,15 @@ class Options(Generic[_M]): def get_path_to_parent(self, parent: type[Model]) -> list[PathInfo]: ... def get_path_from_parent(self, parent: type[Model]) -> list[PathInfo]: ... def get_fields( - self, include_parents: bool = ..., include_hidden: bool = ... + self, include_parents: bool = True, include_hidden: bool = False ) -> list[Field[Any, Any] | ForeignObjectRel | GenericForeignKey]: ... def _get_fields( self, - forward: bool = ..., - reverse: bool = ..., - include_parents: bool | object = ..., - include_hidden: bool = ..., - topmost_call: bool = ..., + forward: bool = True, + reverse: bool = True, + include_parents: bool | object = True, + include_hidden: bool = False, + topmost_call: bool = True, ) -> list[Field[Any, Any] | ForeignObjectRel | GenericForeignKey]: ... @cached_property def total_unique_constraints(self) -> list[UniqueConstraint]: ... diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index 0f98ea7ce..7822e021f 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -23,7 +23,7 @@ class BaseIterable(Generic[_T]): queryset: QuerySet[Model] chunked_fetch: bool chunk_size: int - def __init__(self, queryset: QuerySet[Model], chunked_fetch: bool = ..., chunk_size: int = ...) -> None: ... + def __init__(self, queryset: QuerySet[Model], chunked_fetch: bool = False, chunk_size: int = 100) -> None: ... def __aiter__(self) -> AsyncIterator[_T]: ... class ModelIterable(Generic[_Model], BaseIterable[_Model]): @@ -51,10 +51,10 @@ class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): _result_cache: list[_Row] | None def __init__( self, - model: type[Model] | None = ..., - query: Query | None = ..., - using: str | None = ..., - hints: dict[str, Model] | None = ..., + model: type[Model] | None = None, + query: Query | None = None, + using: str | None = None, + hints: dict[str, Model] | None = None, ) -> None: ... @classmethod def as_manager(cls) -> Manager[_Model]: ... @@ -67,8 +67,8 @@ class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): def __or__(self, other: QuerySet[_Model, _Row]) -> Self: ... # IMPORTANT: When updating any of the following methods' signatures, please ALSO modify # the corresponding method in BaseManager. - def iterator(self, chunk_size: int | None = ...) -> Iterator[_Row]: ... - def aiterator(self, chunk_size: int = ...) -> AsyncIterator[_Row]: ... + def iterator(self, chunk_size: int | None = None) -> Iterator[_Row]: ... + def aiterator(self, chunk_size: int = 2000) -> AsyncIterator[_Row]: ... def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... def get(self, *args: Any, **kwargs: Any) -> _Row: ... @@ -78,37 +78,37 @@ class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): def bulk_create( self, objs: Iterable[_Model], - batch_size: int | None = ..., - ignore_conflicts: bool = ..., - update_conflicts: bool = ..., - update_fields: Collection[str] | None = ..., - unique_fields: Collection[str] | None = ..., + batch_size: int | None = None, + ignore_conflicts: bool = False, + update_conflicts: bool = False, + update_fields: Collection[str] | None = None, + unique_fields: Collection[str] | None = None, ) -> list[_Model]: ... async def abulk_create( self, objs: Iterable[_Model], - batch_size: int | None = ..., - ignore_conflicts: bool = ..., - update_conflicts: bool = ..., - update_fields: Collection[str] | None = ..., - unique_fields: Collection[str] | None = ..., + batch_size: int | None = None, + ignore_conflicts: bool = False, + update_conflicts: bool = False, + update_fields: Collection[str] | None = None, + unique_fields: Collection[str] | None = None, ) -> list[_Model]: ... - def bulk_update(self, objs: Iterable[_Model], fields: Iterable[str], batch_size: int | None = ...) -> int: ... + def bulk_update(self, objs: Iterable[_Model], fields: Iterable[str], batch_size: int | None = None) -> int: ... async def abulk_update( - self, objs: Iterable[_Model], fields: Iterable[str], batch_size: int | None = ... + self, objs: Iterable[_Model], fields: Iterable[str], batch_size: int | None = None ) -> int: ... - def get_or_create(self, defaults: Mapping[str, Any] | None = ..., **kwargs: Any) -> tuple[_Model, bool]: ... - async def aget_or_create(self, defaults: Mapping[str, Any] | None = ..., **kwargs: Any) -> tuple[_Model, bool]: ... + def get_or_create(self, defaults: Mapping[str, Any] | None = None, **kwargs: Any) -> tuple[_Model, bool]: ... + async def aget_or_create(self, defaults: Mapping[str, Any] | None = None, **kwargs: Any) -> tuple[_Model, bool]: ... def update_or_create( self, - defaults: Mapping[str, Any] | None = ..., - create_defaults: Mapping[str, Any] | None = ..., + defaults: Mapping[str, Any] | None = None, + create_defaults: Mapping[str, Any] | None = None, **kwargs: Any, ) -> tuple[_Model, bool]: ... async def aupdate_or_create( self, - defaults: Mapping[str, Any] | None = ..., - create_defaults: Mapping[str, Any] | None = ..., + defaults: Mapping[str, Any] | None = None, + create_defaults: Mapping[str, Any] | None = None, **kwargs: Any, ) -> tuple[_Model, bool]: ... def earliest(self, *fields: str | OrderBy) -> _Row: ... @@ -119,32 +119,34 @@ class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): async def afirst(self) -> _Row | None: ... def last(self) -> _Row | None: ... async def alast(self) -> _Row | None: ... - def in_bulk(self, id_list: Iterable[Any] | None = ..., *, field_name: str = ...) -> dict[Any, _Model]: ... - async def ain_bulk(self, id_list: Iterable[Any] | None = ..., *, field_name: str = ...) -> dict[Any, _Model]: ... + def in_bulk(self, id_list: Iterable[Any] | None = None, *, field_name: str = "pk") -> dict[Any, _Model]: ... + async def ain_bulk(self, id_list: Iterable[Any] | None = None, *, field_name: str = "pk") -> dict[Any, _Model]: ... def delete(self) -> tuple[int, dict[str, int]]: ... async def adelete(self) -> tuple[int, dict[str, int]]: ... def update(self, **kwargs: Any) -> int: ... async def aupdate(self, **kwargs: Any) -> int: ... def exists(self) -> bool: ... async def aexists(self) -> bool: ... - def explain(self, *, format: Any | None = ..., **options: Any) -> str: ... - async def aexplain(self, *, format: Any | None = ..., **options: Any) -> str: ... + def explain(self, *, format: Any | None = None, **options: Any) -> str: ... + async def aexplain(self, *, format: Any | None = None, **options: Any) -> str: ... def contains(self, obj: Model) -> bool: ... async def acontains(self, obj: Model) -> bool: ... def raw( self, raw_query: _ExecuteQuery, - params: Any = ..., - translations: dict[str, str] | None = ..., - using: str | None = ..., + params: Any = (), + translations: dict[str, str] | None = None, + using: str | None = None, ) -> RawQuerySet: ... # The type of values may be overridden to be more specific in the mypy plugin, depending on the fields param def values(self, *fields: str | Combinable, **expressions: Any) -> QuerySet[_Model, dict[str, Any]]: ... # The type of values_list may be overridden to be more specific in the mypy plugin, depending on the fields param - def values_list(self, *fields: str | Combinable, flat: bool = ..., named: bool = ...) -> QuerySet[_Model, Any]: ... - def dates(self, field_name: str, kind: str, order: str = ...) -> QuerySet[_Model, datetime.date]: ... + def values_list( + self, *fields: str | Combinable, flat: bool = False, named: bool = False + ) -> QuerySet[_Model, Any]: ... + def dates(self, field_name: str, kind: str, order: str = "ASC") -> QuerySet[_Model, datetime.date]: ... def datetimes( - self, field_name: str, kind: str, order: str = ..., tzinfo: datetime.tzinfo | None = ... + self, field_name: str, kind: str, order: str = "ASC", tzinfo: datetime.tzinfo | None = None ) -> QuerySet[_Model, datetime.datetime]: ... def none(self) -> Self: ... def all(self) -> Self: ... @@ -153,11 +155,11 @@ class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): def complex_filter(self, filter_obj: Any) -> Self: ... def count(self) -> int: ... async def acount(self) -> int: ... - def union(self, *other_qs: Any, all: bool = ...) -> Self: ... + def union(self, *other_qs: Any, all: bool = False) -> Self: ... def intersection(self, *other_qs: Any) -> Self: ... def difference(self, *other_qs: Any) -> Self: ... def select_for_update( - self, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ..., no_key: bool = ... + self, nowait: bool = False, skip_locked: bool = False, of: Sequence[str] = (), no_key: bool = False ) -> Self: ... def select_related(self, *fields: Any) -> Self: ... def prefetch_related(self, *lookups: Any) -> Self: ... @@ -168,12 +170,12 @@ class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): # extra() return type won't be supported any time soon def extra( self, - select: dict[str, Any] | None = ..., - where: Sequence[str] | None = ..., - params: Sequence[Any] | None = ..., - tables: Sequence[str] | None = ..., - order_by: Sequence[str] | None = ..., - select_params: Sequence[Any] | None = ..., + select: dict[str, Any] | None = None, + where: Sequence[str] | None = None, + params: Sequence[Any] | None = None, + tables: Sequence[str] | None = None, + order_by: Sequence[str] | None = None, + select_params: Sequence[Any] | None = None, ) -> QuerySet[Any, Any]: ... def reverse(self) -> Self: ... def defer(self, *fields: Any) -> Self: ... @@ -198,12 +200,12 @@ class RawQuerySet(Iterable[_Model], Sized): def __init__( self, raw_query: RawQuery | str, - model: type[Model] | None = ..., - query: Query | None = ..., - params: tuple[Any] = ..., - translations: dict[str, str] | None = ..., - using: str = ..., - hints: dict[str, Model] | None = ..., + model: type[Model] | None = None, + query: Query | None = None, + params: tuple[Any, ...] = (), + translations: dict[str, str] | None = None, + using: str | None = None, + hints: dict[str, Model] | None = None, ) -> None: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_Model]: ... @@ -233,7 +235,7 @@ class Prefetch: prefetch_to: str queryset: QuerySet | None to_attr: str | None - def __init__(self, lookup: str, queryset: QuerySet | None = ..., to_attr: str | None = ...) -> None: ... + def __init__(self, lookup: str, queryset: QuerySet | None = None, to_attr: str | None = None) -> None: ... def __getstate__(self) -> dict[str, Any]: ... def add_prefix(self, prefix: str) -> None: ... def get_current_prefetch_to(self, level: int) -> str: ... diff --git a/django-stubs/db/models/query_utils.pyi b/django-stubs/db/models/query_utils.pyi index 29e62e571..a3bf09700 100644 --- a/django-stubs/db/models/query_utils.pyi +++ b/django-stubs/db/models/query_utils.pyi @@ -36,14 +36,14 @@ class Q(tree.Node): def __invert__(self) -> Q: ... def resolve_expression( self, - query: Query = ..., - allow_joins: bool = ..., - reuse: set[str] | None = ..., - summarize: bool = ..., - for_save: bool = ..., + query: Query | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, ) -> WhereNode: ... def flatten(self) -> Iterator[Incomplete]: ... - def check(self, against: dict[str, Any], using: str = ...) -> bool: ... + def check(self, against: dict[str, Any], using: str = "default") -> bool: ... def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ... @cached_property def referenced_base_fields(self) -> set[str]: ... @@ -65,16 +65,16 @@ class RegisterLookupMixin: @staticmethod def merge_dicts(dicts: Iterable[dict[str, Any]]) -> dict[str, Any]: ... @classmethod - def register_lookup(cls, lookup: _R, lookup_name: str | None = ...) -> _R: ... + def register_lookup(cls, lookup: _R, lookup_name: str | None = None) -> _R: ... @classmethod - def _unregister_lookup(cls, lookup: type[Lookup], lookup_name: str | None = ...) -> None: ... + def _unregister_lookup(cls, lookup: type[Lookup], lookup_name: str | None = None) -> None: ... def select_related_descend( field: Field, restricted: bool, requested: Mapping[str, Any] | None, load_fields: Collection[str] | None, - reverse: bool = ..., + reverse: bool = False, ) -> bool: ... _E = TypeVar("_E", bound=BaseExpression) diff --git a/django-stubs/db/models/signals.pyi b/django-stubs/db/models/signals.pyi index 3bb497477..07784be1e 100644 --- a/django-stubs/db/models/signals.pyi +++ b/django-stubs/db/models/signals.pyi @@ -10,17 +10,17 @@ class ModelSignal(Signal): def connect( # type: ignore[override] self, receiver: Callable, - sender: type[Model] | str | None = ..., - weak: bool = ..., - dispatch_uid: str | None = ..., - apps: Apps | None = ..., + sender: type[Model] | str | None = None, + weak: bool = True, + dispatch_uid: str | None = None, + apps: Apps | None = None, ) -> None: ... def disconnect( # type: ignore[override] self, - receiver: Callable | None = ..., - sender: type[Model] | str | None = ..., - dispatch_uid: str | None = ..., - apps: Apps | None = ..., + receiver: Callable | None = None, + sender: type[Model] | str | None = None, + dispatch_uid: str | None = None, + apps: Apps | None = None, ) -> bool | None: ... pre_init: ModelSignal diff --git a/django-stubs/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi index dab6897da..93a54ac57 100644 --- a/django-stubs/db/models/sql/compiler.pyi +++ b/django-stubs/db/models/sql/compiler.pyi @@ -32,9 +32,9 @@ class SQLCompiler: ordering_parts: Any def __init__(self, query: Query, connection: BaseDatabaseWrapper, using: str | None) -> None: ... col_count: int | None - def setup_query(self, with_col_aliases: bool = ...) -> None: ... + def setup_query(self, with_col_aliases: bool = False) -> None: ... has_extra_select: Any - def pre_sql_setup(self, with_col_aliases: bool = ...) -> tuple[ + def pre_sql_setup(self, with_col_aliases: bool = False) -> tuple[ list[tuple[Expression, _AsSqlType, None]], list[tuple[Expression, tuple[str, _ParamsT, bool]]], list[_AsSqlType], @@ -48,7 +48,7 @@ class SQLCompiler: self, expressions: list[Expression], having: list[Expression] | tuple ) -> list[Expression]: ... def get_select( - self, with_col_aliases: bool = ... + self, with_col_aliases: bool = False ) -> tuple[list[tuple[Expression, _AsSqlType, str | None]], dict[str, Any] | None, dict[str, int]]: ... def _order_by_pairs(self) -> None: ... def get_order_by(self) -> list[tuple[Expression, tuple[str, _ParamsT, bool]]]: ... @@ -60,28 +60,28 @@ class SQLCompiler: def quote_name_unless_alias(self, name: str) -> str: ... def compile(self, node: BaseExpression) -> _AsSqlType: ... def get_combinator_sql(self, combinator: str, all: bool) -> tuple[list[str], list[int] | list[str]]: ... - def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...) -> _AsSqlType: ... + def as_sql(self, with_limits: bool = True, with_col_aliases: bool = False) -> _AsSqlType: ... def get_default_columns( - self, start_alias: str | None = ..., opts: Any | None = ..., from_parent: type[Model] | None = ... + self, start_alias: str | None = None, opts: Any | None = None, from_parent: type[Model] | None = None ) -> list[Expression]: ... def get_distinct(self) -> tuple[list[Any], list[Any]]: ... def find_ordering_name( self, name: str, opts: Any, - alias: str | None = ..., - default_order: str = ..., - already_seen: set[tuple[tuple[tuple[str, str]] | None, tuple[tuple[str, str]]]] | None = ..., + alias: str | None = None, + default_order: str = "ASC", + already_seen: set[tuple[tuple[tuple[str, str]] | None, tuple[tuple[str, str]]]] | None = None, ) -> list[tuple[Expression, bool]]: ... def get_from_clause(self) -> tuple[list[str], _ParamsT]: ... def get_related_selections( self, select: list[tuple[Expression, str | None]], - opts: Any | None = ..., - root_alias: str | None = ..., - cur_depth: int = ..., - requested: dict[str, dict[str, dict[str, dict[Any, Any]]]] | None = ..., - restricted: bool | None = ..., + opts: Any | None = None, + root_alias: str | None = None, + cur_depth: int = 1, + requested: dict[str, dict[str, dict[str, dict[Any, Any]]]] | None = None, + restricted: bool | None = None, ) -> list[dict[str, Any]]: ... def get_select_for_update_of_arguments(self) -> list[Any]: ... def deferred_to_columns(self) -> dict[type[Model], set[str]]: ... @@ -91,27 +91,30 @@ class SQLCompiler: ) -> Iterator[list[None | date | datetime | float | Decimal | UUID | bytes | str]]: ... def results_iter( self, - results: Iterable[list[Sequence[Any]]] | None = ..., - tuple_expected: bool = ..., - chunked_fetch: bool = ..., - chunk_size: int = ..., + results: Iterable[list[Sequence[Any]]] | None = None, + tuple_expected: bool = False, + chunked_fetch: bool = False, + chunk_size: int = 100, ) -> Iterator[Sequence[Any]]: ... def has_results(self) -> bool: ... @overload def execute_sql( - self, result_type: Literal["cursor"] = "cursor", chunked_fetch: bool = ..., chunk_size: int = ... + self, result_type: Literal["cursor"] = "cursor", chunked_fetch: bool = False, chunk_size: int = 100 ) -> CursorWrapper: ... @overload def execute_sql( - self, result_type: Literal["no results"] | None = ..., chunked_fetch: bool = ..., chunk_size: int = ... + self, + result_type: Literal["no results"] | None = "no results", + chunked_fetch: bool = False, + chunk_size: int = 100, ) -> None: ... @overload def execute_sql( - self, result_type: Literal["single"] = "single", chunked_fetch: bool = ..., chunk_size: int = ... + self, result_type: Literal["single"] = "single", chunked_fetch: bool = False, chunk_size: int = 100 ) -> Iterable[Sequence[Any]] | None: ... @overload def execute_sql( - self, result_type: Literal["multi"] = "multi", chunked_fetch: bool = ..., chunk_size: int = ... + self, result_type: Literal["multi"] = "multi", chunked_fetch: bool = False, chunk_size: int = 100 ) -> Iterable[list[Sequence[Any]]] | None: ... def as_subquery_condition(self, alias: str, columns: list[str], compiler: SQLCompiler) -> _AsSqlType: ... def explain_query(self) -> Iterator[str]: ... @@ -126,7 +129,7 @@ class SQLInsertCompiler(SQLCompiler): def assemble_as_sql(self, fields: Any, value_rows: Any) -> tuple[list[list[str]], list[list[Any]]]: ... def as_sql(self) -> list[_AsSqlType]: ... # type: ignore[override] def execute_sql( # type: ignore[override] - self, returning_fields: Sequence[str] | None = ... + self, returning_fields: Sequence[str] | None = None ) -> list[tuple[Any]]: ... # 1-tuple class SQLDeleteCompiler(SQLCompiler): diff --git a/django-stubs/db/models/sql/datastructures.pyi b/django-stubs/db/models/sql/datastructures.pyi index f19455bec..a0d1a5389 100644 --- a/django-stubs/db/models/sql/datastructures.pyi +++ b/django-stubs/db/models/sql/datastructures.pyi @@ -29,7 +29,7 @@ class Join: join_type: str, join_field: FieldCacheMixin, nullable: bool, - filtered_relation: FilteredRelation | None = ..., + filtered_relation: FilteredRelation | None = None, ) -> None: ... def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... def relabeled_clone(self, change_map: dict[str | None, str]) -> Join: ... diff --git a/django-stubs/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi index 8e92b806e..a9dfe39bb 100644 --- a/django-stubs/db/models/sql/query.pyi +++ b/django-stubs/db/models/sql/query.pyi @@ -24,7 +24,7 @@ class RawQuery: extra_select: dict[Any, Any] annotation_select: dict[Any, Any] cursor: CursorWrapper | None - def __init__(self, sql: str, using: str, params: Any = ...) -> None: ... + def __init__(self, sql: str, using: str, params: Any = ()) -> None: ... def chain(self, using: str) -> RawQuery: ... def clone(self, using: str) -> RawQuery: ... def get_columns(self) -> list[str]: ... @@ -102,17 +102,17 @@ class Query(BaseExpression): ) -> tuple[list[Any], Any, tuple[Any, ...], list[str]]: ... def get_meta(self) -> Options: ... def clone(self) -> Query: ... - def chain(self, klass: type[Query] | None = ...) -> Query: ... + def chain(self, klass: type[Query] | None = None) -> Query: ... def get_count(self, using: str) -> int: ... def get_group_by_cols(self, wrapper: Any | None = None) -> list[Any]: ... def has_filters(self) -> WhereNode: ... def get_external_cols(self) -> list[Any]: ... def exists(self, limit: bool = True) -> Any: ... def has_results(self, using: str) -> bool: ... - def explain(self, using: str, format: str | None = ..., **options: Any) -> str: ... + def explain(self, using: str, format: str | None = None, **options: Any) -> str: ... def combine(self, rhs: Query, connector: str) -> None: ... def ref_alias(self, alias: str) -> None: ... - def unref_alias(self, alias: str, amount: int = ...) -> None: ... + def unref_alias(self, alias: str, amount: int = 1) -> None: ... def promote_joins(self, aliases: Iterable[str]) -> None: ... def demote_joins(self, aliases: Iterable[str]) -> None: ... def reset_refcounts(self, to_counts: dict[str, int]) -> None: ... @@ -156,14 +156,14 @@ class Query(BaseExpression): names: Sequence[str], opts: Any, alias: str, - can_reuse: set[str] | None = ..., - allow_many: bool = ..., + can_reuse: set[str] | None = None, + allow_many: bool = True, ) -> JoinInfo: ... def trim_joins( self, targets: tuple[Field, ...], joins: list[str], path: list[PathInfo] ) -> tuple[tuple[Field, ...], str, list[str]]: ... def resolve_ref( - self, name: str, allow_joins: bool = ..., reuse: set[str] | None = ..., summarize: bool = ... + self, name: str, allow_joins: bool = True, reuse: set[str] | None = None, summarize: bool = False ) -> Expression: ... def split_exclude( self, @@ -173,7 +173,7 @@ class Query(BaseExpression): ) -> tuple[WhereNode, Iterable[str]]: ... def set_empty(self) -> None: ... def is_empty(self) -> bool: ... - def set_limits(self, low: int | None = ..., high: int | None = ...) -> None: ... + def set_limits(self, low: int | None = None, high: int | None = None) -> None: ... def clear_limits(self) -> None: ... @property def is_sliced(self) -> bool: ... @@ -183,11 +183,11 @@ class Query(BaseExpression): def clear_select_fields(self) -> None: ... def set_select(self, cols: list[Expression]) -> None: ... def add_distinct_fields(self, *field_names: Any) -> None: ... - def add_fields(self, field_names: Iterable[str], allow_m2m: bool = ...) -> None: ... + def add_fields(self, field_names: Iterable[str], allow_m2m: bool = True) -> None: ... def add_ordering(self, *ordering: str | OrderBy) -> None: ... def clear_where(self) -> None: ... def clear_ordering(self, force: bool = False, clear_default: bool = True) -> None: ... - def set_group_by(self, allow_aliases: bool = ...) -> None: ... + def set_group_by(self, allow_aliases: bool = True) -> None: ... def add_select_related(self, fields: Iterable[str]) -> None: ... def add_extra( self, @@ -218,7 +218,7 @@ class Query(BaseExpression): def join( self, join: BaseTable | Join, - reuse: str | None = ..., + reuse: str | None = None, ) -> str: ... class JoinPromoter: diff --git a/django-stubs/db/models/sql/subqueries.pyi b/django-stubs/db/models/sql/subqueries.pyi index ef996eb92..b763fcedb 100644 --- a/django-stubs/db/models/sql/subqueries.pyi +++ b/django-stubs/db/models/sql/subqueries.pyi @@ -33,7 +33,7 @@ class InsertQuery(Query): objs: list[Model] raw: bool def __init__(self, *args: Any, ignore_conflicts: bool = ..., **kwargs: Any) -> None: ... - def insert_values(self, fields: Iterable[Field], objs: list[Model], raw: bool = ...) -> None: ... + def insert_values(self, fields: Iterable[Field], objs: list[Model], raw: bool = False) -> None: ... class AggregateQuery(Query): select: tuple diff --git a/django-stubs/db/models/sql/where.pyi b/django-stubs/db/models/sql/where.pyi index 6e855e45d..496f699f5 100644 --- a/django-stubs/db/models/sql/where.pyi +++ b/django-stubs/db/models/sql/where.pyi @@ -37,7 +37,7 @@ class WhereNode(tree.Node): class NothingNode: contains_aggregate: bool def as_sql( - self, compiler: SQLCompiler | None = ..., connection: BaseDatabaseWrapper | None = ... + self, compiler: SQLCompiler | None = None, connection: BaseDatabaseWrapper | None = None ) -> _AsSqlType: ... class ExtraWhere: @@ -46,7 +46,7 @@ class ExtraWhere: params: Sequence[int] | Sequence[str] | None def __init__(self, sqls: Sequence[str], params: Sequence[int] | Sequence[str] | None) -> None: ... def as_sql( - self, compiler: SQLCompiler | None = ..., connection: BaseDatabaseWrapper | None = ... + self, compiler: SQLCompiler | None = None, connection: BaseDatabaseWrapper | None = None ) -> _AsSqlType: ... class SubqueryConstraint: diff --git a/django-stubs/db/transaction.pyi b/django-stubs/db/transaction.pyi index 868b8b508..9791dad70 100644 --- a/django-stubs/db/transaction.pyi +++ b/django-stubs/db/transaction.pyi @@ -7,20 +7,20 @@ from django.db import ProgrammingError class TransactionManagementError(ProgrammingError): ... -def get_connection(using: str | None = ...) -> Any: ... -def get_autocommit(using: str | None = ...) -> bool: ... -def set_autocommit(autocommit: bool, using: str | None = ...) -> Any: ... -def commit(using: str | None = ...) -> None: ... -def rollback(using: str | None = ...) -> None: ... -def savepoint(using: str | None = ...) -> str: ... -def savepoint_rollback(sid: str, using: str | None = ...) -> None: ... -def savepoint_commit(sid: str, using: str | None = ...) -> None: ... -def clean_savepoints(using: str | None = ...) -> None: ... -def get_rollback(using: str | None = ...) -> bool: ... -def set_rollback(rollback: bool, using: str | None = ...) -> None: ... +def get_connection(using: str | None = None) -> Any: ... +def get_autocommit(using: str | None = None) -> bool: ... +def set_autocommit(autocommit: bool, using: str | None = None) -> Any: ... +def commit(using: str | None = None) -> None: ... +def rollback(using: str | None = None) -> None: ... +def savepoint(using: str | None = None) -> str: ... +def savepoint_rollback(sid: str, using: str | None = None) -> None: ... +def savepoint_commit(sid: str, using: str | None = None) -> None: ... +def clean_savepoints(using: str | None = None) -> None: ... +def get_rollback(using: str | None = None) -> bool: ... +def set_rollback(rollback: bool, using: str | None = None) -> None: ... @contextmanager -def mark_for_rollback_on_error(using: str | None = ...) -> Iterator[None]: ... -def on_commit(func: Callable[[], object], using: str | None = ..., robust: bool = ...) -> None: ... +def mark_for_rollback_on_error(using: str | None = None) -> Iterator[None]: ... +def on_commit(func: Callable[[], object], using: str | None = None, robust: bool = False) -> None: ... _C = TypeVar("_C", bound=Callable) # Any callable @@ -45,7 +45,7 @@ def atomic(using: _C) -> _C: ... # Decorator or context-manager with parameters @overload -def atomic(using: str | None = ..., savepoint: bool = ..., durable: bool = ...) -> Atomic: ... +def atomic(using: str | None = None, savepoint: bool = True, durable: bool = False) -> Atomic: ... # Bare decorator @overload @@ -53,4 +53,4 @@ def non_atomic_requests(using: _C) -> _C: ... # Decorator with arguments @overload -def non_atomic_requests(using: str | None = ...) -> Callable[[_C], _C]: ... +def non_atomic_requests(using: str | None = None) -> Callable[[_C], _C]: ... diff --git a/django-stubs/db/utils.pyi b/django-stubs/db/utils.pyi index d0dfae43c..59adc8a73 100644 --- a/django-stubs/db/utils.pyi +++ b/django-stubs/db/utils.pyi @@ -42,7 +42,7 @@ class ConnectionHandler(BaseConnectionHandler[BaseDatabaseWrapper]): def close_all(self) -> None: ... class ConnectionRouter: - def __init__(self, routers: Iterable[Any] | None = ...) -> None: ... + def __init__(self, routers: Iterable[Any] | None = None) -> None: ... @cached_property def routers(self) -> list[Any]: ... def db_for_read(self, model: type[Model], **hints: Any) -> str: ... @@ -51,5 +51,5 @@ class ConnectionRouter: def allow_migrate(self, db: str, app_label: str, **hints: Any) -> bool: ... def allow_migrate_model(self, db: str, model: type[Model]) -> bool: ... def get_migratable_models( - self, app_config: AppConfig, db: str, include_auto_created: bool = ... + self, app_config: AppConfig, db: str, include_auto_created: bool = False ) -> list[type[Model]]: ... diff --git a/django-stubs/dispatch/dispatcher.pyi b/django-stubs/dispatch/dispatcher.pyi index 02b6a0a70..7915285e7 100644 --- a/django-stubs/dispatch/dispatcher.pyi +++ b/django-stubs/dispatch/dispatcher.pyi @@ -14,14 +14,14 @@ class Signal: use_caching: bool sender_receivers_cache: MutableMapping[Any, Any] - def __init__(self, use_caching: bool = ...) -> None: ... + def __init__(self, use_caching: bool = False) -> None: ... def connect( - self, receiver: Callable, sender: object | None = ..., weak: bool = ..., dispatch_uid: Hashable | None = ... + self, receiver: Callable, sender: object | None = None, weak: bool = True, dispatch_uid: Hashable | None = None ) -> None: ... def disconnect( - self, receiver: Callable | None = ..., sender: object | None = ..., dispatch_uid: str | None = ... + self, receiver: Callable | None = None, sender: object | None = None, dispatch_uid: str | None = None ) -> bool: ... - def has_listeners(self, sender: Any = ...) -> bool: ... + def has_listeners(self, sender: Any | None = None) -> bool: ... def send(self, sender: Any, **named: Any) -> list[tuple[Callable, str | None]]: ... async def asend(self, sender: Any, **named: Any) -> list[tuple[Callable, str | None]]: ... def send_robust(self, sender: Any, **named: Any) -> list[tuple[Callable, Exception | Any]]: ... diff --git a/django-stubs/forms/boundfield.pyi b/django-stubs/forms/boundfield.pyi index e24c29fd8..38ccaa0d2 100644 --- a/django-stubs/forms/boundfield.pyi +++ b/django-stubs/forms/boundfield.pyi @@ -37,26 +37,26 @@ class BoundField(RenderableFieldMixin): @property def template_name(self) -> str: ... def as_widget( - self, widget: Widget | None = ..., attrs: _AttrsT | None = ..., only_initial: bool = ... + self, widget: Widget | None = None, attrs: _AttrsT | None = None, only_initial: bool = False ) -> SafeString: ... - def as_text(self, attrs: _AttrsT | None = ..., **kwargs: Any) -> SafeString: ... + def as_text(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ... def __html__(self) -> SafeString: ... - def as_textarea(self, attrs: _AttrsT | None = ..., **kwargs: Any) -> SafeString: ... - def as_hidden(self, attrs: _AttrsT | None = ..., **kwargs: Any) -> SafeString: ... + def as_textarea(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ... + def as_hidden(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ... @property def data(self) -> Any: ... def value(self) -> Any: ... def label_tag( self, - contents: str | None = ..., - attrs: _AttrsT | None = ..., - label_suffix: str | None = ..., - tag: str | None = ..., + contents: str | None = None, + attrs: _AttrsT | None = None, + label_suffix: str | None = None, + tag: str | None = None, ) -> SafeString: ... def legend_tag( - self, contents: str | None = ..., attrs: _AttrsT | None = ..., label_suffix: str | None = ... + self, contents: str | None = None, attrs: _AttrsT | None = None, label_suffix: str | None = None ) -> SafeString: ... - def css_classes(self, extra_classes: str | Iterable[str] | None = ...) -> str: ... + def css_classes(self, extra_classes: str | Iterable[str] | None = None) -> str: ... @property def is_hidden(self) -> bool: ... @property @@ -65,7 +65,7 @@ class BoundField(RenderableFieldMixin): def id_for_label(self) -> str: ... @property def initial(self) -> Any: ... - def build_widget_attrs(self, attrs: _AttrsT, widget: Widget | None = ...) -> _AttrsT: ... + def build_widget_attrs(self, attrs: _AttrsT, widget: Widget | None = None) -> _AttrsT: ... @property def widget_type(self) -> str: ... @property @@ -76,7 +76,7 @@ class BoundWidget: data: dict[str, Any] renderer: BaseRenderer def __init__(self, parent_widget: Widget, data: dict[str, Any], renderer: BaseRenderer) -> None: ... - def tag(self, wrap_label: bool = ...) -> SafeString: ... + def tag(self, wrap_label: bool = False) -> SafeString: ... @property def template_name(self) -> str: ... @property diff --git a/django-stubs/forms/fields.pyi b/django-stubs/forms/fields.pyi index 634540a85..31b93ea6f 100644 --- a/django-stubs/forms/fields.pyi +++ b/django-stubs/forms/fields.pyi @@ -44,18 +44,18 @@ class Field: def __init__( self, *, - required: bool = ..., - widget: Widget | type[Widget] | None = ..., - label: _StrOrPromise | None = ..., - initial: Any | None = ..., - help_text: _StrOrPromise = ..., - error_messages: _ErrorMessagesMapping | None = ..., - show_hidden_initial: bool = ..., - validators: Sequence[_ValidatorCallable] = ..., - localize: bool = ..., - disabled: bool = ..., - label_suffix: str | None = ..., - template_name: str | None = ..., + required: bool = True, + widget: Widget | type[Widget] | None = None, + label: _StrOrPromise | None = None, + initial: Any | None = None, + help_text: _StrOrPromise = "", + error_messages: _ErrorMessagesMapping | None = None, + show_hidden_initial: bool = False, + validators: Sequence[_ValidatorCallable] = (), + localize: bool = False, + disabled: bool = False, + label_suffix: str | None = None, + template_name: str | None = None, ) -> None: ... def prepare_value(self, value: Any) -> Any: ... def to_python(self, value: Any | None) -> Any | None: ... @@ -75,10 +75,10 @@ class CharField(Field): def __init__( self, *, - max_length: int | None = ..., - min_length: int | None = ..., - strip: bool = ..., - empty_value: str | None = ..., + max_length: int | None = None, + min_length: int | None = None, + strip: bool = True, + empty_value: str | None = "", required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -102,9 +102,9 @@ class IntegerField(Field): def __init__( self, *, - max_value: int | None = ..., - min_value: int | None = ..., - step_size: int | None = ..., + max_value: int | None = None, + min_value: int | None = None, + step_size: int | None = None, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -124,9 +124,9 @@ class FloatField(IntegerField): def __init__( self, *, - max_value: int | float | None = ..., - min_value: int | float | None = ..., - step_size: int | float | None = ..., + max_value: int | float | None = None, + min_value: int | float | None = None, + step_size: int | float | None = None, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -149,10 +149,10 @@ class DecimalField(IntegerField): def __init__( self, *, - max_value: Decimal | int | float | None = ..., - min_value: Decimal | int | float | None = ..., - max_digits: int | None = ..., - decimal_places: int | None = ..., + max_value: Decimal | int | float | None = None, + min_value: Decimal | int | float | None = None, + max_digits: int | None = None, + decimal_places: int | None = None, step_size: Decimal | int | float | None = ..., required: bool = ..., widget: Widget | type[Widget] | None = ..., @@ -175,7 +175,7 @@ class BaseTemporalField(Field): def __init__( self, *, - input_formats: Any | None = ..., + input_formats: Any | None = None, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -260,8 +260,8 @@ class FileField(Field): def __init__( self, *, - max_length: int | None = ..., - allow_empty_file: bool = ..., + max_length: int | None = None, + allow_empty_file: bool = False, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -274,7 +274,7 @@ class FileField(Field): disabled: bool = ..., label_suffix: str | None = ..., ) -> None: ... - def clean(self, data: Any, initial: Any | None = ...) -> Any: ... + def clean(self, data: Any, initial: Any | None = None) -> Any: ... def to_python(self, data: File | None) -> File | None: ... def bound_data(self, data: Any | None, initial: Any) -> Any: ... def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... @@ -302,7 +302,7 @@ class URLField(CharField): localize: bool = ..., disabled: bool = ..., label_suffix: str | None = ..., - assume_scheme: str | None = ..., + assume_scheme: str | None = None, ) -> None: ... def to_python(self, value: Any | None) -> str | None: ... @@ -324,7 +324,7 @@ class ChoiceField(Field): def __init__( self, *, - choices: _Choices | _ChoicesCallable = ..., + choices: _Choices | _ChoicesCallable = (), required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -354,7 +354,7 @@ class TypedChoiceField(ChoiceField): self, *, coerce: _CoerceCallable = ..., - empty_value: str | None = ..., + empty_value: str | None = "", choices: _Choices | _ChoicesCallable = ..., required: bool = ..., widget: Widget | type[Widget] | None = ..., @@ -426,7 +426,7 @@ class MultiValueField(Field): self, fields: Sequence[Field], *, - require_all_fields: bool = ..., + require_all_fields: bool = True, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -455,10 +455,10 @@ class FilePathField(ChoiceField): self, path: str, *, - match: str | None = ..., - recursive: bool = ..., - allow_files: bool = ..., - allow_folders: bool = ..., + match: str | None = None, + recursive: bool = False, + allow_files: bool = True, + allow_folders: bool = False, choices: _Choices | _ChoicesCallable = ..., required: bool = ..., widget: Widget | type[Widget] | None = ..., @@ -477,8 +477,8 @@ class SplitDateTimeField(MultiValueField): def __init__( self, *, - input_date_formats: Any | None = ..., - input_time_formats: Any | None = ..., + input_date_formats: Any | None = None, + input_time_formats: Any | None = None, fields: Sequence[Field] = ..., require_all_fields: bool = ..., required: bool = ..., @@ -500,8 +500,8 @@ class GenericIPAddressField(CharField): def __init__( self, *, - protocol: str = ..., - unpack_ipv4: bool = ..., + protocol: str = "both", + unpack_ipv4: bool = False, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -521,7 +521,7 @@ class SlugField(CharField): def __init__( self, *, - allow_unicode: bool = ..., + allow_unicode: bool = False, max_length: Any | None = ..., min_length: Any | None = ..., strip: bool = ..., @@ -551,7 +551,7 @@ class JSONField(CharField): widget: _ClassLevelWidgetT encoder: Any decoder: Any - def __init__(self, encoder: Any | None = ..., decoder: Any | None = ..., **kwargs: Any) -> None: ... + def __init__(self, encoder: Any | None = None, decoder: Any | None = None, **kwargs: Any) -> None: ... def to_python(self, value: Any) -> Any: ... def bound_data(self, data: Any, initial: Any) -> Any: ... def prepare_value(self, value: Any) -> str: ... diff --git a/django-stubs/forms/forms.pyi b/django-stubs/forms/forms.pyi index 46d9eb199..b7000dd05 100644 --- a/django-stubs/forms/forms.pyi +++ b/django-stubs/forms/forms.pyi @@ -34,17 +34,17 @@ class BaseForm(RenderableFormMixin): template_name_label: str def __init__( self, - data: _DataT | None = ..., - files: _FilesT | None = ..., - auto_id: bool | str = ..., - prefix: str | None = ..., - initial: Mapping[str, Any] | None = ..., + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: bool | str = "id_%s", + prefix: str | None = None, + initial: Mapping[str, Any] | None = None, error_class: type[ErrorList] = ..., - label_suffix: str | None = ..., - empty_permitted: bool = ..., - field_order: Iterable[str] | None = ..., - use_required_attribute: bool | None = ..., - renderer: BaseRenderer | None = ..., + label_suffix: str | None = None, + empty_permitted: bool = False, + field_order: Iterable[str] | None = None, + use_required_attribute: bool | None = None, + renderer: BaseRenderer | None = None, ) -> None: ... def order_fields(self, field_order: Iterable[str] | None) -> None: ... def __iter__(self) -> Iterator[BoundField]: ... @@ -58,7 +58,7 @@ class BaseForm(RenderableFormMixin): def template_name(self) -> str: ... def non_field_errors(self) -> ErrorList: ... def add_error(self, field: str | None, error: ValidationError | _StrOrPromise) -> None: ... - def has_error(self, field: str | None, code: str | None = ...) -> bool: ... + def has_error(self, field: str | None, code: str | None = None) -> bool: ... def full_clean(self) -> None: ... def clean(self) -> dict[str, Any] | None: ... def has_changed(self) -> bool: ... diff --git a/django-stubs/forms/formsets.pyi b/django-stubs/forms/formsets.pyi index 540dd0263..99c2eb937 100644 --- a/django-stubs/forms/formsets.pyi +++ b/django-stubs/forms/formsets.pyi @@ -54,14 +54,14 @@ class BaseFormSet(Generic[_F], Sized, RenderableFormMixin): template_name_ul: str def __init__( self, - data: _DataT | None = ..., - files: _FilesT | None = ..., - auto_id: str = ..., - prefix: str | None = ..., - initial: Sequence[Mapping[str, Any]] | None = ..., + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: str = "id_%s", + prefix: str | None = None, + initial: Sequence[Mapping[str, Any]] | None = None, error_class: type[ErrorList] = ..., - form_kwargs: dict[str, Any] | None = ..., - error_messages: Mapping[str, str] | None = ..., + form_kwargs: dict[str, Any] | None = None, + error_messages: Mapping[str, str] | None = None, form_renderer: BaseRenderer = ..., renderer: BaseRenderer = ..., ) -> None: ... @@ -113,14 +113,14 @@ class BaseFormSet(Generic[_F], Sized, RenderableFormMixin): def formset_factory( form: type[_F], formset: type[BaseFormSet[_F]] = ..., - extra: int = ..., - can_order: bool = ..., - can_delete: bool = ..., - max_num: int | None = ..., - validate_max: bool = ..., - min_num: int | None = ..., - validate_min: bool = ..., - absolute_max: int | None = ..., - can_delete_extra: bool = ..., + extra: int = 1, + can_order: bool = False, + can_delete: bool = False, + max_num: int | None = None, + validate_max: bool = False, + min_num: int | None = None, + validate_min: bool = False, + absolute_max: int | None = None, + can_delete_extra: bool = True, ) -> type[BaseFormSet[_F]]: ... def all_valid(formsets: Sequence[BaseFormSet[_F]]) -> bool: ... diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi index 8cf682220..b0204a3da 100644 --- a/django-stubs/forms/models.pyi +++ b/django-stubs/forms/models.pyi @@ -33,24 +33,24 @@ _M = TypeVar("_M", bound=Model) _ParentM = TypeVar("_ParentM", bound=Model) def construct_instance( - form: BaseForm, instance: _M, fields: Container[str] | None = ..., exclude: Container[str] | None = ... + form: BaseForm, instance: _M, fields: Container[str] | None = None, exclude: Container[str] | None = None ) -> _M: ... -def model_to_dict(instance: Model, fields: _Fields | None = ..., exclude: _Fields | None = ...) -> dict[str, Any]: ... +def model_to_dict(instance: Model, fields: _Fields | None = None, exclude: _Fields | None = None) -> dict[str, Any]: ... def apply_limit_choices_to_to_formfield(formfield: Field) -> None: ... def fields_for_model( model: type[Model], - fields: _Fields | None = ..., - exclude: _Fields | None = ..., - widgets: _Widgets | None = ..., - formfield_callback: _FormFieldCallback | None = ..., - localized_fields: _Fields | None = ..., - labels: _Labels | None = ..., - help_texts: _HelpTexts | None = ..., - error_messages: _ErrorMessages | None = ..., - field_classes: Mapping[str, type[Field]] | None = ..., + fields: _Fields | None = None, + exclude: _Fields | None = None, + widgets: _Widgets | None = None, + formfield_callback: _FormFieldCallback | None = None, + localized_fields: _Fields | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + field_classes: Mapping[str, type[Field]] | None = None, *, - apply_limit_choices_to: bool = ..., - form_declared_fields: _Fields | None = ..., + apply_limit_choices_to: bool = True, + form_declared_fields: _Fields | None = None, ) -> dict[str, Any]: ... class ModelFormOptions(Generic[_M]): @@ -64,7 +64,7 @@ class ModelFormOptions(Generic[_M]): error_messages: _ErrorMessages | None field_classes: dict[str, type[Field]] | None formfield_callback: _FormFieldCallback | None - def __init__(self, options: type | None = ...) -> None: ... + def __init__(self, options: type | None = None) -> None: ... class ModelFormMetaclass(DeclarativeFieldsMetaclass): ... @@ -73,20 +73,20 @@ class BaseModelForm(Generic[_M], BaseForm): _meta: ModelFormOptions[_M] def __init__( self, - data: _DataT | None = ..., - files: _FilesT | None = ..., - auto_id: bool | str = ..., - prefix: str | None = ..., - initial: Mapping[str, Any] | None = ..., + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: bool | str = "id_%s", + prefix: str | None = None, + initial: Mapping[str, Any] | None = None, error_class: type[ErrorList] = ..., - label_suffix: str | None = ..., - empty_permitted: bool = ..., - instance: _M | None = ..., - use_required_attribute: bool | None = ..., - renderer: BaseRenderer | None = ..., + label_suffix: str | None = None, + empty_permitted: bool = False, + instance: _M | None = None, + use_required_attribute: bool | None = None, + renderer: BaseRenderer | None = None, ) -> None: ... def validate_unique(self) -> None: ... - def save(self, commit: bool = ...) -> _M: ... + def save(self, commit: bool = True) -> _M: ... def save_m2m(self) -> None: ... class ModelForm(BaseModelForm[_M], metaclass=ModelFormMetaclass): @@ -95,15 +95,15 @@ class ModelForm(BaseModelForm[_M], metaclass=ModelFormMetaclass): def modelform_factory( model: type[_M], form: type[ModelForm[_M]] = ..., - fields: _Fields | None = ..., - exclude: _Fields | None = ..., - formfield_callback: _FormFieldCallback | None = ..., - widgets: _Widgets | None = ..., - localized_fields: _Fields | None = ..., - labels: _Labels | None = ..., - help_texts: _HelpTexts | None = ..., - error_messages: _ErrorMessages | None = ..., - field_classes: Mapping[str, type[Field]] | None = ..., + fields: _Fields | None = None, + exclude: _Fields | None = None, + formfield_callback: _FormFieldCallback | None = None, + widgets: _Widgets | None = None, + localized_fields: _Fields | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + field_classes: Mapping[str, type[Field]] | None = None, ) -> type[ModelForm[_M]]: ... _ModelFormT = TypeVar("_ModelFormT", bound=ModelForm) @@ -116,23 +116,23 @@ class BaseModelFormSet(Generic[_M, _ModelFormT], BaseFormSet[_ModelFormT]): initial_extra: Sequence[dict[str, Any]] | None def __init__( self, - data: _DataT | None = ..., - files: _FilesT | None = ..., - auto_id: str = ..., - prefix: str | None = ..., - queryset: QuerySet[_M] | None = ..., + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: str = "id_%s", + prefix: str | None = None, + queryset: QuerySet[_M] | None = None, *, - initial: Sequence[dict[str, Any]] | None = ..., + initial: Sequence[dict[str, Any]] | None = None, **kwargs: Any, ) -> None: ... def initial_form_count(self) -> int: ... def get_queryset(self) -> QuerySet[_M]: ... - def save_new(self, form: _ModelFormT, commit: bool = ...) -> _M: ... - def save_existing(self, form: _ModelFormT, obj: _M, commit: bool = ...) -> _M: ... - def delete_existing(self, obj: _M, commit: bool = ...) -> None: ... + def save_new(self, form: _ModelFormT, commit: bool = True) -> _M: ... + def save_existing(self, form: _ModelFormT, obj: _M, commit: bool = True) -> _M: ... + def delete_existing(self, obj: _M, commit: bool = True) -> None: ... saved_forms: list[_ModelFormT] def save_m2m(self) -> None: ... - def save(self, commit: bool = ...) -> list[_M]: ... + def save(self, commit: bool = True) -> list[_M]: ... def clean(self) -> None: ... def validate_unique(self) -> None: ... def get_unique_error_message(self, unique_check: Sequence[str]) -> str: ... @@ -140,35 +140,35 @@ class BaseModelFormSet(Generic[_M, _ModelFormT], BaseFormSet[_ModelFormT]): def get_form_error(self) -> str: ... changed_objects: list[tuple[_M, list[str]]] deleted_objects: list[_M] - def save_existing_objects(self, commit: bool = ...) -> list[_M]: ... + def save_existing_objects(self, commit: bool = True) -> list[_M]: ... new_objects: list[_M] - def save_new_objects(self, commit: bool = ...) -> list[_M]: ... + def save_new_objects(self, commit: bool = True) -> list[_M]: ... def add_fields(self, form: _ModelFormT, index: int | None) -> None: ... def modelformset_factory( model: type[_M], form: type[_ModelFormT] = ..., - formfield_callback: _FormFieldCallback | None = ..., + formfield_callback: _FormFieldCallback | None = None, formset: type[BaseModelFormSet] = ..., - extra: int = ..., - can_delete: bool = ..., - can_order: bool = ..., - max_num: int | None = ..., - fields: _Fields | None = ..., - exclude: _Fields | None = ..., - widgets: _Widgets | None = ..., - validate_max: bool = ..., - localized_fields: _Fields | None = ..., - labels: _Labels | None = ..., - help_texts: _HelpTexts | None = ..., - error_messages: _ErrorMessages | None = ..., - min_num: int | None = ..., - validate_min: bool = ..., - field_classes: Mapping[str, type[Field]] | None = ..., - absolute_max: int | None = ..., - can_delete_extra: bool = ..., - renderer: BaseRenderer | None = ..., - edit_only: bool = ..., + extra: int = 1, + can_delete: bool = False, + can_order: bool = False, + max_num: int | None = None, + fields: _Fields | None = None, + exclude: _Fields | None = None, + widgets: _Widgets | None = None, + validate_max: bool = False, + localized_fields: _Fields | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + min_num: int | None = None, + validate_min: bool = False, + field_classes: Mapping[str, type[Field]] | None = None, + absolute_max: int | None = None, + can_delete_extra: bool = True, + renderer: BaseRenderer | None = None, + edit_only: bool = False, ) -> type[BaseModelFormSet[_M, _ModelFormT]]: ... class BaseInlineFormSet(Generic[_M, _ParentM, _ModelFormT], BaseModelFormSet[_M, _ModelFormT]): @@ -178,18 +178,18 @@ class BaseInlineFormSet(Generic[_M, _ParentM, _ModelFormT], BaseModelFormSet[_M, fk: ForeignKey # set by inlineformset_set def __init__( self, - data: _DataT | None = ..., - files: _FilesT | None = ..., - instance: _ParentM | None = ..., - save_as_new: bool = ..., - prefix: str | None = ..., - queryset: QuerySet[_M] | None = ..., + data: _DataT | None = None, + files: _FilesT | None = None, + instance: _ParentM | None = None, + save_as_new: bool = False, + prefix: str | None = None, + queryset: QuerySet[_M] | None = None, **kwargs: Any, ) -> None: ... def initial_form_count(self) -> int: ... @classmethod def get_default_prefix(cls) -> str: ... - def save_new(self, form: _ModelFormT, commit: bool = ...) -> _M: ... + def save_new(self, form: _ModelFormT, commit: bool = True) -> _M: ... def add_fields(self, form: _ModelFormT, index: int | None) -> None: ... def get_unique_error_message(self, unique_check: Sequence[str]) -> str: ... @@ -198,27 +198,27 @@ def inlineformset_factory( model: type[_M], form: type[_ModelFormT] = ..., formset: type[BaseInlineFormSet] = ..., - fk_name: str | None = ..., - fields: _Fields | None = ..., - exclude: _Fields | None = ..., - extra: int = ..., - can_order: bool = ..., - can_delete: bool = ..., - max_num: int | None = ..., - formfield_callback: _FormFieldCallback | None = ..., - widgets: _Widgets | None = ..., - validate_max: bool = ..., - localized_fields: Sequence[str] | None = ..., - labels: _Labels | None = ..., - help_texts: _HelpTexts | None = ..., - error_messages: _ErrorMessages | None = ..., - min_num: int | None = ..., - validate_min: bool = ..., - field_classes: Mapping[str, type[Field]] | None = ..., - absolute_max: int | None = ..., - can_delete_extra: bool = ..., - renderer: BaseRenderer | None = ..., - edit_only: bool = ..., + fk_name: str | None = None, + fields: _Fields | None = None, + exclude: _Fields | None = None, + extra: int = 3, + can_order: bool = False, + can_delete: bool = True, + max_num: int | None = None, + formfield_callback: _FormFieldCallback | None = None, + widgets: _Widgets | None = None, + validate_max: bool = False, + localized_fields: Sequence[str] | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + min_num: int | None = None, + validate_min: bool = False, + field_classes: Mapping[str, type[Field]] | None = None, + absolute_max: int | None = None, + can_delete_extra: bool = True, + renderer: BaseRenderer | None = None, + edit_only: bool = False, ) -> type[BaseInlineFormSet[_M, _ParentM, _ModelFormT]]: ... class InlineForeignKeyField(Field): @@ -234,8 +234,8 @@ class InlineForeignKeyField(Field): self, parent_instance: Model, *args: Any, - pk_field: bool = ..., - to_field: str | None = ..., + pk_field: bool = False, + to_field: str | None = None, **kwargs: Any, ) -> None: ... def clean(self, value: Any) -> Model: ... @@ -268,15 +268,15 @@ class ModelChoiceField(ChoiceField, Generic[_M]): self, queryset: Manager[_M] | QuerySet[_M] | None, *, - empty_label: _StrOrPromise | None = ..., - required: bool = ..., - widget: Widget | type[Widget] | None = ..., - label: _StrOrPromise | None = ..., - initial: Any | None = ..., - help_text: _StrOrPromise = ..., - to_field_name: str | None = ..., - limit_choices_to: _AllLimitChoicesTo | None = ..., - blank: bool = ..., + empty_label: _StrOrPromise | None = "---------", + required: bool = True, + widget: Widget | type[Widget] | None = None, + label: _StrOrPromise | None = None, + initial: Any | None = None, + help_text: _StrOrPromise = "", + to_field_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + blank: bool = False, **kwargs: Any, ) -> None: ... def get_limit_choices_to(self) -> _LimitChoicesTo: ... @@ -307,9 +307,9 @@ class ModelMultipleChoiceField(ModelChoiceField[_M]): def modelform_defines_fields(form_class: type[ModelForm]) -> bool: ... @overload def _get_foreign_key( - parent_model: type[Model], model: type[Model], fk_name: str | None = ..., can_fail: Literal[True] = True + parent_model: type[Model], model: type[Model], fk_name: str | None = None, can_fail: Literal[True] = True ) -> ForeignKey | None: ... @overload def _get_foreign_key( - parent_model: type[Model], model: type[Model], fk_name: str | None = ..., can_fail: Literal[False] = False + parent_model: type[Model], model: type[Model], fk_name: str | None = None, can_fail: Literal[False] = False ) -> ForeignKey: ... diff --git a/django-stubs/forms/renderers.pyi b/django-stubs/forms/renderers.pyi index 859a35a16..9b6d4ee46 100644 --- a/django-stubs/forms/renderers.pyi +++ b/django-stubs/forms/renderers.pyi @@ -14,7 +14,7 @@ class BaseRenderer: formset_template_name: str field_template_name: str def get_template(self, template_name: str) -> Any: ... - def render(self, template_name: str, context: dict[str, Any], request: HttpRequest | None = ...) -> str: ... + def render(self, template_name: str, context: dict[str, Any], request: HttpRequest | None = None) -> str: ... class EngineMixin: def get_template(self, template_name: str) -> Any: ... diff --git a/django-stubs/forms/utils.pyi b/django-stubs/forms/utils.pyi index a2a5c4653..8d0676a92 100644 --- a/django-stubs/forms/utils.pyi +++ b/django-stubs/forms/utils.pyi @@ -22,9 +22,9 @@ class RenderableMixin: def get_context(self) -> dict[str, Any]: ... def render( self, - template_name: str | None = ..., - context: dict[str, Any] | None = ..., - renderer: BaseRenderer | type[BaseRenderer] | None = ..., + template_name: str | None = None, + context: dict[str, Any] | None = None, + renderer: BaseRenderer | type[BaseRenderer] | None = None, ) -> SafeString: ... # This is a lie, but this is how it is supposed to be used, # in reallity it is `__str__ = __html__ = render`: @@ -43,7 +43,7 @@ class RenderableFormMixin(RenderableMixin): def as_div(self) -> SafeString: ... class RenderableErrorMixin(RenderableMixin): - def as_json(self, escape_html: bool = ...) -> str: ... + def as_json(self, escape_html: bool = False) -> str: ... def as_text(self) -> SafeString: ... def as_ul(self) -> SafeString: ... @@ -55,7 +55,7 @@ class ErrorDict(dict[str, ErrorList], RenderableErrorMixin): def __init__(self, *args: Any, renderer: BaseRenderer | None = None, **kwargs: Any): ... def as_data(self) -> dict[str, list[ValidationError]]: ... - def get_json_data(self, escape_html: bool = ...) -> dict[str, Any]: ... + def get_json_data(self, escape_html: bool = False) -> dict[str, Any]: ... class ErrorList(UserList[ValidationError | _StrOrPromise], RenderableErrorMixin): template_name: str @@ -65,12 +65,12 @@ class ErrorList(UserList[ValidationError | _StrOrPromise], RenderableErrorMixin) renderer: BaseRenderer def __init__( self, - initlist: ErrorList | Sequence[str | Exception] | None = ..., - error_class: str | None = ..., - renderer: BaseRenderer | None = ..., + initlist: ErrorList | Sequence[str | Exception] | None = None, + error_class: str | None = None, + renderer: BaseRenderer | None = None, ) -> None: ... def as_data(self) -> list[ValidationError]: ... - def get_json_data(self, escape_html: bool = ...) -> list[dict[str, str]]: ... + def get_json_data(self, escape_html: bool = False) -> list[dict[str, str]]: ... def from_current_timezone(value: datetime) -> datetime: ... def to_current_timezone(value: datetime) -> datetime: ... diff --git a/django-stubs/forms/widgets.pyi b/django-stubs/forms/widgets.pyi index 2207a8a60..87273ec0a 100644 --- a/django-stubs/forms/widgets.pyi +++ b/django-stubs/forms/widgets.pyi @@ -17,9 +17,9 @@ class MediaOrderConflictWarning(RuntimeWarning): ... class Media: def __init__( self, - media: type | None = ..., - css: dict[str, Sequence[str]] | None = ..., - js: Sequence[str] | None = ..., + media: type | None = None, + css: dict[str, Sequence[str]] | None = None, + js: Sequence[str] | None = None, ) -> None: ... def render(self) -> SafeString: ... def render_js(self) -> list[SafeString]: ... @@ -39,19 +39,19 @@ class Widget(metaclass=MediaDefiningClass): supports_microseconds: bool attrs: _OptAttrs template_name: str - def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... def __deepcopy__(self, memo: dict[int, Any]) -> Self: ... @property def is_hidden(self) -> bool: ... @property def media(self) -> Media: ... - def subwidgets(self, name: str, value: Any, attrs: _OptAttrs = ...) -> Iterator[dict[str, Any]]: ... + def subwidgets(self, name: str, value: Any, attrs: _OptAttrs | None = None) -> Iterator[dict[str, Any]]: ... def format_value(self, value: Any) -> str | None: ... def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... def render( - self, name: str, value: Any, attrs: _OptAttrs | None = ..., renderer: BaseRenderer | None = ... + self, name: str, value: Any, attrs: _OptAttrs | None = None, renderer: BaseRenderer | None = None ) -> SafeString: ... - def build_attrs(self, base_attrs: _OptAttrs, extra_attrs: _OptAttrs | None = ...) -> dict[str, Any]: ... + def build_attrs(self, base_attrs: _OptAttrs, extra_attrs: _OptAttrs | None = None) -> dict[str, Any]: ... def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... def id_for_label(self, id_: str) -> str: ... @@ -81,7 +81,7 @@ class PasswordInput(Input): render_value: bool input_type: str template_name: str - def __init__(self, attrs: _OptAttrs | None = ..., render_value: bool = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None, render_value: bool = False) -> None: ... def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... class HiddenInput(Input): @@ -119,13 +119,13 @@ class ClearableFileInput(FileInput): class Textarea(Widget): template_name: str - def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... class DateTimeBaseInput(TextInput): format_key: str format: str | None supports_microseconds: bool - def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None, format: str | None = None) -> None: ... class DateInput(DateTimeBaseInput): format_key: str @@ -148,7 +148,7 @@ class CheckboxInput(Input): check_test: _CheckCallable input_type: str template_name: str - def __init__(self, attrs: _OptAttrs | None = ..., check_test: _CheckCallable | None = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None, check_test: _CheckCallable | None = None) -> None: ... class ChoiceWidget(Widget): allow_multiple_selected: bool @@ -159,11 +159,11 @@ class ChoiceWidget(Widget): checked_attribute: Any option_inherits_attrs: bool choices: _Choices - def __init__(self, attrs: _OptAttrs | None = ..., choices: _Choices = ...) -> None: ... - def subwidgets(self, name: str, value: Any, attrs: _OptAttrs = ...) -> Iterator[dict[str, Any]]: ... - def options(self, name: str, value: list[str], attrs: _OptAttrs | None = ...) -> Iterator[dict[str, Any]]: ... + def __init__(self, attrs: _OptAttrs | None = None, choices: _Choices = ()) -> None: ... + def subwidgets(self, name: str, value: Any, attrs: _OptAttrs | None = None) -> Iterator[dict[str, Any]]: ... + def options(self, name: str, value: list[str], attrs: _OptAttrs | None = None) -> Iterator[dict[str, Any]]: ... def optgroups( - self, name: str, value: list[str], attrs: _OptAttrs | None = ... + self, name: str, value: list[str], attrs: _OptAttrs | None = None ) -> list[tuple[str | None, list[dict[str, Any]], int | None]]: ... def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... def create_option( @@ -173,10 +173,10 @@ class ChoiceWidget(Widget): label: int | str, selected: bool, index: int, - subindex: int | None = ..., - attrs: _OptAttrs | None = ..., + subindex: int | None = None, + attrs: _OptAttrs | None = None, ) -> dict[str, Any]: ... - def id_for_label(self, id_: str, index: str = ...) -> str: ... + def id_for_label(self, id_: str, index: str = "0") -> str: ... def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... def format_value(self, value: Any) -> list[str]: ... # type: ignore[override] @@ -191,7 +191,7 @@ class Select(ChoiceWidget): def use_required_attribute(self, initial: Any) -> bool: ... class NullBooleanSelect(Select): - def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... def format_value(self, value: Any) -> str: ... # type: ignore[override] def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> bool | None: ... @@ -213,7 +213,7 @@ class CheckboxSelectMultiple(ChoiceWidget): option_template_name: str def use_required_attribute(self, initial: Any) -> bool: ... def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... - def id_for_label(self, id_: str, index: str | None = ...) -> str: ... + def id_for_label(self, id_: str, index: str | None = None) -> str: ... class MultiWidget(Widget): template_name: str @@ -221,7 +221,7 @@ class MultiWidget(Widget): def __init__( self, widgets: dict[str, Widget | type[Widget]] | Sequence[Widget | type[Widget]], - attrs: _OptAttrs | None = ..., + attrs: _OptAttrs | None = None, ) -> None: ... @property def is_hidden(self) -> bool: ... @@ -239,11 +239,11 @@ class SplitDateTimeWidget(MultiWidget): widgets: tuple[DateInput, TimeInput] def __init__( self, - attrs: _OptAttrs | None = ..., - date_format: str | None = ..., - time_format: str | None = ..., - date_attrs: dict[str, str] | None = ..., - time_attrs: dict[str, str] | None = ..., + attrs: _OptAttrs | None = None, + date_format: str | None = None, + time_format: str | None = None, + date_attrs: dict[str, str] | None = None, + time_attrs: dict[str, str] | None = None, ) -> None: ... def decompress(self, value: Any) -> tuple[datetime.date | None, datetime.time | None]: ... @@ -251,11 +251,11 @@ class SplitHiddenDateTimeWidget(SplitDateTimeWidget): template_name: str def __init__( self, - attrs: _OptAttrs | None = ..., - date_format: str | None = ..., - time_format: str | None = ..., - date_attrs: dict[str, str] | None = ..., - time_attrs: dict[str, str] | None = ..., + attrs: _OptAttrs | None = None, + date_format: str | None = None, + time_format: str | None = None, + date_attrs: dict[str, str] | None = None, + time_attrs: dict[str, str] | None = None, ) -> None: ... class SelectDateWidget(Widget): @@ -274,10 +274,10 @@ class SelectDateWidget(Widget): day_none_value: tuple[Literal[""], str] def __init__( self, - attrs: _OptAttrs | None = ..., - years: Iterable[int | str] | None = ..., - months: Mapping[int, str] | None = ..., - empty_label: str | _ListOrTuple[str] | None = ..., + attrs: _OptAttrs | None = None, + years: Iterable[int | str] | None = None, + months: Mapping[int, str] | None = None, + empty_label: str | _ListOrTuple[str] | None = None, ) -> None: ... def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... def format_value(self, value: Any) -> dict[str, str | int | None]: ... # type: ignore[override] diff --git a/django-stubs/template/backends/django.pyi b/django-stubs/template/backends/django.pyi index f63b718bb..7f88df5ab 100644 --- a/django-stubs/template/backends/django.pyi +++ b/django-stubs/template/backends/django.pyi @@ -13,7 +13,7 @@ class DjangoTemplates(BaseEngine): def __init__(self, params: dict[str, Any]) -> None: ... def get_templatetag_libraries(self, custom_libraries: dict[str, str]) -> dict[str, str]: ... -def copy_exception(exc: TemplateDoesNotExist, backend: DjangoTemplates | None = ...) -> TemplateDoesNotExist: ... +def copy_exception(exc: TemplateDoesNotExist, backend: DjangoTemplates | None = None) -> TemplateDoesNotExist: ... def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> NoReturn: ... def get_template_tag_modules() -> Iterator[tuple[str, str]]: ... def get_installed_libraries() -> dict[str, str]: ... diff --git a/django-stubs/template/base.pyi b/django-stubs/template/base.pyi index 0c1eaa1db..1b29d1775 100644 --- a/django-stubs/template/base.pyi +++ b/django-stubs/template/base.pyi @@ -40,7 +40,7 @@ class Origin: name: str template_name: bytes | str | None loader: Loader | None - def __init__(self, name: str, template_name: bytes | str | None = ..., loader: Loader | None = ...) -> None: ... + def __init__(self, name: str, template_name: bytes | str | None = None, loader: Loader | None = None) -> None: ... @property def loader_name(self) -> str | None: ... @@ -53,9 +53,9 @@ class Template: def __init__( self, template_string: Template | str, - origin: Origin | None = ..., - name: str | None = ..., - engine: Engine | None = ..., + origin: Origin | None = None, + name: str | None = None, + engine: Engine | None = None, ) -> None: ... def render(self, context: Context) -> SafeString: ... def compile_nodelist(self) -> NodeList: ... @@ -72,8 +72,8 @@ class Token: self, token_type: TokenType, contents: str, - position: tuple[int, int] | None = ..., - lineno: int | None = ..., + position: tuple[int, int] | None = None, + lineno: int | None = None, ) -> None: ... def split_contents(self) -> list[str]: ... @@ -99,15 +99,15 @@ class Parser: def __init__( self, tokens: list[Token] | str, - libraries: dict[str, Library] | None = ..., - builtins: list[Library] | None = ..., - origin: Origin | None = ..., + libraries: dict[str, Library] | None = None, + builtins: list[Library] | None = None, + origin: Origin | None = None, ) -> None: ... - def parse(self, parse_until: Iterable[str] | None = ...) -> NodeList: ... + def parse(self, parse_until: Iterable[str] | None = None) -> NodeList: ... def skip_past(self, endtag: str) -> None: ... def extend_nodelist(self, nodelist: NodeList, node: Node, token: Token) -> None: ... def error(self, token: Token, e: Exception | str) -> Exception: ... - def invalid_block_tag(self, token: Token, command: str, parse_until: Iterable[str] | None = ...) -> Any: ... + def invalid_block_tag(self, token: Token, command: str, parse_until: Iterable[str] | None = None) -> Any: ... def unclosed_block_tag(self, parse_until: Iterable[str]) -> Any: ... def next_token(self) -> Token: ... def prepend_token(self, token: Token) -> None: ... @@ -125,7 +125,7 @@ class FilterExpression: filters: list[Any] var: Any def __init__(self, token: str, parser: Parser) -> None: ... - def resolve(self, context: Context, ignore_failures: bool = ...) -> Any: ... + def resolve(self, context: Context, ignore_failures: bool = False) -> Any: ... @staticmethod def args_check(name: str, func: Callable, provided: list[tuple[bool, Any]]) -> bool: ... @@ -165,4 +165,4 @@ class VariableNode(Node): kwarg_re: Pattern[str] -def token_kwargs(bits: Sequence[str], parser: Parser, support_legacy: bool = ...) -> dict[str, FilterExpression]: ... +def token_kwargs(bits: Sequence[str], parser: Parser, support_legacy: bool = False) -> dict[str, FilterExpression]: ... diff --git a/django-stubs/template/context.pyi b/django-stubs/template/context.pyi index 3c06247b4..a9c0302cc 100644 --- a/django-stubs/template/context.pyi +++ b/django-stubs/template/context.pyi @@ -26,7 +26,7 @@ class ContextDict(dict): ) -> None: ... class BaseContext(Iterable[Any]): - def __init__(self, dict_: Any = ...) -> None: ... + def __init__(self, dict_: Any | None = None) -> None: ... def __copy__(self) -> Self: ... def __iter__(self) -> Iterator[Any]: ... def push(self, *args: Any, **kwargs: Any) -> ContextDict: ... @@ -36,9 +36,9 @@ class BaseContext(Iterable[Any]): def __getitem__(self, key: _ContextKeys) -> Any: ... def __delitem__(self, key: _ContextKeys) -> None: ... def __contains__(self, key: _ContextKeys) -> bool: ... - def get(self, key: _ContextKeys, otherwise: Any | None = ...) -> Any | None: ... - def setdefault(self, key: _ContextKeys, default: list[Origin] | int | None = ...) -> list[Origin] | int | None: ... - def new(self, values: _ContextValues | None = ...) -> Context: ... + def get(self, key: _ContextKeys, otherwise: Any | None = None) -> Any | None: ... + def setdefault(self, key: _ContextKeys, default: list[Origin] | int | None = None) -> list[Origin] | int | None: ... + def new(self, values: _ContextValues | None = None) -> Context: ... def flatten(self) -> dict[_ContextKeys, dict[_ContextKeys, type[Any] | str] | int | str | None]: ... class Context(BaseContext): @@ -50,7 +50,11 @@ class Context(BaseContext): render_context: RenderContext template: Template | None def __init__( - self, dict_: Any = ..., autoescape: bool = ..., use_l10n: bool | None = ..., use_tz: bool | None = ... + self, + dict_: Any | None = None, + autoescape: bool = True, + use_l10n: bool | None = None, + use_tz: bool | None = None, ) -> None: ... @contextmanager def bind_template(self, template: Template) -> Iterator[None]: ... @@ -60,7 +64,7 @@ class RenderContext(BaseContext): dicts: list[dict[IncludeNode | str, str]] template: Template | None @contextmanager - def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ... + def push_state(self, template: Template, isolated_context: bool = True) -> Iterator[None]: ... class RequestContext(Context): autoescape: bool @@ -73,15 +77,15 @@ class RequestContext(Context): def __init__( self, request: HttpRequest, - dict_: dict[str, Any] | None = ..., - processors: list[Callable] | None = ..., - use_l10n: bool | None = ..., - use_tz: bool | None = ..., - autoescape: bool = ..., + dict_: dict[str, Any] | None = None, + processors: list[Callable] | None = None, + use_l10n: bool | None = None, + use_tz: bool | None = None, + autoescape: bool = True, ) -> None: ... template: Template | None @contextmanager def bind_template(self, template: Template) -> Iterator[None]: ... - def new(self, values: _ContextValues | None = ...) -> RequestContext: ... + def new(self, values: _ContextValues | None = None) -> RequestContext: ... -def make_context(context: Any, request: HttpRequest | None = ..., **kwargs: Any) -> Context: ... +def make_context(context: Any, request: HttpRequest | None = None, **kwargs: Any) -> Context: ... diff --git a/django-stubs/template/defaultfilters.pyi b/django-stubs/template/defaultfilters.pyi index a1f290bc0..1ceb71282 100644 --- a/django-stubs/template/defaultfilters.pyi +++ b/django-stubs/template/defaultfilters.pyi @@ -13,9 +13,9 @@ def addslashes(value: str) -> str: ... def capfirst(value: str) -> str: ... def escapejs_filter(value: str) -> SafeString: ... def json_script(value: dict[str, str], element_id: SafeString) -> SafeString: ... -def floatformat(text: Any | None, arg: int | str = ...) -> str: ... +def floatformat(text: Any | None, arg: int | str = -1) -> str: ... def iriencode(value: str) -> str: ... -def linenumbers(value: str, autoescape: bool = ...) -> SafeString: ... +def linenumbers(value: str, autoescape: bool = True) -> SafeString: ... def lower(value: str) -> str: ... def make_list(value: str) -> list[str]: ... def slugify(value: str) -> SafeString: ... @@ -26,9 +26,9 @@ def truncatechars_html(value: str, arg: int | str) -> str: ... def truncatewords(value: str, arg: int | str) -> str: ... def truncatewords_html(value: str, arg: int | str) -> str: ... def upper(value: str) -> str: ... -def urlencode(value: str, safe: SafeString | None = ...) -> str: ... -def urlize(value: str, autoescape: bool = ...) -> SafeString: ... -def urlizetrunc(value: str, limit: SafeString | int, autoescape: bool = ...) -> SafeString: ... +def urlencode(value: str, safe: SafeString | None = None) -> str: ... +def urlize(value: str, autoescape: bool = True) -> SafeString: ... +def urlizetrunc(value: str, limit: SafeString | int, autoescape: bool = True) -> SafeString: ... def wordcount(value: str) -> int: ... def wordwrap(value: str, arg: SafeString | int) -> str: ... def ljust(value: str, arg: SafeString | int) -> str: ... @@ -38,32 +38,32 @@ def cut(value: str, arg: str) -> str: ... def escape_filter(value: str) -> SafeString: ... def escapeseq(value: list[str]) -> list[SafeString]: ... def force_escape(value: str) -> SafeString: ... -def linebreaks_filter(value: str, autoescape: bool = ...) -> SafeString: ... -def linebreaksbr(value: str, autoescape: bool = ...) -> SafeString: ... +def linebreaks_filter(value: str, autoescape: bool = True) -> SafeString: ... +def linebreaksbr(value: str, autoescape: bool = True) -> SafeString: ... def safe(value: str) -> SafeString: ... def safeseq(value: list[str]) -> list[SafeString]: ... def striptags(value: str) -> str: ... def dictsort(value: Any, arg: int | str) -> Any: ... def dictsortreversed(value: Any, arg: int | str) -> Any: ... def first(value: Any) -> Any: ... -def join(value: Any, arg: str, autoescape: bool = ...) -> Any: ... +def join(value: Any, arg: str, autoescape: bool = True) -> Any: ... def last(value: list[str]) -> str: ... def length(value: Any) -> int: ... def length_is(value: Any | None, arg: SafeString | int) -> bool | str: ... def random(value: list[str]) -> str: ... def slice_filter(value: Any, arg: str | int) -> Any: ... -def unordered_list(value: Any, autoescape: bool = ...) -> Any: ... +def unordered_list(value: Any, autoescape: bool = True) -> Any: ... def add(value: Any, arg: Any) -> Any: ... def get_digit(value: Any, arg: int) -> Any: ... -def date(value: _date | datetime | str | None, arg: str | None = ...) -> str: ... -def time(value: datetime | _time | str | None, arg: str | None = ...) -> str: ... -def timesince_filter(value: _date | None, arg: _date | None = ...) -> str: ... -def timeuntil_filter(value: _date | None, arg: _date | None = ...) -> str: ... +def date(value: _date | datetime | str | None, arg: str | None = None) -> str: ... +def time(value: datetime | _time | str | None, arg: str | None = None) -> str: ... +def timesince_filter(value: _date | None, arg: _date | None = None) -> str: ... +def timeuntil_filter(value: _date | None, arg: _date | None = None) -> str: ... def default(value: int | str | None, arg: int | str) -> int | str: ... def default_if_none(value: str | None, arg: int | str) -> int | str: ... def divisibleby(value: int, arg: int) -> bool: ... -def yesno(value: int | None, arg: str | None = ...) -> bool | str | None: ... +def yesno(value: int | None, arg: str | None = None) -> bool | str | None: ... def filesizeformat(bytes_: complex | int | str) -> str: ... -def pluralize(value: Any, arg: str = ...) -> str: ... +def pluralize(value: Any, arg: str = "s") -> str: ... def phone2numeric_filter(value: str) -> str: ... def pprint(value: Any) -> str: ... diff --git a/django-stubs/template/defaulttags.pyi b/django-stubs/template/defaulttags.pyi index a9c708c49..ec478c32a 100644 --- a/django-stubs/template/defaulttags.pyi +++ b/django-stubs/template/defaulttags.pyi @@ -26,7 +26,7 @@ class CycleNode(Node): variable_name: str | None silent: bool def __init__( - self, cyclevars: list[FilterExpression], variable_name: str | None = ..., silent: bool = ... + self, cyclevars: list[FilterExpression], variable_name: str | None = None, silent: bool = False ) -> None: ... def reset(self, context: Context) -> None: ... @@ -40,7 +40,7 @@ class FilterNode(Node): class FirstOfNode(Node): vars: list[FilterExpression] asvar: str | None - def __init__(self, variables: list[FilterExpression], asvar: str | None = ...) -> None: ... + def __init__(self, variables: list[FilterExpression], asvar: str | None = None) -> None: ... class ForNode(Node): loopvars: list[str] | str @@ -55,7 +55,7 @@ class ForNode(Node): sequence: FilterExpression | str, is_reversed: bool, nodelist_loop: list[str] | NodeList, - nodelist_empty: list[str] | NodeList | None = ..., + nodelist_empty: list[str] | NodeList | None = None, ) -> None: ... class IfChangedNode(Node): @@ -107,7 +107,7 @@ class LoadNode(Node): ... class NowNode(Node): format_string: str asvar: str | None - def __init__(self, format_string: str, asvar: str | None = ...) -> None: ... + def __init__(self, format_string: str, asvar: str | None = None) -> None: ... class ResetCycleNode(Node): node: CycleNode @@ -149,7 +149,7 @@ class WidthRatioNode(Node): val_expr: FilterExpression, max_expr: FilterExpression, max_width: FilterExpression, - asvar: str | None = ..., + asvar: str | None = None, ) -> None: ... class WithNode(Node): @@ -160,7 +160,7 @@ class WithNode(Node): var: str | None, name: str | None, nodelist: NodeList | Sequence[Node], - extra_context: dict[str, Any] | None = ..., + extra_context: dict[str, Any] | None = None, ) -> None: ... def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ... diff --git a/django-stubs/template/engine.pyi b/django-stubs/template/engine.pyi index eb5846a4a..8c9f8088d 100644 --- a/django-stubs/template/engine.pyi +++ b/django-stubs/template/engine.pyi @@ -28,16 +28,16 @@ class Engine: template_builtins: list[Library] def __init__( self, - dirs: list[str] | None = ..., - app_dirs: bool = ..., - context_processors: list[str] | tuple[str] | None = ..., - debug: bool = ..., - loaders: Sequence[_Loader] | None = ..., - string_if_invalid: str = ..., - file_charset: str = ..., - libraries: dict[str, str] | None = ..., - builtins: list[str] | None = ..., - autoescape: bool = ..., + dirs: list[str] | None = None, + app_dirs: bool = False, + context_processors: list[str] | tuple[str] | None = None, + debug: bool = False, + loaders: Sequence[_Loader] | None = None, + string_if_invalid: str = "", + file_charset: str = "utf-8", + libraries: dict[str, str] | None = None, + builtins: list[str] | None = None, + autoescape: bool = True, ) -> None: ... @staticmethod def get_default() -> Engine: ... @@ -50,9 +50,9 @@ class Engine: def get_template_loaders(self, template_loaders: Sequence[_Loader]) -> list[Loader]: ... def find_template_loader(self, loader: _Loader) -> Loader: ... def find_template( - self, name: str, dirs: None = None, skip: list[Origin] | None = ... + self, name: str, dirs: None = None, skip: list[Origin] | None = None ) -> tuple[Template, Origin]: ... def from_string(self, template_code: str) -> Template: ... def get_template(self, template_name: str) -> Template: ... - def render_to_string(self, template_name: str, context: dict[str, Any] | None = ...) -> SafeString: ... + def render_to_string(self, template_name: str, context: dict[str, Any] | None = None) -> SafeString: ... def select_template(self, template_name_list: list[str]) -> Template: ... diff --git a/django-stubs/template/exceptions.pyi b/django-stubs/template/exceptions.pyi index d608be04e..57b33421a 100644 --- a/django-stubs/template/exceptions.pyi +++ b/django-stubs/template/exceptions.pyi @@ -8,9 +8,9 @@ class TemplateDoesNotExist(Exception): def __init__( self, msg: Origin | str, - tried: list[tuple[Origin, str]] | None = ..., - backend: BaseEngine | None = ..., - chain: list[TemplateDoesNotExist] | None = ..., + tried: list[tuple[Origin, str]] | None = None, + backend: BaseEngine | None = None, + chain: list[TemplateDoesNotExist] | None = None, ) -> None: ... class TemplateSyntaxError(Exception): ... diff --git a/django-stubs/template/library.pyi b/django-stubs/template/library.pyi index df58466b0..fddeaa381 100644 --- a/django-stubs/template/library.pyi +++ b/django-stubs/template/library.pyi @@ -20,24 +20,24 @@ class Library: @overload def tag(self, name: str, compile_function: _C) -> _C: ... @overload - def tag(self, name: str | None = ..., compile_function: None = None) -> Callable[[_C], _C]: ... + def tag(self, name: str | None = None, compile_function: None = None) -> Callable[[_C], _C]: ... def tag_function(self, func: _C) -> _C: ... @overload def filter(self, name: _C, filter_func: None = None, **flags: Any) -> _C: ... @overload def filter(self, name: str | None, filter_func: _C, **flags: Any) -> _C: ... @overload - def filter(self, name: str | None = ..., filter_func: None = None, **flags: Any) -> Callable[[_C], _C]: ... + def filter(self, name: str | None = None, filter_func: None = None, **flags: Any) -> Callable[[_C], _C]: ... @overload def simple_tag(self, func: _C) -> _C: ... @overload - def simple_tag(self, takes_context: bool | None = ..., name: str | None = ...) -> Callable[[_C], _C]: ... + def simple_tag(self, takes_context: bool | None = None, name: str | None = None) -> Callable[[_C], _C]: ... def inclusion_tag( self, filename: Template | str, - func: Callable | None = ..., - takes_context: bool | None = ..., - name: str | None = ..., + func: Callable | None = None, + takes_context: bool | None = None, + name: str | None = None, ) -> Callable[[_C], _C]: ... class TagHelperNode(Node): diff --git a/django-stubs/template/loader.pyi b/django-stubs/template/loader.pyi index f99d3293c..284f0a4d1 100644 --- a/django-stubs/template/loader.pyi +++ b/django-stubs/template/loader.pyi @@ -7,11 +7,11 @@ from django.utils.safestring import SafeString from .backends.base import _EngineTemplate -def get_template(template_name: str, using: str | None = ...) -> _EngineTemplate: ... -def select_template(template_name_list: Sequence[str] | str, using: str | None = ...) -> Any: ... +def get_template(template_name: str, using: str | None = None) -> _EngineTemplate: ... +def select_template(template_name_list: Sequence[str] | str, using: str | None = None) -> Any: ... def render_to_string( template_name: Sequence[str] | str, - context: Mapping[str, Any] | None = ..., - request: HttpRequest | None = ..., - using: str | None = ..., + context: Mapping[str, Any] | None = None, + request: HttpRequest | None = None, + using: str | None = None, ) -> SafeString: ... diff --git a/django-stubs/template/loader_tags.pyi b/django-stubs/template/loader_tags.pyi index 77bddb552..f90168e7b 100644 --- a/django-stubs/template/loader_tags.pyi +++ b/django-stubs/template/loader_tags.pyi @@ -25,7 +25,7 @@ class BlockNode(Node): origin: Origin parent: Node | None token: Token - def __init__(self, name: str, nodelist: NodeList, parent: Node | None = ...) -> None: ... + def __init__(self, name: str, nodelist: NodeList, parent: Node | None = None) -> None: ... def render(self, context: Context) -> SafeString: ... def super(self) -> SafeString: ... @@ -39,7 +39,7 @@ class ExtendsNode(Node): template_dirs: list[Any] | None blocks: dict[str, BlockNode] def __init__( - self, nodelist: NodeList, parent_name: FilterExpression | Node, template_dirs: list[Any] | None = ... + self, nodelist: NodeList, parent_name: FilterExpression | Node, template_dirs: list[Any] | None = None ) -> None: ... def find_template(self, template_name: str, context: Context) -> Template: ... def get_parent(self, context: Context) -> Template: ... @@ -56,8 +56,8 @@ class IncludeNode(Node): self, template: FilterExpression, *args: Any, - extra_context: Any | None = ..., - isolated_context: bool = ..., + extra_context: Any | None = None, + isolated_context: bool = False, **kwargs: Any, ) -> None: ... def render(self, context: Context) -> SafeString: ... diff --git a/django-stubs/template/loaders/base.pyi b/django-stubs/template/loaders/base.pyi index 17068da28..d7f5c9a99 100644 --- a/django-stubs/template/loaders/base.pyi +++ b/django-stubs/template/loaders/base.pyi @@ -8,6 +8,6 @@ class Loader: engine: Engine get_template_cache: dict[str, Any] def __init__(self, engine: Engine) -> None: ... - def get_template(self, template_name: str, skip: list[Origin] | None = ...) -> Template: ... + def get_template(self, template_name: str, skip: list[Origin] | None = None) -> Template: ... def get_template_sources(self, template_name: str) -> Iterable[Origin]: ... def reset(self) -> None: ... diff --git a/django-stubs/template/loaders/cached.pyi b/django-stubs/template/loaders/cached.pyi index 34a4593bd..c0b09745a 100644 --- a/django-stubs/template/loaders/cached.pyi +++ b/django-stubs/template/loaders/cached.pyi @@ -11,5 +11,5 @@ class Loader(BaseLoader): loaders: list[BaseLoader] def __init__(self, engine: Engine, loaders: Sequence[Any]) -> None: ... def get_contents(self, origin: Origin) -> str: ... - def cache_key(self, template_name: str, skip: list[Origin] | None = ...) -> str: ... + def cache_key(self, template_name: str, skip: list[Origin] | None = None) -> str: ... def generate_hash(self, values: list[str]) -> str: ... diff --git a/django-stubs/template/loaders/filesystem.pyi b/django-stubs/template/loaders/filesystem.pyi index 741bc8420..fecc8edc0 100644 --- a/django-stubs/template/loaders/filesystem.pyi +++ b/django-stubs/template/loaders/filesystem.pyi @@ -8,7 +8,7 @@ from .base import Loader as BaseLoader class Loader(BaseLoader): dirs: list[str | Path] | None - def __init__(self, engine: Engine, dirs: list[str | Path] | None = ...) -> None: ... + def __init__(self, engine: Engine, dirs: list[str | Path] | None = None) -> None: ... def get_dirs(self) -> list[str | Path]: ... def get_contents(self, origin: Origin) -> str: ... def get_template_sources(self, template_name: str) -> Iterator[Origin]: ... diff --git a/django-stubs/template/smartif.pyi b/django-stubs/template/smartif.pyi index c3adbaa88..001076627 100644 --- a/django-stubs/template/smartif.pyi +++ b/django-stubs/template/smartif.pyi @@ -40,5 +40,5 @@ class IfParser: def translate_token(self, token: _Token | None) -> Literal: ... def next_token(self) -> Literal: ... def parse(self) -> TemplateLiteral: ... - def expression(self, rbp: int = ...) -> Literal: ... + def expression(self, rbp: int = 0) -> Literal: ... def create_var(self, value: _Token | None) -> Literal: ... diff --git a/django-stubs/template/utils.pyi b/django-stubs/template/utils.pyi index 5868a1632..6c3245aad 100644 --- a/django-stubs/template/utils.pyi +++ b/django-stubs/template/utils.pyi @@ -9,7 +9,7 @@ from django.utils.functional import cached_property class InvalidTemplateEngineError(ImproperlyConfigured): ... class EngineHandler: - def __init__(self, templates: list[dict[str, Any]] = ...) -> None: ... + def __init__(self, templates: list[dict[str, Any]] | None = None) -> None: ... @cached_property def templates(self) -> dict[str, Any]: ... def __getitem__(self, alias: str) -> BaseEngine: ... diff --git a/django-stubs/templatetags/i18n.pyi b/django-stubs/templatetags/i18n.pyi index 39b312e72..db0d930bc 100644 --- a/django-stubs/templatetags/i18n.pyi +++ b/django-stubs/templatetags/i18n.pyi @@ -43,8 +43,8 @@ class TranslateNode(Node): self, filter_expression: FilterExpression, noop: bool, - asvar: str | None = ..., - message_context: FilterExpression | None = ..., + asvar: str | None = None, + message_context: FilterExpression | None = None, ) -> None: ... def render(self, context: Context) -> str: ... @@ -61,16 +61,16 @@ class BlockTranslateNode(Node): self, extra_context: dict[str, FilterExpression], singular: list[Token], - plural: list[Token] = ..., - countervar: str | None = ..., - counter: FilterExpression | None = ..., - message_context: FilterExpression | None = ..., - trimmed: bool = ..., - asvar: str | None = ..., - tag_name: str = ..., + plural: list[Token] | None = None, + countervar: str | None = None, + counter: FilterExpression | None = None, + message_context: FilterExpression | None = None, + trimmed: bool = False, + asvar: str | None = None, + tag_name: str = "blocktranslate", ) -> None: ... def render_token_list(self, tokens: list[Token]) -> tuple[str, list[str]]: ... - def render(self, context: Context, nested: bool = ...) -> str: ... + def render(self, context: Context, nested: bool = False) -> str: ... class LanguageNode(Node): nodelist: NodeList diff --git a/django-stubs/templatetags/static.pyi b/django-stubs/templatetags/static.pyi index 2fd5fdc18..85d1a4154 100644 --- a/django-stubs/templatetags/static.pyi +++ b/django-stubs/templatetags/static.pyi @@ -9,7 +9,7 @@ register: Any class PrefixNode(template.Node): varname: str | None name: str - def __init__(self, varname: str | None = ..., name: str = ...) -> None: ... + def __init__(self, varname: str | None = None, name: str | None = None) -> None: ... @classmethod def handle_token(cls, parser: Parser, token: Token, name: str) -> PrefixNode: ... @classmethod @@ -21,7 +21,7 @@ def get_media_prefix(parser: Parser, token: Token) -> PrefixNode: ... class StaticNode(template.Node): path: FilterExpression varname: str | None - def __init__(self, varname: str | None = ..., path: FilterExpression = ...) -> None: ... + def __init__(self, varname: str | None = None, path: FilterExpression | None = None) -> None: ... def url(self, context: Context) -> str: ... @classmethod def handle_simple(cls, path: str) -> str: ... diff --git a/django-stubs/utils/autoreload.pyi b/django-stubs/utils/autoreload.pyi index 78d8e8fc1..78c473128 100644 --- a/django-stubs/utils/autoreload.pyi +++ b/django-stubs/utils/autoreload.pyi @@ -37,7 +37,7 @@ class BaseReloader: directory_globs: dict[Path, set[str]] def __init__(self) -> None: ... def watch_dir(self, path: _PathCompatible, glob: str) -> None: ... - def watched_files(self, include_globs: bool = ...) -> Iterator[Path]: ... + def watched_files(self, include_globs: bool = True) -> Iterator[Path]: ... def wait_for_apps_ready(self, app_reg: Apps, django_main_thread: threading.Thread) -> bool: ... def run(self, django_main_thread: threading.Thread) -> None: ... def run_loop(self) -> None: ... @@ -66,7 +66,7 @@ class WatchmanReloader(BaseReloader): def watched_roots(self, watched_files: Iterable[Path]) -> frozenset[Path]: ... def update_watches(self) -> None: ... def request_processed(self, **kwargs: Any) -> None: ... - def check_server_status(self, inner_ex: BaseException | None = ...) -> bool: ... + def check_server_status(self, inner_ex: BaseException | None = None) -> bool: ... @classmethod def check_availability(cls) -> None: ... def stop(self) -> None: ... diff --git a/django-stubs/utils/choices.pyi b/django-stubs/utils/choices.pyi index 00f1de65f..dbbca5490 100644 --- a/django-stubs/utils/choices.pyi +++ b/django-stubs/utils/choices.pyi @@ -28,4 +28,4 @@ _V = TypeVar("_V") _L = TypeVar("_L") def flatten_choices(choices: Iterable[tuple[_V, _L | Iterable[tuple[_V, _L]]]]) -> Iterator[tuple[_V, _L]]: ... -def normalize_choices(value: Any, *, depth: int = ...) -> Any: ... +def normalize_choices(value: Any, *, depth: int = 0) -> Any: ... diff --git a/django-stubs/utils/connection.pyi b/django-stubs/utils/connection.pyi index 1a99b09fa..45aac7fb7 100644 --- a/django-stubs/utils/connection.pyi +++ b/django-stubs/utils/connection.pyi @@ -21,12 +21,12 @@ class BaseConnectionHandler(Generic[_T]): thread_critical: bool @cached_property def settings(self) -> dict[str, Any]: ... - def __init__(self, settings: Any | None = ...) -> None: ... + def __init__(self, settings: Any | None = None) -> None: ... def configure_settings(self, settings: dict[str, Any] | None) -> dict[str, Any]: ... def create_connection(self, alias: str) -> _T: ... def __getitem__(self, alias: str) -> _T: ... def __setitem__(self, key: str, value: _T) -> None: ... def __delitem__(self, key: str) -> None: ... def __iter__(self) -> Iterator[str]: ... - def all(self, initialized_only: bool = ...) -> Sequence[_T]: ... + def all(self, initialized_only: bool = False) -> Sequence[_T]: ... def close_all(self) -> None: ... diff --git a/django-stubs/utils/crypto.pyi b/django-stubs/utils/crypto.pyi index 714bcbff1..e4414108d 100644 --- a/django-stubs/utils/crypto.pyi +++ b/django-stubs/utils/crypto.pyi @@ -6,7 +6,7 @@ RANDOM_STRING_CHARS: str class InvalidAlgorithm(ValueError): ... def salted_hmac( - key_salt: bytes | str, value: bytes | str, secret: bytes | str | None = ..., *, algorithm: str = ... + key_salt: bytes | str, value: bytes | str, secret: bytes | str | None = None, *, algorithm: str = "sha1" ) -> HMAC: ... def get_random_string(length: int, allowed_chars: str = ...) -> str: ... def constant_time_compare(val1: bytes | str, val2: bytes | str) -> bool: ... @@ -14,6 +14,6 @@ def pbkdf2( password: bytes | str, salt: bytes | str, iterations: int, - dklen: int = ..., - digest: Callable | None = ..., + dklen: int = 0, + digest: Callable | None = None, ) -> bytes: ... diff --git a/django-stubs/utils/datastructures.pyi b/django-stubs/utils/datastructures.pyi index 3115d56c4..48adc4bd8 100644 --- a/django-stubs/utils/datastructures.pyi +++ b/django-stubs/utils/datastructures.pyi @@ -45,7 +45,7 @@ class _IndexableCollection(Protocol[_I], Collection[_I]): # noqa: PYI046 class OrderedSet(MutableSet[_K]): dict: dict[_K, None] - def __init__(self, iterable: Iterable[_K] | None = ...) -> None: ... + def __init__(self, iterable: Iterable[_K] | None = None) -> None: ... def __contains__(self, item: object) -> bool: ... def __iter__(self) -> Iterator[_K]: ... def __reversed__(self) -> Iterator[_K]: ... @@ -59,20 +59,20 @@ class MultiValueDictKeyError(KeyError): ... class MultiValueDict(dict[_K, _V]): @overload - def __init__(self, key_to_list_mapping: Mapping[_K, list[_V] | None] = ...) -> None: ... + def __init__(self, key_to_list_mapping: Mapping[_K, list[_V] | None]) -> None: ... @overload - def __init__(self, key_to_list_mapping: Iterable[tuple[_K, list[_V]]] = ...) -> None: ... + def __init__(self, key_to_list_mapping: Iterable[tuple[_K, list[_V]]] = ()) -> None: ... @overload def get(self, key: _K) -> _V | None: ... @overload - def get(self, key: _K, default: _Z = ...) -> _V | _Z: ... - def getlist(self, key: _K, default: _Z = ...) -> list[_V] | _Z: ... + def get(self, key: _K, default: _Z) -> _V | _Z: ... + def getlist(self, key: _K, default: _Z | None = None) -> list[_V] | _Z: ... def setlist(self, key: _K, list_: list[_V]) -> None: ... @overload def setdefault(self: MultiValueDict[_K, _V | None], key: _K, default: None = None) -> _V | None: ... @overload def setdefault(self, key: _K, default: _V) -> _V: ... - def setlistdefault(self, key: _K, default_list: list[_V] | None = ...) -> list[_V]: ... + def setlistdefault(self, key: _K, default_list: list[_V] | None = None) -> list[_V]: ... def appendlist(self, key: _K, value: _V) -> None: ... def items(self) -> Iterator[tuple[_K, _V | list[object]]]: ... # type: ignore[override] def lists(self) -> Iterable[tuple[_K, list[_V]]]: ... @@ -91,7 +91,7 @@ class MultiValueDict(dict[_K, _V]): class ImmutableList(tuple[_V, ...]): warning: str - def __new__(cls, *args: Any, warning: str = ..., **kwargs: Any) -> Self: ... + def __new__(cls, *args: Any, warning: str = "ImmutableList object is immutable.", **kwargs: Any) -> Self: ... def complain(self, *args: Any, **kwargs: Any) -> NoReturn: ... @type_check_only diff --git a/django-stubs/utils/deconstruct.pyi b/django-stubs/utils/deconstruct.pyi index 6f721d9b9..8ee1e96b3 100644 --- a/django-stubs/utils/deconstruct.pyi +++ b/django-stubs/utils/deconstruct.pyi @@ -15,4 +15,4 @@ _TCallable = TypeVar("_TCallable", bound=Callable[..., Any]) @overload def deconstructible(_type: type[_T]) -> type[_T]: ... @overload -def deconstructible(*, path: str | None = ...) -> Callable[[_TCallable], _TCallable]: ... +def deconstructible(*, path: str | None = None) -> Callable[[_TCallable], _TCallable]: ... diff --git a/django-stubs/utils/decorators.pyi b/django-stubs/utils/decorators.pyi index 42177efab..8729a3df2 100644 --- a/django-stubs/utils/decorators.pyi +++ b/django-stubs/utils/decorators.pyi @@ -13,7 +13,7 @@ _DECORATOR: TypeAlias = Callable[..., Callable[..., HttpResponseBase] | Callable classonlymethod = classmethod def method_decorator( - decorator: _DECORATOR | Iterable[_DECORATOR], name: str = ... + decorator: _DECORATOR | Iterable[_DECORATOR], name: str = "" ) -> Callable[[_ViewType], _ViewType]: ... def decorator_from_middleware_with_args(middleware_class: type) -> _DECORATOR: ... def decorator_from_middleware(middleware_class: type) -> _DECORATOR: ... diff --git a/django-stubs/utils/encoding.pyi b/django-stubs/utils/encoding.pyi index dede32bf2..88f77bfa2 100644 --- a/django-stubs/utils/encoding.pyi +++ b/django-stubs/utils/encoding.pyi @@ -15,46 +15,46 @@ _B = TypeVar("_B", bound=bytes) _PT = TypeVar("_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time) @overload -def smart_str(s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _P: ... +def smart_str(s: _P, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _P: ... @overload -def smart_str(s: _S, encoding: str = ..., *, errors: str = ...) -> _S: ... +def smart_str(s: _S, encoding: str = "utf-8", *, errors: str = "strict") -> _S: ... @overload -def smart_str(s: Any, encoding: str = ..., *, errors: str = ...) -> str: ... +def smart_str(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> str: ... @overload -def smart_str(s: _PT, encoding: str = ..., strings_only: Literal[True] = True, errors: str = ...) -> _PT: ... +def smart_str(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... @overload -def smart_str(s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _S: ... +def smart_str(s: _S, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _S: ... @overload -def smart_str(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> str: ... +def smart_str(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> str: ... def is_protected_type(obj: Any) -> TypeGuard[_PT]: ... @overload -def force_str(s: _S, encoding: str = ..., *, errors: str = ...) -> _S: ... +def force_str(s: _S, encoding: str = "utf-8", *, errors: str = "strict") -> _S: ... @overload -def force_str(s: Any, encoding: str = ..., *, errors: str = ...) -> str: ... +def force_str(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> str: ... @overload -def force_str(s: _PT, encoding: str = ..., strings_only: Literal[True] = True, errors: str = ...) -> _PT: ... +def force_str(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... @overload -def force_str(s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _S: ... +def force_str(s: _S, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _S: ... @overload -def force_str(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> str: ... +def force_str(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> str: ... @overload -def smart_bytes(s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _P: ... +def smart_bytes(s: _P, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _P: ... @overload -def smart_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = ...) -> _B: ... +def smart_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = "strict") -> _B: ... @overload -def smart_bytes(s: Any, encoding: str = ..., *, errors: str = ...) -> bytes: ... +def smart_bytes(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> bytes: ... @overload -def smart_bytes(s: _PT, encoding: str = ..., strings_only: Literal[True] = True, errors: str = ...) -> _PT: ... +def smart_bytes(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... @overload -def smart_bytes(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> bytes: ... +def smart_bytes(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> bytes: ... @overload -def force_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = ...) -> _B: ... +def force_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = "strict") -> _B: ... @overload -def force_bytes(s: Any, encoding: str = ..., *, errors: str = ...) -> bytes: ... +def force_bytes(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> bytes: ... @overload -def force_bytes(s: _PT, encoding: str = ..., strings_only: Literal[True] = True, errors: str = ...) -> _PT: ... +def force_bytes(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... @overload -def force_bytes(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> bytes: ... +def force_bytes(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> bytes: ... @overload def iri_to_uri(iri: None) -> None: ... @overload diff --git a/django-stubs/utils/formats.pyi b/django-stubs/utils/formats.pyi index 784ad967c..22fdf81e7 100644 --- a/django-stubs/utils/formats.pyi +++ b/django-stubs/utils/formats.pyi @@ -9,19 +9,23 @@ ISO_INPUT_FORMATS: dict[str, list[str]] FORMAT_SETTINGS: frozenset[str] def reset_format_cache() -> None: ... -def iter_format_modules(lang: str, format_module_path: list[str] | str | None = ...) -> Iterator[types.ModuleType]: ... -def get_format_modules(lang: str | None = ...) -> list[types.ModuleType]: ... -def get_format(format_type: str, lang: str | None = ..., use_l10n: bool | None = ...) -> Any: ... +def iter_format_modules(lang: str, format_module_path: list[str] | str | None = None) -> Iterator[types.ModuleType]: ... +def get_format_modules(lang: str | None = None) -> list[types.ModuleType]: ... +def get_format(format_type: str, lang: str | None = None, use_l10n: bool | None = None) -> Any: ... get_format_lazy: Any -def date_format(value: date | builtin_datetime | str, format: str | None = ..., use_l10n: bool | None = ...) -> str: ... -def time_format(value: time | builtin_datetime | str, format: str | None = ..., use_l10n: bool | None = ...) -> str: ... +def date_format( + value: date | builtin_datetime | str, format: str | None = None, use_l10n: bool | None = None +) -> str: ... +def time_format( + value: time | builtin_datetime | str, format: str | None = None, use_l10n: bool | None = None +) -> str: ... def number_format( value: Decimal | float | str, - decimal_pos: int | None = ..., - use_l10n: bool | None = ..., - force_grouping: bool = ..., + decimal_pos: int | None = None, + use_l10n: bool | None = None, + force_grouping: bool = False, ) -> str: ... _T = TypeVar("_T") @@ -30,12 +34,14 @@ _T = TypeVar("_T") # details it works as expected (all values from Union are `localize`d to str, # while type of others is preserved) @overload -def localize(value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = ...) -> str: ... +def localize(value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = None) -> str: ... @overload -def localize(value: _T, use_l10n: bool | None = ...) -> _T: ... +def localize(value: _T, use_l10n: bool | None = None) -> _T: ... @overload -def localize_input(value: builtin_datetime | date | time | Decimal | float | str, default: str | None = ...) -> str: ... +def localize_input( + value: builtin_datetime | date | time | Decimal | float | str, default: str | None = None +) -> str: ... @overload -def localize_input(value: _T, default: str | None = ...) -> _T: ... +def localize_input(value: _T, default: str | None = None) -> _T: ... def sanitize_separators(value: _T) -> _T: ... def sanitize_strftime_format(fmt: str) -> str: ... diff --git a/django-stubs/utils/functional.pyi b/django-stubs/utils/functional.pyi index e62d968c0..954cfec7b 100644 --- a/django-stubs/utils/functional.pyi +++ b/django-stubs/utils/functional.pyi @@ -91,8 +91,8 @@ _Get = TypeVar("_Get", covariant=True) class classproperty(Generic[_Get]): fget: Callable[[Any], _Get] | None - def __init__(self, method: Callable[[Any], _Get] | None = ...) -> None: ... - def __get__(self, instance: Any | None, cls: type[Any] | None = ...) -> _Get: ... + def __init__(self, method: Callable[[Any], _Get] | None = None) -> None: ... + def __get__(self, instance: Any | None, cls: type[Any] | None = None) -> _Get: ... def getter(self, method: Callable[[Any], _Get]) -> classproperty[_Get]: ... @type_check_only diff --git a/django-stubs/utils/html.pyi b/django-stubs/utils/html.pyi index 8b135dbf2..522074b48 100644 --- a/django-stubs/utils/html.pyi +++ b/django-stubs/utils/html.pyi @@ -14,13 +14,13 @@ MAX_URL_LENGTH: int def escape(text: Any) -> SafeString: ... def escapejs(value: Any) -> SafeString: ... -def json_script(value: Any, element_id: str | None = ..., encoder: type[JSONEncoder] | None = ...) -> SafeString: ... +def json_script(value: Any, element_id: str | None = None, encoder: type[JSONEncoder] | None = None) -> SafeString: ... # conditional_escape could use a protocol to be more precise, see https://github.com/typeddjango/django-stubs/issues/1474 def conditional_escape(text: _StrOrPromise | SafeData) -> SafeString: ... def format_html(format_string: str, *args: Any, **kwargs: Any) -> SafeString: ... def format_html_join(sep: str, format_string: str, args_generator: Iterable[Iterable[Any]]) -> SafeString: ... -def linebreaks(value: Any, autoescape: bool = ...) -> str: ... +def linebreaks(value: Any, autoescape: bool = False) -> str: ... class MLStripper(HTMLParser): fed: Any @@ -33,7 +33,7 @@ class MLStripper(HTMLParser): def strip_tags(value: str) -> str: ... def strip_spaces_between_tags(value: str) -> str: ... def smart_urlquote(url: str) -> str: ... -def urlize(text: str, trim_url_limit: int | None = ..., nofollow: bool = ..., autoescape: bool = ...) -> str: ... +def urlize(text: str, trim_url_limit: int | None = None, nofollow: bool = False, autoescape: bool = False) -> str: ... def avoid_wrapping(value: str) -> str: ... def html_safe(klass: type) -> type: ... @@ -50,16 +50,20 @@ class Urlizer: mailto_template: str url_template: str def __call__( - self, text: Incomplete, trim_url_limit: Incomplete | None = ..., nofollow: bool = ..., autoescape: bool = ... + self, + text: Incomplete, + trim_url_limit: Incomplete | None = None, + nofollow: bool = False, + autoescape: bool = False, ) -> Incomplete: ... def handle_word( self, word: Incomplete, *, safe_input: Incomplete, - trim_url_limit: Incomplete | None = ..., - nofollow: bool = ..., - autoescape: bool = ..., + trim_url_limit: Incomplete | None = None, + nofollow: bool = False, + autoescape: bool = False, ) -> Incomplete: ... def trim_url(self, x: str, *, limit: int | None) -> Incomplete: ... def trim_punctuation(self, word: str) -> tuple[str, str, str]: ... diff --git a/django-stubs/utils/http.pyi b/django-stubs/utils/http.pyi index f62eea527..173b8c920 100644 --- a/django-stubs/utils/http.pyi +++ b/django-stubs/utils/http.pyi @@ -15,9 +15,9 @@ def urlencode( | Iterable[tuple[str, str | bytes | int | Iterable[str | bytes | int]]] | None ), - doseq: bool = ..., + doseq: bool = False, ) -> str: ... -def http_date(epoch_seconds: float | None = ...) -> str: ... +def http_date(epoch_seconds: float | None = None) -> str: ... def parse_http_date(date: str) -> int: ... def parse_http_date_safe(date: str) -> int | None: ... def base36_to_int(s: str) -> int: ... @@ -28,7 +28,7 @@ def parse_etags(etag_str: str) -> list[str]: ... def quote_etag(etag_str: str) -> str: ... def is_same_domain(host: str, pattern: str) -> bool: ... def url_has_allowed_host_and_scheme( - url: str | None, allowed_hosts: str | Iterable[str] | None, require_https: bool = ... + url: str | None, allowed_hosts: str | Iterable[str] | None, require_https: bool = False ) -> bool: ... def escape_leading_slashes(url: str) -> str: ... def content_disposition_header(as_attachment: bool, filename: str) -> str | None: ... diff --git a/django-stubs/utils/ipv6.pyi b/django-stubs/utils/ipv6.pyi index 55f882e08..8ee5ecbb4 100644 --- a/django-stubs/utils/ipv6.pyi +++ b/django-stubs/utils/ipv6.pyi @@ -1,4 +1,4 @@ from typing import Any -def clean_ipv6_address(ip_str: Any, unpack_ipv4: bool = ..., error_message: str = ...) -> str: ... +def clean_ipv6_address(ip_str: Any, unpack_ipv4: bool = False, error_message: str = ...) -> str: ... def is_valid_ipv6_address(ip_str: str) -> bool: ... diff --git a/django-stubs/utils/jslex.pyi b/django-stubs/utils/jslex.pyi index 5c19477f1..e34a9ca60 100644 --- a/django-stubs/utils/jslex.pyi +++ b/django-stubs/utils/jslex.pyi @@ -7,9 +7,9 @@ class Tok: name: str regex: str next: str | None - def __init__(self, name: str, regex: str, next: str | None = ...) -> None: ... + def __init__(self, name: str, regex: str, next: str | None = None) -> None: ... -def literals(choices: str, prefix: str = ..., suffix: str = ...) -> str: ... +def literals(choices: str, prefix: str = "", suffix: str = "") -> str: ... class Lexer: regexes: Any diff --git a/django-stubs/utils/log.pyi b/django-stubs/utils/log.pyi index 26f981c19..89fdeaa66 100644 --- a/django-stubs/utils/log.pyi +++ b/django-stubs/utils/log.pyi @@ -17,9 +17,9 @@ class AdminEmailHandler(logging.Handler): email_backend: str | None def __init__( self, - include_html: bool = ..., - email_backend: str | None = ..., - reporter_class: str | None = ..., + include_html: bool = False, + email_backend: str | None = None, + reporter_class: str | None = None, ) -> None: ... def send_mail(self, subject: _StrOrPromise, message: _StrOrPromise, *args: Any, **kwargs: Any) -> None: ... def connection(self) -> Any: ... @@ -45,9 +45,9 @@ class ServerFormatter(logging.Formatter): def log_response( message: str, *args: Any, - response: HttpResponse | None = ..., - request: HttpRequest | None = ..., + response: HttpResponse | None = None, + request: HttpRequest | None = None, logger: Logger = ..., - level: str | None = ..., - exception: BaseException | None = ..., + level: str | None = None, + exception: BaseException | None = None, ) -> None: ... diff --git a/django-stubs/utils/lorem_ipsum.pyi b/django-stubs/utils/lorem_ipsum.pyi index 634da70a9..e0547fa1f 100644 --- a/django-stubs/utils/lorem_ipsum.pyi +++ b/django-stubs/utils/lorem_ipsum.pyi @@ -6,5 +6,5 @@ COMMON_WORDS: Any def sentence() -> str: ... def paragraph() -> str: ... -def paragraphs(count: int, common: bool = ...) -> list[str]: ... -def words(count: int, common: bool = ...) -> str: ... +def paragraphs(count: int, common: bool = True) -> list[str]: ... +def words(count: int, common: bool = True) -> str: ... diff --git a/django-stubs/utils/numberformat.pyi b/django-stubs/utils/numberformat.pyi index 2152a3be8..caab011c9 100644 --- a/django-stubs/utils/numberformat.pyi +++ b/django-stubs/utils/numberformat.pyi @@ -4,9 +4,9 @@ from decimal import Decimal def format( number: Decimal | float | str, decimal_sep: str, - decimal_pos: int | None = ..., - grouping: int | Iterable[int] = ..., - thousand_sep: str = ..., - force_grouping: bool = ..., - use_l10n: bool | None = ..., + decimal_pos: int | None = None, + grouping: int | Iterable[int] = 0, + thousand_sep: str = "", + force_grouping: bool = False, + use_l10n: bool | None = None, ) -> str: ... diff --git a/django-stubs/utils/regex_helper.pyi b/django-stubs/utils/regex_helper.pyi index 7cd62bbce..cfb0bb190 100644 --- a/django-stubs/utils/regex_helper.pyi +++ b/django-stubs/utils/regex_helper.pyi @@ -20,4 +20,4 @@ def flatten_result( # Returns SimpleLazyObject, but we can safely ignore it _P = TypeVar("_P", str, bytes) -def _lazy_re_compile(regex: _P | Pattern[_P], flags: int = ...) -> Pattern[_P]: ... +def _lazy_re_compile(regex: _P | Pattern[_P], flags: int = 0) -> Pattern[_P]: ... diff --git a/django-stubs/utils/termcolors.pyi b/django-stubs/utils/termcolors.pyi index bc75604a4..187f1d684 100644 --- a/django-stubs/utils/termcolors.pyi +++ b/django-stubs/utils/termcolors.pyi @@ -7,8 +7,8 @@ background: dict[str, str] RESET: Literal["0"] opt_dict: dict[str, str] -def colorize(text: str | None = ..., opts: Sequence[str] = ..., *, fg: str = ..., bg: str = ...) -> str: ... -def make_style(opts: Sequence[str] = ..., *, fg: str = ..., bg: str = ...) -> Callable[[str | None], str]: ... +def colorize(text: str | None = "", opts: Sequence[str] = (), *, fg: str = ..., bg: str = ...) -> str: ... +def make_style(opts: Sequence[str] = (), *, fg: str = ..., bg: str = ...) -> Callable[[str | None], str]: ... NOCOLOR_PALETTE: str DARK_PALETTE: str diff --git a/django-stubs/utils/text.pyi b/django-stubs/utils/text.pyi index ecf3e9008..aa54b1cd9 100644 --- a/django-stubs/utils/text.pyi +++ b/django-stubs/utils/text.pyi @@ -30,13 +30,13 @@ re_newlines: Pattern[str] re_camel_case: Pattern[str] def wrap(text: _StrOrPromiseT, width: int) -> _StrOrPromiseT: ... -def add_truncation_text(text: str, truncate: str | None = ...) -> str: ... +def add_truncation_text(text: str, truncate: str | None = None) -> str: ... class Truncator(SimpleLazyObject): MAX_LENGTH_HTML: ClassVar[int] def __init__(self, text: Model | str) -> None: ... - def chars(self, num: int, truncate: str | None = ..., html: bool = ...) -> str: ... - def words(self, num: int, truncate: str | None = ..., html: bool = ...) -> str: ... + def chars(self, num: int, truncate: str | None = None, html: bool = False) -> str: ... + def words(self, num: int, truncate: str | None = None, html: bool = False) -> str: ... def get_valid_filename(name: _StrOrPromiseT) -> _StrOrPromiseT: ... @overload @@ -45,19 +45,19 @@ def get_text_list(list_: list[str], last_word: str = ...) -> str: ... def get_text_list(list_: list[_StrOrPromise], last_word: _StrOrPromise = ...) -> _StrOrPromise: ... def normalize_newlines(text: _StrOrPromiseT) -> _StrOrPromiseT: ... def phone2numeric(phone: _StrOrPromiseT) -> _StrOrPromiseT: ... -def compress_string(s: bytes, *, max_random_bytes: int | None = ...) -> bytes: ... +def compress_string(s: bytes, *, max_random_bytes: int | None = None) -> bytes: ... class StreamingBuffer(BytesIO): vals: list[bytes] def read(self) -> bytes: ... # type: ignore[override] -def compress_sequence(sequence: Iterable[bytes], *, max_random_bytes: int | None = ...) -> Iterator[bytes]: ... +def compress_sequence(sequence: Iterable[bytes], *, max_random_bytes: int | None = None) -> Iterator[bytes]: ... smart_split_re: Pattern[str] def smart_split(text: str) -> Iterator[str]: ... def unescape_string_literal(s: _StrOrPromiseT) -> _StrOrPromiseT: ... -def slugify(value: _StrOrPromiseT, allow_unicode: bool = ...) -> _StrOrPromiseT: ... +def slugify(value: _StrOrPromiseT, allow_unicode: bool = False) -> _StrOrPromiseT: ... def camel_case_to_spaces(value: str) -> str: ... format_lazy: Callable[..., str] diff --git a/django-stubs/utils/timesince.pyi b/django-stubs/utils/timesince.pyi index c08022d2a..c1089993d 100644 --- a/django-stubs/utils/timesince.pyi +++ b/django-stubs/utils/timesince.pyi @@ -7,9 +7,9 @@ MONTHS_DAYS: tuple[int, ...] def timesince( d: date, - now: date | None = ..., - reversed: bool = ..., - time_strings: dict[str, str] | None = ..., - depth: int = ..., + now: date | None = None, + reversed: bool = False, + time_strings: dict[str, str] | None = None, + depth: int = 2, ) -> str: ... -def timeuntil(d: date, now: date | None = ..., time_strings: dict[str, str] | None = ..., depth: int = ...) -> str: ... +def timeuntil(d: date, now: date | None = None, time_strings: dict[str, str] | None = None, depth: int = 2) -> str: ... diff --git a/django-stubs/utils/timezone.pyi b/django-stubs/utils/timezone.pyi index f0e610141..d91ae571a 100644 --- a/django-stubs/utils/timezone.pyi +++ b/django-stubs/utils/timezone.pyi @@ -25,8 +25,8 @@ class override(ContextDecorator): exc_tb: TracebackType | None, ) -> None: ... -def localtime(value: datetime | None = ..., timezone: tzinfo | None = ...) -> datetime: ... -def localdate(value: datetime | None = ..., timezone: tzinfo | None = ...) -> date: ... +def localtime(value: datetime | None = None, timezone: tzinfo | None = None) -> datetime: ... +def localdate(value: datetime | None = None, timezone: tzinfo | None = None) -> date: ... def now() -> datetime: ... @overload def is_aware(value: time) -> Literal[False]: ... @@ -36,5 +36,5 @@ def is_aware(value: datetime) -> bool: ... def is_naive(value: time) -> Literal[True]: ... @overload def is_naive(value: datetime) -> bool: ... -def make_aware(value: datetime, timezone: tzinfo | None = ...) -> datetime: ... -def make_naive(value: datetime, timezone: tzinfo | None = ...) -> datetime: ... +def make_aware(value: datetime, timezone: tzinfo | None = None) -> datetime: ... +def make_naive(value: datetime, timezone: tzinfo | None = None) -> datetime: ... diff --git a/django-stubs/utils/translation/__init__.pyi b/django-stubs/utils/translation/__init__.pyi index 92b2efc3f..90152ff88 100644 --- a/django-stubs/utils/translation/__init__.pyi +++ b/django-stubs/utils/translation/__init__.pyi @@ -16,15 +16,15 @@ def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... # lazy evaluated translation functions def gettext_lazy(message: str) -> _StrPromise: ... def pgettext_lazy(context: str, message: str) -> _StrPromise: ... -def ngettext_lazy(singular: str, plural: str, number: int | str | None = ...) -> _StrPromise: ... -def npgettext_lazy(context: str, singular: str, plural: str, number: int | str | None = ...) -> _StrPromise: ... +def ngettext_lazy(singular: str, plural: str, number: int | str | None = None) -> _StrPromise: ... +def npgettext_lazy(context: str, singular: str, plural: str, number: int | str | None = None) -> _StrPromise: ... def activate(language: str) -> None: ... def deactivate() -> None: ... class override(ContextDecorator): language: str | None deactivate: bool - def __init__(self, language: str | None, deactivate: bool = ...) -> None: ... + def __init__(self, language: str | None, deactivate: bool = False) -> None: ... old_language: str | None def __enter__(self) -> None: ... def __exit__( @@ -40,10 +40,10 @@ def get_language_bidi() -> bool: ... def check_for_language(lang_code: str | None) -> bool: ... def to_language(locale: str) -> str: ... def to_locale(language: str) -> str: ... -def get_language_from_request(request: HttpRequest, check_path: bool = ...) -> str: ... +def get_language_from_request(request: HttpRequest, check_path: bool = False) -> str: ... def templatize(src: str, **kwargs: Any) -> str: ... def deactivate_all() -> None: ... -def get_supported_language_variant(lang_code: str, *, strict: bool = ...) -> str: ... +def get_supported_language_variant(lang_code: str, *, strict: bool = False) -> str: ... def get_language_info(lang_code: str) -> Any: ... def trim_whitespace(s: str) -> str: ... def round_away_from_one(value: int) -> int: ... diff --git a/django-stubs/utils/translation/template.pyi b/django-stubs/utils/translation/template.pyi index ba7accc00..66086d8bc 100644 --- a/django-stubs/utils/translation/template.pyi +++ b/django-stubs/utils/translation/template.pyi @@ -13,4 +13,4 @@ endblock_re: Pattern[str] plural_re: Pattern[str] constant_re: Pattern[str] -def templatize(src: str, origin: str | None = ...) -> str: ... +def templatize(src: str, origin: str | None = None) -> str: ... diff --git a/django-stubs/utils/translation/trans_null.pyi b/django-stubs/utils/translation/trans_null.pyi index 742fc5022..8e40e4a82 100644 --- a/django-stubs/utils/translation/trans_null.pyi +++ b/django-stubs/utils/translation/trans_null.pyi @@ -20,6 +20,6 @@ deactivate_all = deactivate def get_language() -> str: ... def get_language_bidi() -> bool: ... def check_for_language(x: str) -> bool: ... -def get_language_from_request(request: HttpRequest, check_path: bool = ...) -> str: ... +def get_language_from_request(request: HttpRequest, check_path: bool = False) -> str: ... def get_language_from_path(request: str) -> None: ... -def get_supported_language_variant(lang_code: str, strict: bool = ...) -> str: ... +def get_supported_language_variant(lang_code: str, strict: bool = False) -> str: ... diff --git a/django-stubs/utils/translation/trans_real.pyi b/django-stubs/utils/translation/trans_real.pyi index 9130279c2..28664c653 100644 --- a/django-stubs/utils/translation/trans_real.pyi +++ b/django-stubs/utils/translation/trans_real.pyi @@ -29,20 +29,20 @@ _Z = TypeVar("_Z") class TranslationCatalog: _catalogs: list[dict[_KeyT, str]] - def __init__(self, trans: gettext_module.NullTranslations | None = ...) -> None: ... + def __init__(self, trans: gettext_module.NullTranslations | None = None) -> None: ... def __getitem__(self, key: _KeyT) -> str: ... def __setitem__(self, key: _KeyT, value: str) -> None: ... def __contains__(self, key: _KeyT) -> bool: ... def items(self) -> Iterator[tuple[_KeyT, str]]: ... def keys(self) -> Iterator[_KeyT]: ... def update(self, trans: gettext_module.NullTranslations) -> None: ... - def get(self, key: _KeyT, default: _Z = ...) -> str | _Z: ... + def get(self, key: _KeyT, default: _Z | None = None) -> str | _Z: ... def plural(self, msgid: str, num: int) -> str: ... class DjangoTranslation(gettext_module.GNUTranslations): domain: str plural: _PluralCallable - def __init__(self, language: str, domain: str | None = ..., localedirs: list[str] | None = ...) -> None: ... + def __init__(self, language: str, domain: str | None = None, localedirs: list[str] | None = None) -> None: ... def merge(self, other: NullTranslations) -> None: ... def language(self) -> str: ... def to_language(self) -> str: ... @@ -64,7 +64,7 @@ def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... def all_locale_paths() -> list[str]: ... def check_for_language(lang_code: str | None) -> bool: ... def get_languages() -> dict[str, str]: ... -def get_supported_language_variant(lang_code: str | None, strict: bool = ...) -> str: ... -def get_language_from_path(path: str, strict: bool = ...) -> str | None: ... -def get_language_from_request(request: HttpRequest, check_path: bool = ...) -> str: ... +def get_supported_language_variant(lang_code: str | None, strict: bool = False) -> str: ... +def get_language_from_path(path: str, strict: bool = False) -> str | None: ... +def get_language_from_request(request: HttpRequest, check_path: bool = False) -> str: ... def parse_accept_lang_header(lang_string: str) -> tuple[tuple[str, float], ...]: ... diff --git a/django-stubs/utils/tree.pyi b/django-stubs/utils/tree.pyi index a164efb3a..06704fd80 100644 --- a/django-stubs/utils/tree.pyi +++ b/django-stubs/utils/tree.pyi @@ -12,10 +12,12 @@ class Node: connector: str negated: bool def __init__( - self, children: _NodeChildren | None = ..., connector: str | None = ..., negated: bool = ... + self, children: _NodeChildren | None = None, connector: str | None = None, negated: bool = False ) -> None: ... @classmethod - def create(cls, children: _NodeChildren | None = ..., connector: str | None = ..., negated: bool = ...) -> Node: ... + def create( + cls, children: _NodeChildren | None = None, connector: str | None = None, negated: bool = False + ) -> Node: ... def copy(self) -> Node: ... def __copy__(self) -> Node: ... def __deepcopy__(self, memodict: dict[Any, Any]) -> Node: ... diff --git a/django-stubs/utils/version.pyi b/django-stubs/utils/version.pyi index 358b1ea85..7bc0e2da3 100644 --- a/django-stubs/utils/version.pyi +++ b/django-stubs/utils/version.pyi @@ -10,9 +10,9 @@ PY312: bool _VT: TypeAlias = tuple[int, int, int, str, int] -def get_version(version: _VT | None = ...) -> str: ... -def get_main_version(version: _VT | None = ...) -> str: ... -def get_complete_version(version: _VT | None = ...) -> _VT: ... -def get_docs_version(version: _VT | None = ...) -> str: ... +def get_version(version: _VT | None = None) -> str: ... +def get_main_version(version: _VT | None = None) -> str: ... +def get_complete_version(version: _VT | None = None) -> _VT: ... +def get_docs_version(version: _VT | None = None) -> str: ... def get_git_changeset() -> str | None: ... def get_version_tuple(version: str) -> tuple[int, int, int]: ... diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 789b04935..ef1e3d326 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -308,7 +308,6 @@ django.contrib.gis.db.models.ForeignObject.path_infos django.contrib.gis.db.models.ForeignObject.related_accessor_class django.contrib.gis.db.models.ForeignObject.requires_unique_target django.contrib.gis.db.models.ForeignObject.reverse_path_infos -django.contrib.gis.db.models.ForeignObjectRel.__init__ django.contrib.gis.db.models.ForeignObjectRel.empty_strings_allowed django.contrib.gis.db.models.ForeignObjectRel.get_extra_restriction django.contrib.gis.db.models.ForeignObjectRel.identity @@ -338,7 +337,6 @@ django.contrib.gis.db.models.ManyToManyField.formfield django.contrib.gis.db.models.ManyToManyField.path_infos django.contrib.gis.db.models.ManyToManyField.reverse_path_infos django.contrib.gis.db.models.ManyToManyRel.identity -django.contrib.gis.db.models.ManyToOneRel.__init__ django.contrib.gis.db.models.ManyToOneRel.identity django.contrib.gis.db.models.Model.add_to_class django.contrib.gis.db.models.ObjectDoesNotExist @@ -346,7 +344,6 @@ django.contrib.gis.db.models.OneToOneField.__get__ django.contrib.gis.db.models.OneToOneField.formfield django.contrib.gis.db.models.OneToOneField.forward_related_accessor_class django.contrib.gis.db.models.OneToOneField.related_accessor_class -django.contrib.gis.db.models.OneToOneRel.__init__ django.contrib.gis.db.models.OrderBy.as_oracle django.contrib.gis.db.models.OrderBy.as_sql django.contrib.gis.db.models.PositiveBigIntegerField.formfield @@ -356,7 +353,6 @@ django.contrib.gis.db.models.PositiveIntegerField.integer_field_class django.contrib.gis.db.models.PositiveSmallIntegerField.formfield django.contrib.gis.db.models.PositiveSmallIntegerField.integer_field_class django.contrib.gis.db.models.Q.XOR -django.contrib.gis.db.models.Q.resolve_expression django.contrib.gis.db.models.QuerySet.__deepcopy__ django.contrib.gis.db.models.QuerySet.__reversed__ django.contrib.gis.db.models.QuerySet.__xor__ @@ -429,7 +425,6 @@ django.contrib.gis.forms.SelectDateWidget.select_widget django.contrib.gis.forms.SelectDateWidget.use_fieldset django.contrib.gis.forms.SplitDateTimeField.hidden_widget django.contrib.gis.forms.TextInput.__slotnames__ -django.contrib.gis.forms.Widget.subwidgets django.contrib.gis.forms.Widget.use_fieldset django.contrib.gis.forms.formset_factory django.contrib.gis.forms.inlineformset_factory @@ -538,16 +533,12 @@ django.core.handlers.asgi.ASGIRequest.FILES django.core.handlers.wsgi.WSGIRequest.COOKIES django.core.handlers.wsgi.WSGIRequest.FILES django.core.handlers.wsgi.WSGIRequest.GET -django.core.mail.SafeMIMEMultipart.__init__ -django.core.mail.SafeMIMEText.__init__ django.core.mail.backends.filebased.EmailBackend.__init__ django.core.mail.backends.locmem.EmailBackend.send_messages django.core.mail.backends.smtp.EmailBackend.__init__ django.core.mail.backends.smtp.EmailBackend.connection_class django.core.mail.backends.smtp.EmailBackend.ssl_context django.core.mail.make_msgid -django.core.mail.message.SafeMIMEMultipart.__init__ -django.core.mail.message.SafeMIMEText.__init__ django.core.mail.outbox django.core.management.commands.makemessages.TranslatableFile.__ge__ django.core.management.commands.makemessages.TranslatableFile.__gt__ @@ -623,7 +614,6 @@ django.db.backends.utils.split_tzname_delta django.db.connection django.db.migrations.Migration.suggest_name django.db.migrations.autodetector.MigrationAutodetector.generate_removed_altered_index_together -django.db.migrations.graph.MigrationGraph.make_state django.db.migrations.graph.Node.__ge__ django.db.migrations.graph.Node.__gt__ django.db.migrations.graph.Node.__le__ @@ -731,7 +721,6 @@ django.db.models.ForeignObject.path_infos django.db.models.ForeignObject.related_accessor_class django.db.models.ForeignObject.requires_unique_target django.db.models.ForeignObject.reverse_path_infos -django.db.models.ForeignObjectRel.__init__ django.db.models.ForeignObjectRel.empty_strings_allowed django.db.models.ForeignObjectRel.get_extra_restriction django.db.models.ForeignObjectRel.identity @@ -759,7 +748,6 @@ django.db.models.ManyToManyField.formfield django.db.models.ManyToManyField.path_infos django.db.models.ManyToManyField.reverse_path_infos django.db.models.ManyToManyRel.identity -django.db.models.ManyToOneRel.__init__ django.db.models.ManyToOneRel.identity django.db.models.Model.add_to_class django.db.models.ObjectDoesNotExist @@ -767,7 +755,6 @@ django.db.models.OneToOneField.__get__ django.db.models.OneToOneField.formfield django.db.models.OneToOneField.forward_related_accessor_class django.db.models.OneToOneField.related_accessor_class -django.db.models.OneToOneRel.__init__ django.db.models.OrderBy.as_oracle django.db.models.OrderBy.as_sql django.db.models.PositiveBigIntegerField.formfield @@ -777,7 +764,6 @@ django.db.models.PositiveIntegerField.integer_field_class django.db.models.PositiveSmallIntegerField.formfield django.db.models.PositiveSmallIntegerField.integer_field_class django.db.models.Q.XOR -django.db.models.Q.resolve_expression django.db.models.QuerySet.__deepcopy__ django.db.models.QuerySet.__reversed__ django.db.models.QuerySet.__xor__ @@ -969,7 +955,6 @@ django.db.models.fields.related.ForeignObject.path_infos django.db.models.fields.related.ForeignObject.related_accessor_class django.db.models.fields.related.ForeignObject.requires_unique_target django.db.models.fields.related.ForeignObject.reverse_path_infos -django.db.models.fields.related.ForeignObjectRel.__init__ django.db.models.fields.related.ForeignObjectRel.empty_strings_allowed django.db.models.fields.related.ForeignObjectRel.get_extra_restriction django.db.models.fields.related.ForeignObjectRel.identity @@ -980,28 +965,23 @@ django.db.models.fields.related.ManyToManyField.formfield django.db.models.fields.related.ManyToManyField.path_infos django.db.models.fields.related.ManyToManyField.reverse_path_infos django.db.models.fields.related.ManyToManyRel.identity -django.db.models.fields.related.ManyToOneRel.__init__ django.db.models.fields.related.ManyToOneRel.identity django.db.models.fields.related.OneToOneField.__get__ django.db.models.fields.related.OneToOneField.formfield django.db.models.fields.related.OneToOneField.forward_related_accessor_class django.db.models.fields.related.OneToOneField.related_accessor_class -django.db.models.fields.related.OneToOneRel.__init__ django.db.models.fields.related.RelatedField.formfield django.db.models.fields.related.lazy_related_operation django.db.models.fields.related_descriptors.ForeignKeyDeferredAttribute.__set__ django.db.models.fields.related_lookups.MultiColSource.contains_over_clause django.db.models.fields.related_lookups.MultiColSource.resolve_expression django.db.models.fields.related_lookups.RelatedLookupMixin.as_sql -django.db.models.fields.reverse_related.ForeignObjectRel.__init__ django.db.models.fields.reverse_related.ForeignObjectRel.empty_strings_allowed django.db.models.fields.reverse_related.ForeignObjectRel.get_extra_restriction django.db.models.fields.reverse_related.ForeignObjectRel.identity django.db.models.fields.reverse_related.ForeignObjectRel.path_infos django.db.models.fields.reverse_related.ManyToManyRel.identity -django.db.models.fields.reverse_related.ManyToOneRel.__init__ django.db.models.fields.reverse_related.ManyToOneRel.identity -django.db.models.fields.reverse_related.OneToOneRel.__init__ django.db.models.functions.Cast.as_mysql django.db.models.functions.Cast.as_oracle django.db.models.functions.Cast.as_postgresql @@ -1138,14 +1118,12 @@ django.db.models.query.QuerySet.__deepcopy__ django.db.models.query.QuerySet.__reversed__ django.db.models.query.QuerySet.__xor__ django.db.models.query.RawQuerySet.__aiter__ -django.db.models.query.RawQuerySet.__init__ django.db.models.query.RelatedPopulator django.db.models.query.get_related_populators django.db.models.query.normalize_prefetch_lookups django.db.models.query.prefetch_one_level django.db.models.query_utils.InvalidQuery django.db.models.query_utils.Q.XOR -django.db.models.query_utils.Q.resolve_expression django.db.models.query_utils.Q.identity django.db.models.query_utils.RegisterLookupMixin._unregister_lookup django.db.models.query_utils.RegisterLookupMixin.get_class_lookups @@ -1225,7 +1203,6 @@ django.forms.SelectDateWidget.select_widget django.forms.SelectDateWidget.use_fieldset django.forms.SplitDateTimeField.hidden_widget django.forms.TextInput.__slotnames__ -django.forms.Widget.subwidgets django.forms.Widget.use_fieldset django.forms.boundfield.BoundWidget.__html__ django.forms.fields.ChoiceField.__deepcopy__ @@ -1256,7 +1233,6 @@ django.forms.models.inlineformset_factory django.forms.models.modelform_factory django.forms.models.modelformset_factory django.forms.renderers.DjangoDivFormRenderer -django.forms.widgets.ChoiceWidget.subwidgets django.forms.widgets.ChoiceWidget.template_name django.forms.widgets.EmailInput.__slotnames__ django.forms.widgets.HiddenInput.__slotnames__ @@ -1270,13 +1246,11 @@ django.forms.widgets.RadioSelect.use_fieldset django.forms.widgets.SelectDateWidget.select_widget django.forms.widgets.SelectDateWidget.use_fieldset django.forms.widgets.TextInput.__slotnames__ -django.forms.widgets.Widget.subwidgets django.forms.widgets.Widget.use_fieldset django.http.HttpRequest.__init__ django.http.StreamingHttpResponse.content django.http.request.HttpRequest.__init__ django.http.response.StreamingHttpResponse.content -django.template.EngineHandler.__init__ django.template.Library.filter_function django.template.Library.simple_tag django.template.Node.__iter__ @@ -1301,10 +1275,6 @@ django.template.loaders.cached.Loader.get_dirs django.template.smartif.EndToken django.template.smartif.key django.template.smartif.op -django.template.utils.EngineHandler.__init__ -django.templatetags.i18n.BlockTranslateNode.__init__ -django.templatetags.static.PrefixNode.__init__ -django.templatetags.static.StaticNode.__init__ django.test.runner.DiscoverRunner.log django.test.runner.DiscoverRunner.reorder_by django.test.runner.DummyList