Skip to content
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

Resolve flake8 errors #503

Merged
merged 1 commit into from
May 6, 2024
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
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
extend-ignore =
# break before binary operators
W503,
# line length
E501
1 change: 0 additions & 1 deletion waffle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import TYPE_CHECKING

import django
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest

Expand Down
4 changes: 2 additions & 2 deletions waffle/management/commands/waffle_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def handle(self, *args: Any, **options: Any) -> None:
for username in options['user']:
try:
user_instance = UserModel.objects.get(
Q(**{UserModel.USERNAME_FIELD: username}) |
Q(**{UserModel.EMAIL_FIELD: username})
Q(**{UserModel.USERNAME_FIELD: username})
| Q(**{UserModel.EMAIL_FIELD: username})
)
user_hash.add(user_instance)
except UserModel.DoesNotExist:
Expand Down
2 changes: 1 addition & 1 deletion waffle/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


if TYPE_CHECKING:
from waffle.models import _BaseModelType, AbstractBaseFlag, AbstractBaseSample, AbstractBaseSwitch
from waffle.models import _BaseModelType, AbstractBaseFlag, AbstractBaseSample, AbstractBaseSwitch # noqa: F401
else:
_BaseModelType = TypeVar("_BaseModelType")

Expand Down
4 changes: 2 additions & 2 deletions waffle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def _is_active_for_user(self, request: HttpRequest) -> bool | None:
def _is_active_for_language(self, request: HttpRequest) -> bool | None:
if self.languages:
languages = [ln.strip() for ln in self.languages.split(',')]
if (hasattr(request, 'LANGUAGE_CODE') and
request.LANGUAGE_CODE in languages):
if (hasattr(request, 'LANGUAGE_CODE')
and request.LANGUAGE_CODE in languages):
return True
return None

Expand Down
2 changes: 1 addition & 1 deletion waffle/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def test_flag_is_not_active_for_none_requests(self):
def test_is_active_for_user_when_everyone_is_active(self):
flag = get_waffle_flag_model().objects.create(name='test-flag')
flag.everyone = True
self.assertEqual(flag.is_active_for_user(User()), True)
self.assertEqual(flag.is_active_for_user(User()), True)
1 change: 0 additions & 1 deletion waffle/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
get_waffle_sample_model,
get_waffle_switch_model,
)
from waffle.models import Switch, Sample


__all__ = ['override_flag', 'override_sample', 'override_switch']
Expand Down
Loading