diff --git a/django-stubs/contrib/admin/checks.pyi b/django-stubs/contrib/admin/checks.pyi index 0921c73cb..ccbcc7526 100644 --- a/django-stubs/contrib/admin/checks.pyi +++ b/django-stubs/contrib/admin/checks.pyi @@ -15,7 +15,7 @@ class ModelAdminChecks(BaseModelAdminChecks): def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... class InlineModelAdminChecks(BaseModelAdminChecks): - def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... # type: ignore + def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... # type: ignore[override] def must_be(type: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index b5dbafbdd..ad959e3e5 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -307,10 +307,10 @@ class InlineModelAdmin(Generic[_ChildModelT, _ParentModelT], BaseModelAdmin[_Chi self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any ) -> type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]]: ... def get_queryset(self, request: HttpRequest) -> QuerySet[_ChildModelT]: ... - def has_add_permission(self, request: HttpRequest, obj: _ParentModelT | None) -> bool: ... # type: ignore - def has_change_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore - def has_delete_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore - def has_view_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore + def has_add_permission(self, request: HttpRequest, obj: _ParentModelT | None) -> bool: ... # type: ignore[override] + def has_change_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override] + def has_delete_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override] + def has_view_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override] class StackedInline(InlineModelAdmin[_ChildModelT, _ParentModelT]): template: str diff --git a/django-stubs/contrib/admin/utils.pyi b/django-stubs/contrib/admin/utils.pyi index 69ca9b3b1..b5aaa4641 100644 --- a/django-stubs/contrib/admin/utils.pyi +++ b/django-stubs/contrib/admin/utils.pyi @@ -56,7 +56,7 @@ def lookup_field( name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ... ) -> tuple[Field | None, str | None, Any]: ... @overload -def label_for_field( # type: ignore +def label_for_field( # type: ignore[misc] name: Callable | str, model: type[Model], model_admin: BaseModelAdmin | None = ..., diff --git a/django-stubs/contrib/admin/widgets.pyi b/django-stubs/contrib/admin/widgets.pyi index 1d08d39aa..ca8ee614a 100644 --- a/django-stubs/contrib/admin/widgets.pyi +++ b/django-stubs/contrib/admin/widgets.pyi @@ -54,7 +54,7 @@ class ForeignKeyRawIdWidget(forms.TextInput): def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ... class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): - rel: ManyToManyRel # type: ignore + rel: ManyToManyRel # type: ignore[assignment] def __init__( self, rel: ManyToManyRel, diff --git a/django-stubs/contrib/gis/db/backends/mysql/features.pyi b/django-stubs/contrib/gis/db/backends/mysql/features.pyi index 50997f56a..411d49e61 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/features.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/features.pyi @@ -15,6 +15,6 @@ class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): @property def empty_intersection_returns_none(self) -> bool: ... @property - def supports_geometry_field_unique_index(self) -> bool: ... # type: ignore + def supports_geometry_field_unique_index(self) -> bool: ... # type: ignore[override] @property - def django_test_skips(self) -> dict[str, Any]: ... # type: ignore + def django_test_skips(self) -> dict[str, Any]: ... # type: ignore[override] diff --git a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi index 29c0fb951..9d87b9c2f 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi @@ -13,16 +13,16 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations): @property def mariadb(self) -> bool: ... @property - def mysql(self) -> bool: ... # type: ignore + def mysql(self) -> bool: ... # type: ignore[override] @property - def select(self) -> str: ... # type: ignore + def select(self) -> str: ... # type: ignore[override] @property - def from_text(self) -> str: ... # type: ignore + def from_text(self) -> str: ... # type: ignore[override] @property def gis_operators(self) -> dict[str, SpatialOperator]: ... disallowed_aggregates: Any @property - def unsupported_functions(self) -> set[str]: ... # type: ignore + def unsupported_functions(self) -> set[str]: ... # type: ignore[override] def geo_db_type(self, f: Any) -> Any: ... def get_distance(self, f: Any, value: Any, lookup_type: Any) -> list[Any]: ... def get_geometry_converter(self, expression: Any) -> Callable[[Any, Any, Any], GEOSGeometryBase | None]: ... diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index a0130cfc2..2b34c7885 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -51,5 +51,5 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): error_messages: _ErrorMessagesMapping | None = ..., ) -> None: ... @property - def description(self) -> str: ... # type: ignore + def description(self) -> str: ... # type: ignore[override] def get_transform(self, name: Any) -> type[Transform] | None: ... diff --git a/django-stubs/contrib/postgres/forms/array.pyi b/django-stubs/contrib/postgres/forms/array.pyi index 7d4cbb37e..f12bc2559 100644 --- a/django-stubs/contrib/postgres/forms/array.pyi +++ b/django-stubs/contrib/postgres/forms/array.pyi @@ -26,7 +26,7 @@ class SimpleArrayField(forms.CharField): ) -> None: ... def clean(self, value: Any) -> Sequence[Any]: ... def prepare_value(self, value: Any) -> Any: ... - def to_python(self, value: Any) -> Sequence[Any]: ... # type: ignore + def to_python(self, value: Any) -> Sequence[Any]: ... # type: ignore[override] def validate(self, value: Sequence[Any]) -> None: ... def run_validators(self, value: Sequence[Any]) -> None: ... def has_changed(self, initial: Any, data: Any) -> bool: ... @@ -43,7 +43,7 @@ class SplitArrayWidget(forms.Widget): def id_for_label(self, id_: str) -> str: ... def get_context(self, name: str, value: Any, attrs: _OptAttrs | None = ...) -> dict[str, Any]: ... @property - def needs_multipart_form(self) -> bool: ... # type: ignore + def needs_multipart_form(self) -> bool: ... # type: ignore[override] class SplitArrayField(forms.Field): default_error_messages: _ErrorMessagesDict diff --git a/django-stubs/contrib/postgres/forms/hstore.pyi b/django-stubs/contrib/postgres/forms/hstore.pyi index aa90cfecf..d672d3b85 100644 --- a/django-stubs/contrib/postgres/forms/hstore.pyi +++ b/django-stubs/contrib/postgres/forms/hstore.pyi @@ -8,5 +8,5 @@ class HStoreField(forms.CharField): widget: _ClassLevelWidgetT default_error_messages: _ErrorMessagesDict def prepare_value(self, value: Any) -> Any: ... - def to_python(self, value: Any) -> dict[str, str | None]: ... # type: ignore + def to_python(self, value: Any) -> dict[str, str | None]: ... # type: ignore[override] def has_changed(self, initial: Any, data: Any) -> bool: ... diff --git a/django-stubs/contrib/postgres/indexes.pyi b/django-stubs/contrib/postgres/indexes.pyi index 6dcde3f10..ac10eb3ca 100644 --- a/django-stubs/contrib/postgres/indexes.pyi +++ b/django-stubs/contrib/postgres/indexes.pyi @@ -10,7 +10,7 @@ from django.utils.datastructures import _ListOrTuple class PostgresIndex(Index): @property - def max_name_length(self) -> int: ... # type: ignore + def max_name_length(self) -> int: ... # type: ignore[override] def create_sql( self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = ..., **kwargs: Any ) -> Statement: ... diff --git a/django-stubs/contrib/postgres/search.pyi b/django-stubs/contrib/postgres/search.pyi index 60ee87166..f3e0dcc5f 100644 --- a/django-stubs/contrib/postgres/search.pyi +++ b/django-stubs/contrib/postgres/search.pyi @@ -47,7 +47,7 @@ class SearchQueryCombinable: def __and__(self, other: SearchQueryCombinable) -> Self: ... def __rand__(self, other: SearchQueryCombinable) -> Self: ... -class SearchQuery(SearchQueryCombinable, Func): # type: ignore +class SearchQuery(SearchQueryCombinable, Func): # type: ignore[misc] SEARCH_TYPES: dict[str, str] def __init__( self, @@ -60,7 +60,7 @@ class SearchQuery(SearchQueryCombinable, Func): # type: ignore ) -> None: ... def __invert__(self) -> Self: ... # type: ignore[override] -class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore +class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore[misc] def __init__( self, lhs: Combinable, diff --git a/django-stubs/contrib/staticfiles/handlers.pyi b/django-stubs/contrib/staticfiles/handlers.pyi index 3b3e4c6a3..423631f12 100644 --- a/django-stubs/contrib/staticfiles/handlers.pyi +++ b/django-stubs/contrib/staticfiles/handlers.pyi @@ -26,7 +26,7 @@ class StaticFilesHandlerMixin: def get_response(self, request: HttpRequest) -> HttpResponseBase: ... async def get_response_async(self, request: HttpRequest) -> HttpResponseBase: ... -class StaticFilesHandler(StaticFilesHandlerMixin, WSGIHandler): # type: ignore +class StaticFilesHandler(StaticFilesHandlerMixin, WSGIHandler): # type: ignore[misc] application: WSGIHandler base_url: ParseResult def __init__(self, application: WSGIHandler) -> None: ... @@ -36,7 +36,7 @@ class StaticFilesHandler(StaticFilesHandlerMixin, WSGIHandler): # type: ignore start_response: StartResponse, ) -> HttpResponseBase: ... -class ASGIStaticFilesHandler(StaticFilesHandlerMixin, ASGIHandler): # type: ignore +class ASGIStaticFilesHandler(StaticFilesHandlerMixin, ASGIHandler): # type: ignore[misc] application: ASGIHandler base_url: ParseResult def __init__(self, application: ASGIHandler) -> None: ... diff --git a/django-stubs/contrib/staticfiles/storage.pyi b/django-stubs/contrib/staticfiles/storage.pyi index b38491814..bb1db0129 100644 --- a/django-stubs/contrib/staticfiles/storage.pyi +++ b/django-stubs/contrib/staticfiles/storage.pyi @@ -49,7 +49,7 @@ class ManifestFilesMixin(HashedFilesMixin): def post_process(self, *args: Any, **kwargs: Any) -> _PostProcessT: ... def stored_name(self, name: str) -> str: ... -class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage): ... # type: ignore +class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage): ... # type: ignore[misc] class ConfiguredStorage(LazyObject): ... staticfiles_storage: Storage diff --git a/django-stubs/core/handlers/asgi.pyi b/django-stubs/core/handlers/asgi.pyi index f83101063..19e0c085e 100644 --- a/django-stubs/core/handlers/asgi.pyi +++ b/django-stubs/core/handlers/asgi.pyi @@ -23,11 +23,11 @@ class ASGIRequest(HttpRequest): META: dict[str, Any] def __init__(self, scope: Mapping[str, Any], body_file: IO[bytes]) -> None: ... @property - def GET(self) -> _ImmutableQueryDict: ... # type: ignore + def GET(self) -> _ImmutableQueryDict: ... # type: ignore[override] POST: _ImmutableQueryDict FILES: MultiValueDict @property - def COOKIES(self) -> dict[str, str]: ... # type: ignore + def COOKIES(self) -> dict[str, str]: ... # type: ignore[override] _T = TypeVar("_T") diff --git a/django-stubs/core/mail/message.pyi b/django-stubs/core/mail/message.pyi index f57ecaeb4..915dd6860 100644 --- a/django-stubs/core/mail/message.pyi +++ b/django-stubs/core/mail/message.pyi @@ -27,14 +27,14 @@ class MIMEMixin: def as_string(self, unixfrom: bool = ..., linesep: str = ...) -> str: ... def as_bytes(self, unixfrom: bool = ..., linesep: str = ...) -> bytes: ... -class SafeMIMEMessage(MIMEMixin, MIMEMessage): # type: ignore +class SafeMIMEMessage(MIMEMixin, MIMEMessage): # type: ignore[misc] defects: list[Any] epilogue: Any policy: Policy preamble: Any def __setitem__(self, name: str, val: str) -> None: ... -class SafeMIMEText(MIMEMixin, MIMEText): # type: ignore +class SafeMIMEText(MIMEMixin, MIMEText): # type: ignore[misc] defects: list[Any] epilogue: None policy: Policy @@ -46,7 +46,7 @@ class SafeMIMEText(MIMEMixin, MIMEText): # type: ignore self, payload: list[Message] | str | bytes, charset: str | Charset.Charset | None = ... ) -> None: ... -class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): # type: ignore +class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): # type: ignore[misc] defects: list[Any] epilogue: None policy: Policy diff --git a/django-stubs/db/backends/mysql/features.pyi b/django-stubs/db/backends/mysql/features.pyi index 2db617802..c8e243cfd 100644 --- a/django-stubs/db/backends/mysql/features.pyi +++ b/django-stubs/db/backends/mysql/features.pyi @@ -42,46 +42,46 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_table_check_constraints: bool can_return_rows_from_bulk_insert: bool @property - def allows_auto_pk_0(self) -> bool: ... # type: ignore + def allows_auto_pk_0(self) -> bool: ... # type: ignore[override] @property - def update_can_self_select(self) -> bool: ... # type: ignore + def update_can_self_select(self) -> bool: ... # type: ignore[override] @property - def can_introspect_foreign_keys(self) -> bool: ... # type: ignore + def can_introspect_foreign_keys(self) -> bool: ... # type: ignore[override] @property def introspected_field_types(self) -> dict[str, str]: ... # type: ignore [override] @property - def can_return_columns_from_insert(self) -> bool: ... # type: ignore + def can_return_columns_from_insert(self) -> bool: ... # type: ignore[override] @property - def has_zoneinfo_database(self) -> bool: ... # type: ignore + def has_zoneinfo_database(self) -> bool: ... # type: ignore[override] @property def is_sql_auto_is_null_enabled(self) -> bool: ... @property - def supports_over_clause(self) -> bool: ... # type: ignore + def supports_over_clause(self) -> bool: ... # type: ignore[override] @property - def supports_column_check_constraints(self) -> bool: ... # type: ignore + def supports_column_check_constraints(self) -> bool: ... # type: ignore[override] @property - def can_introspect_check_constraints(self) -> bool: ... # type: ignore + def can_introspect_check_constraints(self) -> bool: ... # type: ignore[override] @property - def has_select_for_update_skip_locked(self) -> bool: ... # type: ignore + def has_select_for_update_skip_locked(self) -> bool: ... # type: ignore[override] @property - def has_select_for_update_nowait(self) -> bool: ... # type: ignore + def has_select_for_update_nowait(self) -> bool: ... # type: ignore[override] @property - def has_select_for_update_of(self) -> bool: ... # type: ignore + def has_select_for_update_of(self) -> bool: ... # type: ignore[override] @property def supports_explain_analyze(self) -> bool: ... @property - def supported_explain_formats(self) -> set[str]: ... # type: ignore + def supported_explain_formats(self) -> set[str]: ... # type: ignore[override] @property def supports_transactions(self) -> bool: ... @property - def ignores_table_name_case(self) -> bool: ... # type: ignore + def ignores_table_name_case(self) -> bool: ... # type: ignore[override] @property - def supports_default_in_lead_lag(self) -> bool: ... # type: ignore + def supports_default_in_lead_lag(self) -> bool: ... # type: ignore[override] @property - def supports_json_field(self) -> bool: ... # type: ignore + def supports_json_field(self) -> bool: ... # type: ignore[override] @property - def can_introspect_json_field(self) -> bool: ... # type: ignore + def can_introspect_json_field(self) -> bool: ... # type: ignore[override] @property - def supports_index_column_ordering(self) -> bool: ... # type: ignore + def supports_index_column_ordering(self) -> bool: ... # type: ignore[override] @property - def supports_expression_indexes(self) -> bool: ... # type: ignore + def supports_expression_indexes(self) -> bool: ... # type: ignore[override] diff --git a/django-stubs/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi index 901313726..ad6e540c2 100644 --- a/django-stubs/db/backends/utils.pyi +++ b/django-stubs/db/backends/utils.pyi @@ -69,15 +69,15 @@ class CursorDebugWrapper(CursorWrapper): ) -> Generator[None, None, None]: ... @overload -def typecast_date(s: None | Literal[""]) -> None: ... # type: ignore +def typecast_date(s: None | Literal[""]) -> None: ... # type: ignore[misc] @overload def typecast_date(s: str) -> datetime.date: ... @overload -def typecast_time(s: None | Literal[""]) -> None: ... # type: ignore +def typecast_time(s: None | Literal[""]) -> None: ... # type: ignore[misc] @overload def typecast_time(s: str) -> datetime.time: ... @overload -def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore +def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore[misc] @overload def typecast_timestamp(s: str) -> datetime.datetime: ... def split_identifier(identifier: str) -> tuple[str, str]: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 3e25c2d45..5ec58d44a 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -420,9 +420,9 @@ class BooleanField(Field[_ST, _GT]): _pyi_lookup_exact_type: bool class NullBooleanField(BooleanField[_ST, _GT]): - _pyi_private_set_type: bool | Combinable | None # type: ignore - _pyi_private_get_type: bool | None # type: ignore - _pyi_lookup_exact_type: bool | None # type: ignore + _pyi_private_set_type: bool | Combinable | None # type: ignore[assignment] + _pyi_private_get_type: bool | None # type: ignore[assignment] + _pyi_lookup_exact_type: bool | None # type: ignore[assignment] class IPAddressField(Field[_ST, _GT]): _pyi_private_set_type: str | Combinable diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 6c78b5d32..f8fde239c 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -43,7 +43,7 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): rel_class: type[ForeignObjectRel] swappable: bool @property - def related_model(self) -> type[Model] | Literal["self"]: ... # type: ignore + def related_model(self) -> type[Model] | Literal["self"]: ... # type: ignore[override] def get_forward_related_filter(self, obj: Model) -> dict[str, int | UUID]: ... def get_reverse_related_filter(self, obj: Model) -> Q: ... @property diff --git a/django-stubs/db/models/fields/reverse_related.pyi b/django-stubs/db/models/fields/reverse_related.pyi index 4b96e7257..21bfeb85f 100644 --- a/django-stubs/db/models/fields/reverse_related.pyi +++ b/django-stubs/db/models/fields/reverse_related.pyi @@ -112,7 +112,7 @@ class OneToOneRel(ManyToOneRel): ) -> None: ... class ManyToManyRel(ForeignObjectRel): - field: ManyToManyField # type: ignore + field: ManyToManyField # type: ignore[assignment] through: type[Model] | None through_fields: tuple[str, str] | None db_constraint: bool diff --git a/django-stubs/db/models/signals.pyi b/django-stubs/db/models/signals.pyi index d856c00e2..3bb497477 100644 --- a/django-stubs/db/models/signals.pyi +++ b/django-stubs/db/models/signals.pyi @@ -7,7 +7,7 @@ from django.dispatch import Signal class_prepared: Signal class ModelSignal(Signal): - def connect( # type: ignore + def connect( # type: ignore[override] self, receiver: Callable, sender: type[Model] | str | None = ..., @@ -15,7 +15,7 @@ class ModelSignal(Signal): dispatch_uid: str | None = ..., apps: Apps | None = ..., ) -> None: ... - def disconnect( # type: ignore + def disconnect( # type: ignore[override] self, receiver: Callable | None = ..., sender: type[Model] | str | None = ..., diff --git a/django-stubs/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi index 11a20fc47..dc545ada1 100644 --- a/django-stubs/db/models/sql/compiler.pyi +++ b/django-stubs/db/models/sql/compiler.pyi @@ -96,7 +96,7 @@ class SQLCompiler: ) -> Iterator[Sequence[Any]]: ... def has_results(self) -> bool: ... @overload - def execute_sql( # type: ignore + def execute_sql( # type: ignore[misc] self, result_type: Literal["cursor"] = ..., chunked_fetch: bool = ..., chunk_size: int = ... ) -> CursorWrapper: ... @overload @@ -104,7 +104,7 @@ class SQLCompiler: self, result_type: Literal["no results"] | None = ..., chunked_fetch: bool = ..., chunk_size: int = ... ) -> None: ... @overload - def execute_sql( # type: ignore + def execute_sql( # type: ignore[misc] self, result_type: Literal["single"] = ..., chunked_fetch: bool = ..., chunk_size: int = ... ) -> Iterable[Sequence[Any]] | None: ... @overload @@ -122,8 +122,8 @@ class SQLInsertCompiler(SQLCompiler): def prepare_value(self, field: Any, value: Any) -> Any: ... def pre_save_val(self, field: Any, obj: Any) -> Any: ... 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 - def execute_sql( # type: ignore + def as_sql(self) -> list[_AsSqlType]: ... # type: ignore[override] + def execute_sql( # type: ignore[override] self, returning_fields: Sequence[str] | None = ... ) -> list[tuple[Any]]: ... # 1-tuple @@ -133,18 +133,18 @@ class SQLDeleteCompiler(SQLCompiler): def single_alias(self) -> bool: ... @property def contains_self_reference_subquery(self) -> bool: ... - def as_sql(self) -> _AsSqlType: ... # type: ignore + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] class SQLUpdateCompiler(SQLCompiler): query: UpdateQuery - def as_sql(self) -> _AsSqlType: ... # type: ignore - def execute_sql(self, result_type: Literal["cursor", "no results"]) -> int: ... # type: ignore - def pre_sql_setup(self) -> None: ... # type: ignore + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] + def execute_sql(self, result_type: Literal["cursor", "no results"]) -> int: ... # type: ignore[override] + def pre_sql_setup(self) -> None: ... # type: ignore[override] class SQLAggregateCompiler(SQLCompiler): query: AggregateQuery col_count: int - def as_sql(self) -> _AsSqlType: ... # type: ignore + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] def cursor_iter( cursor: CursorWrapper, sentinel: Any, col_count: int | None, itersize: int diff --git a/django-stubs/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi index fe21ebaf8..a00c63743 100644 --- a/django-stubs/db/models/sql/query.pyi +++ b/django-stubs/db/models/sql/query.pyi @@ -109,7 +109,7 @@ class Query(BaseExpression): def bump_prefix(self, outer_query: Query) -> None: ... def get_initial_alias(self) -> str: ... def count_active_tables(self) -> int: ... - def resolve_expression(self, query: Query, *args: Any, **kwargs: Any) -> Query: ... # type: ignore + def resolve_expression(self, query: Query, *args: Any, **kwargs: Any) -> Query: ... # type: ignore[override] def resolve_lookup_value(self, value: Any, can_reuse: set[str] | None, allow_joins: bool) -> Any: ... def solve_lookup_type(self, lookup: str) -> tuple[Sequence[str], Sequence[str], Expression | Literal[False]]: ... def build_filter( diff --git a/django-stubs/forms/fields.pyi b/django-stubs/forms/fields.pyi index c3d3117cf..4c1eb066a 100644 --- a/django-stubs/forms/fields.pyi +++ b/django-stubs/forms/fields.pyi @@ -144,7 +144,7 @@ class FloatField(IntegerField): disabled: bool = ..., label_suffix: str | None = ..., ) -> None: ... - def to_python(self, value: Any | None) -> float | None: ... # type: ignore + def to_python(self, value: Any | None) -> float | None: ... # type: ignore[override] def validate(self, value: float) -> None: ... def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... @@ -171,7 +171,7 @@ class DecimalField(IntegerField): disabled: bool = ..., label_suffix: str | None = ..., ) -> None: ... - def to_python(self, value: Any | None) -> Decimal | None: ... # type: ignore + def to_python(self, value: Any | None) -> Decimal | None: ... # type: ignore[override] def validate(self, value: Decimal) -> None: ... def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... @@ -316,7 +316,7 @@ class BooleanField(Field): def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... class NullBooleanField(BooleanField): - def to_python(self, value: Any | None) -> bool | None: ... # type: ignore + def to_python(self, value: Any | None) -> bool | None: ... # type: ignore[override] def validate(self, value: Any) -> None: ... class CallableChoiceIterator: @@ -549,7 +549,7 @@ class SlugField(CharField): class UUIDField(CharField): def prepare_value(self, value: Any | None) -> Any | None: ... - def to_python(self, value: Any) -> UUID | None: ... # type: ignore + def to_python(self, value: Any) -> UUID | None: ... # type: ignore[override] class InvalidJSONInput(str): ... class JSONString(str): ... diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi index b93303066..4b4aa287b 100644 --- a/django-stubs/forms/models.pyi +++ b/django-stubs/forms/models.pyi @@ -308,11 +308,11 @@ class ModelMultipleChoiceField(ModelChoiceField): def to_python(self, value: Any) -> list[Model]: ... # type: ignore[override] def clean(self, value: Any) -> QuerySet[Model]: ... def prepare_value(self, value: Any) -> Any: ... - def has_changed(self, initial: Collection[Any] | None, data: Collection[Any] | None) -> bool: ... # type: ignore + def has_changed(self, initial: Collection[Any] | None, data: Collection[Any] | None) -> bool: ... # type: ignore[override] def modelform_defines_fields(form_class: type[ModelForm]) -> bool: ... @overload -def _get_foreign_key( # type: ignore +def _get_foreign_key( # type: ignore[misc] parent_model: type[Model], model: type[Model], fk_name: str | None = ..., can_fail: Literal[True] = ... ) -> ForeignKey | None: ... @overload diff --git a/django-stubs/forms/widgets.pyi b/django-stubs/forms/widgets.pyi index 158574c7a..5ca9f9558 100644 --- a/django-stubs/forms/widgets.pyi +++ b/django-stubs/forms/widgets.pyi @@ -175,7 +175,7 @@ class ChoiceWidget(Widget): ) -> dict[str, Any]: ... def id_for_label(self, id_: str, index: str = ...) -> str: ... def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... - def format_value(self, value: Any) -> list[str]: ... # type: ignore + def format_value(self, value: Any) -> list[str]: ... # type: ignore[override] class Select(ChoiceWidget): input_type: str | None @@ -189,7 +189,7 @@ class Select(ChoiceWidget): class NullBooleanSelect(Select): def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... - def format_value(self, value: Any) -> str: ... # type: ignore + def format_value(self, value: Any) -> str: ... # type: ignore[override] def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> bool | None: ... class SelectMultiple(Select): @@ -228,7 +228,7 @@ class MultiWidget(Widget): def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... def decompress(self, value: Any) -> Any | None: ... @property - def needs_multipart_form(self) -> bool: ... # type: ignore + def needs_multipart_form(self) -> bool: ... # type: ignore[override] class SplitDateTimeWidget(MultiWidget): supports_microseconds: bool @@ -277,7 +277,7 @@ class SelectDateWidget(Widget): empty_label: str | _ListOrTuple[str] | 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 + def format_value(self, value: Any) -> dict[str, str | int | None]: ... # type: ignore[override] def id_for_label(self, id_: str) -> str: ... def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> str | None | Any: ... def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... diff --git a/django-stubs/http/request.pyi b/django-stubs/http/request.pyi index b5ebf8b48..9ed40d99e 100644 --- a/django-stubs/http/request.pyi +++ b/django-stubs/http/request.pyi @@ -131,7 +131,7 @@ class QueryDict(MultiValueDict[str, str]): encoding: str | None = ..., ) -> None: ... @classmethod - def fromkeys( # type: ignore + def fromkeys( # type: ignore[override] cls, iterable: Iterable[bytes | str], value: str | bytes = ..., diff --git a/django-stubs/test/client.pyi b/django-stubs/test/client.pyi index 43a4a1e97..68a4437cb 100644 --- a/django-stubs/test/client.pyi +++ b/django-stubs/test/client.pyi @@ -198,7 +198,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): **defaults: Any, ) -> None: ... def request(self, **request: Any) -> _MonkeyPatchedWSGIResponse: ... - def get( # type: ignore + def get( # type: ignore[override] self, path: str, data: _GetDataType = ..., @@ -208,7 +208,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): headers: Mapping[str, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... - def post( # type: ignore + def post( # type: ignore[override] self, path: str, data: Any = ..., @@ -219,7 +219,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): headers: Mapping[str, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... - def head( # type: ignore + def head( # type: ignore[override] self, path: str, data: Any = ..., @@ -229,7 +229,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): headers: Mapping[str, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... - def trace( # type: ignore + def trace( # type: ignore[override] self, path: str, data: Any = ..., @@ -239,7 +239,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): headers: Mapping[str, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... - def put( # type: ignore + def put( # type: ignore[override] self, path: str, data: Any = ..., @@ -250,7 +250,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): headers: Mapping[str, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... - def patch( # type: ignore + def patch( # type: ignore[override] self, path: str, data: Any = ..., @@ -261,7 +261,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): headers: Mapping[str, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... - def delete( # type: ignore + def delete( # type: ignore[override] self, path: str, data: Any = ..., diff --git a/django-stubs/test/testcases.pyi b/django-stubs/test/testcases.pyi index 19ab3fd05..7ddd712c8 100644 --- a/django-stubs/test/testcases.pyi +++ b/django-stubs/test/testcases.pyi @@ -223,7 +223,7 @@ class TransactionTestCase(SimpleTestCase): msg: str | None = ..., ) -> None: ... @overload - def assertNumQueries(self, num: int, using: str = ...) -> _AssertNumQueriesContext: ... # type: ignore + def assertNumQueries(self, num: int, using: str = ...) -> _AssertNumQueriesContext: ... # type: ignore[misc] @overload def assertNumQueries( self, num: int, func: Callable[..., Any], *args: Any, using: str = ..., **kwargs: Any diff --git a/django-stubs/utils/datastructures.pyi b/django-stubs/utils/datastructures.pyi index 9de26f2f9..ffbc93cf6 100644 --- a/django-stubs/utils/datastructures.pyi +++ b/django-stubs/utils/datastructures.pyi @@ -72,11 +72,11 @@ class MultiValueDict(dict[_K, _V]): def setdefault(self, key: _K, default: _V) -> _V: ... def setlistdefault(self, key: _K, default_list: list[_V] | None = ...) -> list[_V]: ... def appendlist(self, key: _K, value: _V) -> None: ... - def items(self) -> Iterator[tuple[_K, _V | list[object]]]: ... # type: ignore + def items(self) -> Iterator[tuple[_K, _V | list[object]]]: ... # type: ignore[override] def lists(self) -> Iterable[tuple[_K, list[_V]]]: ... def dict(self) -> dict[_K, _V | list[object]]: ... def copy(self) -> Self: ... - def __getitem__(self, key: _K) -> _V | list[object]: ... # type: ignore + def __getitem__(self, key: _K) -> _V | list[object]: ... # type: ignore[override] def __setitem__(self, key: _K, value: _V) -> None: ... # These overrides are needed to convince mypy that this isn't an abstract class def __delitem__(self, item: _K) -> None: ... diff --git a/django-stubs/utils/dateformat.pyi b/django-stubs/utils/dateformat.pyi index e9f2ffaae..7846a104e 100644 --- a/django-stubs/utils/dateformat.pyi +++ b/django-stubs/utils/dateformat.pyi @@ -33,7 +33,7 @@ class TimeFormat(Formatter): def Z(self) -> int | Literal[""]: ... class DateFormat(TimeFormat): - data: builtin_datetime | date | builtin_time # type: ignore + data: builtin_datetime | date | builtin_time # type: ignore[assignment] timezone: _TzInfoT | None year_days: Any def __init__(self, obj: builtin_datetime | builtin_time | date) -> None: ... diff --git a/django-stubs/utils/datetime_safe.pyi b/django-stubs/utils/datetime_safe.pyi index 34f4a0712..cd07aa5d5 100644 --- a/django-stubs/utils/datetime_safe.pyi +++ b/django-stubs/utils/datetime_safe.pyi @@ -8,7 +8,7 @@ class date(real_date): class datetime(real_datetime): def strftime(self, fmt: str) -> str: ... @classmethod - def combine(cls, date: real_date, time: real_time) -> datetime: ... # type: ignore + def combine(cls, date: real_date, time: real_time) -> datetime: ... # type: ignore[override] def new_date(d: real_date) -> date: ... def new_datetime(d: real_date | real_datetime) -> datetime: ... diff --git a/django-stubs/utils/encoding.pyi b/django-stubs/utils/encoding.pyi index 282bdaf1a..97b73128e 100644 --- a/django-stubs/utils/encoding.pyi +++ b/django-stubs/utils/encoding.pyi @@ -60,7 +60,7 @@ def iri_to_uri(iri: None) -> None: ... @overload def iri_to_uri(iri: str | Promise) -> str: ... @overload -def uri_to_iri(uri: None) -> None: ... # type: ignore +def uri_to_iri(uri: None) -> None: ... # type: ignore[misc] @overload def uri_to_iri(uri: Any) -> str: ... def escape_uri_path(path: str) -> str: ... diff --git a/django-stubs/utils/formats.pyi b/django-stubs/utils/formats.pyi index 83927cfc8..a96f21193 100644 --- a/django-stubs/utils/formats.pyi +++ b/django-stubs/utils/formats.pyi @@ -30,13 +30,13 @@ _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( # type: ignore +def localize( # type: ignore[misc] value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = ... ) -> str: ... @overload def localize(value: _T, use_l10n: bool | None = ...) -> _T: ... @overload -def localize_input( # type: ignore +def localize_input( # type: ignore[misc] value: builtin_datetime | date | time | Decimal | float | str, default: str | None = ... ) -> str: ... @overload diff --git a/django-stubs/utils/text.pyi b/django-stubs/utils/text.pyi index 7ba5c536b..027420fe6 100644 --- a/django-stubs/utils/text.pyi +++ b/django-stubs/utils/text.pyi @@ -35,7 +35,7 @@ def compress_string(s: bytes, *, max_random_bytes: int | None = ...) -> bytes: . class StreamingBuffer(BytesIO): vals: list[bytes] - def read(self) -> bytes: ... # type: ignore + def read(self) -> bytes: ... # type: ignore[override] def compress_sequence(sequence: Iterable[bytes], *, max_random_bytes: int | None = ...) -> Iterator[bytes]: ... diff --git a/ext/tests/test_monkeypatching.py b/ext/tests/test_monkeypatching.py index 6c1d264dc..dce02c985 100644 --- a/ext/tests/test_monkeypatching.py +++ b/ext/tests/test_monkeypatching.py @@ -84,7 +84,7 @@ class _NotGeneric: for cls in extra_classes: assert cls[type] is cls # type: ignore[misc] - class _TestGeneric(_NotGeneric[Model]): # type: ignore + class _TestGeneric(_NotGeneric[Model]): # type: ignore[type-arg] pass diff --git a/pyproject.toml b/pyproject.toml index 22a66c4e5..305c8d865 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ select = [ "F401", # Unused imports "UP", # pyupgrade "TID251", # Disallowed imports (flake8-tidy-imports.banned-api) + "PGH003", # Disallowed blanket `type: ignore` annotations. ] [tool.ruff.flake8-tidy-imports.banned-api]