Skip to content

Commit 54cb1bb

Browse files
committed
linting and ci fixes
1 parent ea552cd commit 54cb1bb

File tree

9 files changed

+87
-39
lines changed

9 files changed

+87
-39
lines changed

.github/workflows/validate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
- name: Security
3535
run: make bandit
3636
- name: Testing
37-
run: make tests
37+
run: make test

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
lint:
2-
poetry run black .
3-
poetry run isort .
4-
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,**/migrations/*,**/south_migrations/*,tests/ --statistics --count
2+
poetry run black --check .
3+
poetry run isort --check-only .
4+
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,tests/ --statistics --count
55

66
bandit:
77
poetry run bandit -c pyproject.toml -r .

pyproject.toml

+19-16
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ license = "MIT"
88
readme = "README.md"
99
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
1010
classifiers=[
11-
# How mature is this project? Common values are
12-
# 3 - Alpha
13-
# 4 - Beta
14-
# 5 - Production/Stable
15-
'Development Status :: 5 - Production/Stable',
11+
# How mature is this project? Common values are
12+
# 3 - Alpha
13+
# 4 - Beta
14+
# 5 - Production/Stable
15+
'Development Status :: 5 - Production/Stable',
1616

17-
# Indicate who your project is intended for
18-
'Intended Audience :: Developers',
19-
'Topic :: Software Development :: Libraries :: Python Modules',
17+
# Indicate who your project is intended for
18+
'Intended Audience :: Developers',
19+
'Topic :: Software Development :: Libraries :: Python Modules',
2020

21-
# Pick your license as you wish (should match "license" above)
22-
'License :: OSI Approved :: MIT',
21+
# Pick your license as you wish (should match "license" above)
22+
'License :: OSI Approved :: MIT',
2323

24-
# Supported Languages
25-
'Natural Language :: English',
26-
'Operating System :: OS Independent',
27-
'Programming Language :: Python :: 3',
28-
'Programming Language :: Python :: 3.12',
29-
'Framework :: Django',
24+
# Supported Languages
25+
'Natural Language :: English',
26+
'Operating System :: OS Independent',
27+
'Programming Language :: Python :: 3',
28+
'Programming Language :: Python :: 3.12',
29+
'Framework :: Django',
3030
]
3131
packages = [
3232
{ include = "rest_framework_filters" },
@@ -62,6 +62,9 @@ django-upgrade = "1.18.0"
6262
requires = ["poetry-core"]
6363
build-backend = "poetry.core.masonry.api"
6464

65+
[tool.isort]
66+
profile = "black"
67+
6568
[tool.bandit]
6669
exclude_dirs = [
6770
'./tests/',

rest_framework_filters/filters.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
from django.utils.module_loading import import_string
44
from django_filters.rest_framework.filters import * # noqa
5-
from django_filters.rest_framework.filters import (ModelChoiceFilter,
6-
ModelMultipleChoiceFilter)
5+
from django_filters.rest_framework.filters import (
6+
ModelChoiceFilter,
7+
ModelMultipleChoiceFilter,
8+
)
79

810
ALL_LOOKUPS = "__all__"
911

tests/related/data.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def setUpTestData(cls):
3737
cls.postD(b)
3838

3939
b = Blog.objects.create(pk=5, name="Blog AB")
40-
cls.postA(b), cls.postB(b)
40+
cls.postA(b)
41+
cls.postB(b)
4142

4243
b = Blog.objects.create(pk=6, name="Blog AC")
4344
cls.postA(b), cls.postC(b)

tests/test_complex_ops.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
from django.test import TestCase
77
from rest_framework.serializers import ValidationError
88

9-
from rest_framework_filters.complex_ops import (ComplexOp,
10-
combine_complex_queryset,
11-
decode_complex_ops)
9+
from rest_framework_filters.complex_ops import (
10+
ComplexOp,
11+
combine_complex_queryset,
12+
decode_complex_ops,
13+
)
1214
from tests.testapp import models
1315

1416

tests/test_filtering.py

+27-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,33 @@
33

44
from rest_framework_filters import FilterSet, filters
55

6-
from .testapp.filters import (AccountFilter, CFilter, CoverFilter,
7-
CustomerFilter, NoteFilter, NoteFilterWithAlias,
8-
NoteFilterWithRelatedAlias, PageFilter,
9-
PersonFilter, PostFilter, UserFilter)
10-
from .testapp.models import (A, Account, B, C, Cover, Customer, Note, Page,
11-
Person, Post, Tag, User)
6+
from .testapp.filters import (
7+
AccountFilter,
8+
CFilter,
9+
CoverFilter,
10+
CustomerFilter,
11+
NoteFilter,
12+
NoteFilterWithAlias,
13+
NoteFilterWithRelatedAlias,
14+
PageFilter,
15+
PersonFilter,
16+
PostFilter,
17+
UserFilter,
18+
)
19+
from .testapp.models import (
20+
A,
21+
Account,
22+
B,
23+
C,
24+
Cover,
25+
Customer,
26+
Note,
27+
Page,
28+
Person,
29+
Post,
30+
Tag,
31+
User,
32+
)
1233

1334

1435
class LocalTagFilter(FilterSet):

tests/test_filterset.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99
from rest_framework.views import APIView
1010

1111
from rest_framework_filters import FilterSet, filters
12-
from rest_framework_filters.filterset import (FilterSetMetaclass,
13-
SubsetDisabledMixin)
14-
15-
from .testapp.filters import (AFilter, NoteFilter, NoteFilterWithAlias,
16-
PersonFilter, PostFilter, TagFilter, UserFilter)
12+
from rest_framework_filters.filterset import FilterSetMetaclass, SubsetDisabledMixin
13+
14+
from .testapp.filters import (
15+
AFilter,
16+
NoteFilter,
17+
NoteFilterWithAlias,
18+
PersonFilter,
19+
PostFilter,
20+
TagFilter,
21+
UserFilter,
22+
)
1723
from .testapp.models import Note, Person, Post, Tag, User
1824

1925
factory = APIRequestFactory()

tests/testapp/filters.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@
44
from rest_framework_filters.filters import AutoFilter, RelatedFilter
55
from rest_framework_filters.filterset import FilterSet
66

7-
from .models import (A, Account, B, Blog, C, Cover, Customer, Note, Page,
8-
Person, Post, Tag, User)
7+
from .models import (
8+
A,
9+
Account,
10+
B,
11+
Blog,
12+
C,
13+
Cover,
14+
Customer,
15+
Note,
16+
Page,
17+
Person,
18+
Post,
19+
Tag,
20+
User,
21+
)
922

1023

1124
class DFUserFilter(django_filters.FilterSet):

0 commit comments

Comments
 (0)