Skip to content

Enable pyupgrade from ruff #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ repos:
- id: debug-statements
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v3.6.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
hooks:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target-version = "py38"
select = [
"I", # isort
"F401", # Unused imports
"UP", # pyupgrade
]

[tool.ruff.isort]
Expand Down
4 changes: 2 additions & 2 deletions rest_framework-stubs/decorators.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Callable, Mapping, Sequence
from typing import Any, Protocol, TypeVar
from typing import Any, Literal, Protocol, TypeVar

from django.http import HttpRequest
from django.http.response import HttpResponseBase
Expand All @@ -11,7 +11,7 @@ from rest_framework.request import Request
from rest_framework.schemas.inspectors import ViewInspector
from rest_framework.throttling import BaseThrottle
from rest_framework.views import APIView, AsView # noqa: F401
from typing_extensions import Concatenate, Literal, ParamSpec, TypeAlias
from typing_extensions import Concatenate, ParamSpec, TypeAlias

_View = TypeVar("_View", bound=Callable[..., HttpResponseBase])
_P = ParamSpec("_P")
Expand Down
4 changes: 2 additions & 2 deletions rest_framework-stubs/fields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from decimal import Decimal
from enum import Enum
from json import JSONDecoder, JSONEncoder
from re import Pattern
from typing import Any, Generic, NoReturn, Protocol, TypeVar
from typing import Any, Final, Generic, NoReturn, Protocol, TypeVar

from _typeshed import Self
from django.core.files.base import File
Expand All @@ -14,7 +14,7 @@ from django.forms import ImageField as DjangoImageField # noqa: F401
from django_stubs_ext import StrOrPromise
from rest_framework.serializers import BaseSerializer
from rest_framework.validators import Validator
from typing_extensions import Final, TypeAlias
from typing_extensions import TypeAlias

class _Empty(Enum):
sentinel = 0 # noqa: Y015
Expand Down
3 changes: 1 addition & 2 deletions rest_framework-stubs/serializers.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence
from typing import Any, Generic, NoReturn, TypeVar
from typing import Any, Generic, Literal, NoReturn, TypeVar

from _typeshed import Self
from django.db import models
Expand Down Expand Up @@ -63,7 +63,6 @@ from rest_framework.relations import StringRelatedField as StringRelatedField
from rest_framework.utils.model_meta import FieldInfo, RelationInfo
from rest_framework.utils.serializer_helpers import BindingDict, BoundField, ReturnDict, ReturnList
from rest_framework.validators import BaseUniqueForValidator, UniqueTogetherValidator, Validator
from typing_extensions import Literal

LIST_SERIALIZER_KWARGS: Sequence[str]
ALL_FIELDS: str
Expand Down
2 changes: 1 addition & 1 deletion rest_framework-stubs/status.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing_extensions import Literal
from typing import Literal

def is_informational(code: int) -> bool: ...
def is_success(code: int) -> bool: ...
Expand Down