Skip to content

Commit 0f8579f

Browse files
authored
Run pre-commit isort on pyi files (#347)
Pre-commit isort was ignoring .pyi files, this fixes that.
1 parent 3a339b0 commit 0f8579f

13 files changed

+19
-20
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ repos:
1515
hooks:
1616
- id: pyupgrade
1717
args: ["--py36-plus"]
18-
- repo: https://github.com/pre-commit/mirrors-isort
19-
rev: v5.10.1
18+
- repo: https://github.com/pycqa/isort
19+
rev: 5.12.0
2020
hooks:
2121
- id: isort
22+
name: isort (python)
23+
- id: isort
24+
name: isort (pyi)
25+
types: [pyi]
2226
- repo: https://github.com/psf/black
2327
rev: 23.1.0
2428
hooks:

rest_framework-stubs/exceptions.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from collections.abc import Sequence
22
from typing import Any
33

4-
from typing_extensions import TypeAlias
5-
64
from django.http import HttpRequest, JsonResponse
75
from django_stubs_ext import StrOrPromise
86
from rest_framework.renderers import BaseRenderer
97
from rest_framework.request import Request
8+
from typing_extensions import TypeAlias
109

1110
def _get_error_details(data: Any, default_code: str | None = ...) -> Any: ...
1211
def _get_codes(detail: Any) -> Any: ...

rest_framework-stubs/generics.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from typing import Any, Protocol, TypeVar
33

44
from django.db.models import Manager, Model
55
from django.db.models.query import QuerySet
6-
76
from rest_framework import mixins, views
87
from rest_framework.filters import BaseFilterBackend
98
from rest_framework.pagination import BasePagination

rest_framework-stubs/mixins.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Any, TypeVar
22

33
from django.db.models import Model
4-
54
from rest_framework.generics import UsesQuerySet
65
from rest_framework.request import Request
76
from rest_framework.response import Response

rest_framework-stubs/permissions.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from collections.abc import Sequence
22
from typing import Any, Protocol, Union # noqa: Y037 # https://github.com/python/mypy/issues/12392
3-
from typing_extensions import TypeAlias
43

54
from django.db.models import Model, QuerySet
65
from rest_framework.request import Request
76
from rest_framework.views import APIView
7+
from typing_extensions import TypeAlias
88

99
SAFE_METHODS: Sequence[str]
1010

rest_framework-stubs/relations.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from collections import OrderedDict
22
from collections.abc import Callable, Iterable, Mapping, Sequence
33
from typing import Any, Generic, TypeVar
4-
from _typeshed import Self
54

5+
from _typeshed import Self
66
from django.db.models import Manager, Model, QuerySet
77
from rest_framework.fields import Field, Option
88
from rest_framework.request import Request

rest_framework-stubs/renderers.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from json import JSONEncoder
21
from collections.abc import Iterable, Mapping, Sequence
2+
from json import JSONEncoder
33
from typing import Any
44

55
from django import forms

rest_framework-stubs/request.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from contextlib import contextmanager
2-
from types import TracebackType
31
from collections.abc import Iterator, Sequence
4-
from contextlib import AbstractContextManager
2+
from contextlib import AbstractContextManager, contextmanager
3+
from types import TracebackType
54
from typing import Any
65

76
from django.contrib.auth.base_user import AbstractBaseUser

rest_framework-stubs/response.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ from collections.abc import Mapping
22
from typing import Any
33

44
from django.template.base import Template
5-
from django.test.utils import ContextList
65
from django.template.response import SimpleTemplateResponse
6+
from django.test.utils import ContextList
77
from django.urls import ResolverMatch
8-
98
from rest_framework.request import Request
109
from rest_framework.test import APIClient
1110

rest_framework-stubs/schemas/generators.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from types import ModuleType
21
from collections.abc import Iterable, Sequence
2+
from types import ModuleType
33
from typing import Any
4-
from typing_extensions import TypeAlias
54

65
from django.db.models.base import Model
76
from rest_framework.compat import coreapi
87
from rest_framework.request import Request
98
from rest_framework.urlpatterns import _AnyURL
109
from rest_framework.views import APIView
10+
from typing_extensions import TypeAlias
1111

1212
def common_path(paths: Iterable[str]) -> str: ...
1313
def get_pk_name(model: type[Model]) -> str: ...

rest_framework-stubs/urlpatterns.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections.abc import Iterable, Sequence
2-
from typing_extensions import TypeAlias
32

43
from django.urls.resolvers import URLPattern, URLResolver
4+
from typing_extensions import TypeAlias
55

66
_AnyURL: TypeAlias = URLPattern | URLResolver
77

rest_framework-stubs/validators.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from collections.abc import Callable, Container, Iterable, MutableMapping
2-
from typing import Any, TypeVar, Protocol
3-
from typing_extensions import TypeAlias
2+
from typing import Any, Protocol, TypeVar
43

54
from django.db.models import Model, QuerySet
65
from rest_framework.fields import Field
76
from rest_framework.serializers import BaseSerializer
7+
from typing_extensions import TypeAlias
88

99
_T = TypeVar("_T", bound=Model)
1010
_V = TypeVar("_V", contravariant=True)

rest_framework-stubs/viewsets.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from collections import OrderedDict
22
from collections.abc import Callable
33
from typing import Any
4-
from typing_extensions import TypeAlias
54

65
from django.http.request import HttpRequest
76
from django.http.response import HttpResponseBase
@@ -10,6 +9,7 @@ from rest_framework.decorators import ViewSetAction
109
from rest_framework.generics import _MT_co
1110
from rest_framework.request import Request
1211
from rest_framework.views import AsView, GenericView
12+
from typing_extensions import TypeAlias
1313

1414
def _is_extra_action(attr: Any) -> bool: ...
1515

0 commit comments

Comments
 (0)