From 19bdb62edf82807bcfa5a2d2f2c1356085d415a2 Mon Sep 17 00:00:00 2001 From: Craig Davies Date: Mon, 6 Jul 2020 15:53:05 -0400 Subject: [PATCH] Fix lint errors due to using isort 5.0 Removed `not_skip` and `recursive` from `tox.ini` to fix TypeError: __init__() got an unexpected keyword argument 'not_skip' * recursive Prior to version 5.0.0, isort wouldn't automatically traverse directories. The --recursive option was necessary to tell it to do so. In 5.0.0 directories are automatically traversed for all Python files, and as such this option is no longer necessary and should simply be removed. * not_skip In an earlier version isort had a default skip of __init__.py. To get around that many projects wanted a way to not skip __init__.py or any other files that were automatically skipped in the future by isort. isort no longer has any default skips, so if the value here is __init__.py you can simply remove the setting. https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/ --- tox.ini | 3 +-- wagtailflags/tests/test_conditions.py | 1 + wagtailflags/tests/test_templatetags_wagtailflags_admin.py | 1 + wagtailflags/tests/urls.py | 3 +-- wagtailflags/views.py | 1 + wagtailflags/wagtail_hooks.py | 5 ++--- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tox.ini b/tox.ini index 2f83703..bdb8290 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,7 @@ deps= commands= black --check wagtailflags setup.py flake8 . - isort --check-only --diff --recursive wagtailflags + isort --check-only --diff wagtailflags [flake8] ignore=E731,W503,W504 @@ -50,7 +50,6 @@ lines_after_imports=2 include_trailing_comma=1 multi_line_output=3 skip=.tox,migrations -not_skip=__init__.py use_parentheses=1 known_django=django known_wagtail=wagtail diff --git a/wagtailflags/tests/test_conditions.py b/wagtailflags/tests/test_conditions.py index 0ddf921..533f4fb 100644 --- a/wagtailflags/tests/test_conditions.py +++ b/wagtailflags/tests/test_conditions.py @@ -3,6 +3,7 @@ from wagtail.core.models import Site from flags.conditions import RequiredForCondition + from wagtailflags.conditions import site_condition diff --git a/wagtailflags/tests/test_templatetags_wagtailflags_admin.py b/wagtailflags/tests/test_templatetags_wagtailflags_admin.py index 419e1e7..92b415f 100644 --- a/wagtailflags/tests/test_templatetags_wagtailflags_admin.py +++ b/wagtailflags/tests/test_templatetags_wagtailflags_admin.py @@ -1,6 +1,7 @@ from django.test import TestCase, override_settings from flags.sources import get_flags + from wagtailflags.templatetags.wagtailflags_admin import disablable, enablable diff --git a/wagtailflags/tests/urls.py b/wagtailflags/tests/urls.py index 7f8e99b..f09fcdc 100644 --- a/wagtailflags/tests/urls.py +++ b/wagtailflags/tests/urls.py @@ -4,8 +4,7 @@ try: # pragma: no cover; >= 2.0 from django.urls import include, re_path except ImportError: # pragma: no cover; fallback for Django < 2.0 - from django.conf.urls import include - from django.conf.urls import url as re_path + from django.conf.urls import include, url as re_path urlpatterns = [ diff --git a/wagtailflags/views.py b/wagtailflags/views.py index da6724a..651cc2c 100644 --- a/wagtailflags/views.py +++ b/wagtailflags/views.py @@ -4,6 +4,7 @@ from flags.models import FlagState from flags.sources import get_flags from flags.templatetags.flags_debug import bool_enabled + from wagtailflags.forms import FlagStateForm, NewFlagForm diff --git a/wagtailflags/wagtail_hooks.py b/wagtailflags/wagtail_hooks.py index 714269b..a7f5b6e 100644 --- a/wagtailflags/wagtail_hooks.py +++ b/wagtailflags/wagtail_hooks.py @@ -9,10 +9,9 @@ try: # pragma: no cover; >= 2.0 - from django.urls import include, reverse, re_path + from django.urls import include, re_path, reverse except ImportError: # pragma: no cover; fallback for Django < 2.0 - from django.conf.urls import include - from django.conf.urls import url as re_path + from django.conf.urls import include, url as re_path from django.core.urlresolvers import reverse