diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7900b1434..4eb762395 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: rev: v0.0.269 hooks: - id: ruff - args: ["--fix", "--fixable=I001,F401", "--exit-non-zero-on-fix"] + args: ["--fix", "--fixable=I001,F401,UP", "--exit-non-zero-on-fix"] - repo: https://github.com/psf/black rev: 23.3.0 hooks: diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index ace77d7d5..be50a736b 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -1,12 +1,5 @@ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence -from typing import ( # noqa: Y037 # https://github.com/python/mypy/issues/12211 - Any, - Generic, - Literal, - Optional, - TypeVar, - Union, -) +from typing import Any, Generic, Literal, TypeVar, Union # noqa: Y037 # https://github.com/python/mypy/issues/12211 from django import forms from django.contrib.admin.filters import FieldListFilter, ListFilter @@ -88,7 +81,7 @@ class BaseModelAdmin(Generic[_ModelT]): raw_id_fields: Sequence[str] fields: _FieldGroups | None exclude: Sequence[str] | None - fieldsets: Optional[_FieldsetSpec] # noqa: UP007 + fieldsets: _FieldsetSpec | None form: type[forms.ModelForm[_ModelT]] filter_vertical: Sequence[str] filter_horizontal: Sequence[str] diff --git a/django-stubs/db/migrations/operations/special.pyi b/django-stubs/db/migrations/operations/special.pyi index 2533c3691..f5b26b8e1 100644 --- a/django-stubs/db/migrations/operations/special.pyi +++ b/django-stubs/db/migrations/operations/special.pyi @@ -1,5 +1,5 @@ from collections.abc import Mapping, Sequence -from typing import Any, Literal, Optional, Protocol +from typing import Any, Literal, Protocol from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps @@ -16,18 +16,14 @@ class SeparateDatabaseAndState(Operation): class RunSQL(Operation): noop: Literal[""] - sql: str | _ListOrTuple[str | tuple[str, dict[str, Any] | Optional[_ListOrTuple[str]]]] # noqa: UP007 - reverse_sql: str | None | _ListOrTuple[ - str | tuple[str, dict[str, Any] | Optional[_ListOrTuple[str]]] # noqa: UP007 - ] + sql: str | _ListOrTuple[str | tuple[str, dict[str, Any] | _ListOrTuple[str] | None]] + reverse_sql: str | None | _ListOrTuple[str | tuple[str, dict[str, Any] | _ListOrTuple[str] | None]] state_operations: Sequence[Operation] hints: Mapping[str, Any] def __init__( self, - sql: str | _ListOrTuple[str | tuple[str, dict[str, Any] | Optional[_ListOrTuple[str]]]], # noqa: UP007 - reverse_sql: ( - str | None | _ListOrTuple[str | tuple[str, dict[str, Any] | Optional[_ListOrTuple[str]]]] # noqa: UP007 - ) = ..., + sql: str | _ListOrTuple[str | tuple[str, dict[str, Any] | _ListOrTuple[str] | None]], + reverse_sql: str | None | _ListOrTuple[str | tuple[str, dict[str, Any] | _ListOrTuple[str] | None]] = ..., state_operations: Sequence[Operation] = ..., hints: Mapping[str, Any] | None = ..., elidable: bool = ...,