Skip to content

Commit

Permalink
linting and ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SunnyR committed Jul 23, 2024
1 parent ea552cd commit 8ecaa55
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: Security
run: make bandit
- name: Testing
run: make tests
run: make test
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lint:
poetry run black .
poetry run isort .
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,**/migrations/*,**/south_migrations/*,tests/ --statistics --count
poetry run black --check .
poetry run isort --check-only .
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/ --statistics --count

bandit:
poetry run bandit -c pyproject.toml -r .
Expand Down
35 changes: 19 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ license = "MIT"
readme = "README.md"
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 5 - Production/Stable',
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 5 - Production/Stable',

# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',

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

# Supported Languages
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.12',
'Framework :: Django',
# Supported Languages
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.12',
'Framework :: Django',
]
packages = [
{ include = "rest_framework_filters" },
Expand Down Expand Up @@ -62,6 +62,9 @@ django-upgrade = "1.18.0"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
profile = "black"

[tool.bandit]
exclude_dirs = [
'./tests/',
Expand Down
6 changes: 4 additions & 2 deletions rest_framework_filters/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from django.utils.module_loading import import_string
from django_filters.rest_framework.filters import * # noqa
from django_filters.rest_framework.filters import (ModelChoiceFilter,
ModelMultipleChoiceFilter)
from django_filters.rest_framework.filters import (
ModelChoiceFilter,
ModelMultipleChoiceFilter,
)

ALL_LOOKUPS = "__all__"

Expand Down
8 changes: 5 additions & 3 deletions tests/test_complex_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from django.test import TestCase
from rest_framework.serializers import ValidationError

from rest_framework_filters.complex_ops import (ComplexOp,
combine_complex_queryset,
decode_complex_ops)
from rest_framework_filters.complex_ops import (
ComplexOp,
combine_complex_queryset,
decode_complex_ops,
)
from tests.testapp import models


Expand Down
33 changes: 27 additions & 6 deletions tests/test_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,33 @@

from rest_framework_filters import FilterSet, filters

from .testapp.filters import (AccountFilter, CFilter, CoverFilter,
CustomerFilter, NoteFilter, NoteFilterWithAlias,
NoteFilterWithRelatedAlias, PageFilter,
PersonFilter, PostFilter, UserFilter)
from .testapp.models import (A, Account, B, C, Cover, Customer, Note, Page,
Person, Post, Tag, User)
from .testapp.filters import (
AccountFilter,
CFilter,
CoverFilter,
CustomerFilter,
NoteFilter,
NoteFilterWithAlias,
NoteFilterWithRelatedAlias,
PageFilter,
PersonFilter,
PostFilter,
UserFilter,
)
from .testapp.models import (
A,
Account,
B,
C,
Cover,
Customer,
Note,
Page,
Person,
Post,
Tag,
User,
)


class LocalTagFilter(FilterSet):
Expand Down
16 changes: 11 additions & 5 deletions tests/test_filterset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
from rest_framework.views import APIView

from rest_framework_filters import FilterSet, filters
from rest_framework_filters.filterset import (FilterSetMetaclass,
SubsetDisabledMixin)

from .testapp.filters import (AFilter, NoteFilter, NoteFilterWithAlias,
PersonFilter, PostFilter, TagFilter, UserFilter)
from rest_framework_filters.filterset import FilterSetMetaclass, SubsetDisabledMixin

from .testapp.filters import (
AFilter,
NoteFilter,
NoteFilterWithAlias,
PersonFilter,
PostFilter,
TagFilter,
UserFilter,
)
from .testapp.models import Note, Person, Post, Tag, User

factory = APIRequestFactory()
Expand Down
17 changes: 15 additions & 2 deletions tests/testapp/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@
from rest_framework_filters.filters import AutoFilter, RelatedFilter
from rest_framework_filters.filterset import FilterSet

from .models import (A, Account, B, Blog, C, Cover, Customer, Note, Page,
Person, Post, Tag, User)
from .models import (
A,
Account,
B,
Blog,
C,
Cover,
Customer,
Note,
Page,
Person,
Post,
Tag,
User,
)


class DFUserFilter(django_filters.FilterSet):
Expand Down

0 comments on commit 8ecaa55

Please sign in to comment.