From 3843e51ed280f2da6d18bdd30be250916a570ab7 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 3 Jun 2020 22:42:05 +0200 Subject: [PATCH] Reorder and lint import statements, add pre-commit hook for reordering --- .pre-commit-config.yaml | 5 ++++ docs/conf.py | 11 ++------ setup.py | 4 +-- src/wiki/__init__.py | 2 -- src/wiki/admin.py | 3 ++- src/wiki/core/markdown/__init__.py | 6 ++++- src/wiki/core/markdown/mdx/codehilite.py | 3 ++- src/wiki/decorators.py | 11 ++++---- src/wiki/forms_account_handling.py | 3 ++- src/wiki/managers.py | 6 +++-- src/wiki/migrations/0001_initial.py | 3 ++- src/wiki/migrations/0003_mptt_upgrade.py | 4 +-- src/wiki/models/__init__.py | 3 ++- src/wiki/models/article.py | 4 ++- src/wiki/models/pluginbase.py | 3 ++- src/wiki/models/urlpath.py | 16 ++++++++---- src/wiki/plugins/attachments/forms.py | 3 ++- .../attachments/migrations/0001_initial.py | 3 ++- .../migrations/0002_auto_20151118_1816.py | 3 ++- src/wiki/plugins/attachments/models.py | 3 ++- src/wiki/plugins/attachments/views.py | 18 +++++++++---- src/wiki/plugins/attachments/wiki_plugin.py | 7 ++++-- src/wiki/plugins/editsection/views.py | 3 ++- src/wiki/plugins/editsection/wiki_plugin.py | 3 ++- src/wiki/plugins/globalhistory/wiki_plugin.py | 3 ++- src/wiki/plugins/images/forms.py | 3 ++- .../plugins/images/markdown_extensions.py | 3 ++- .../plugins/images/migrations/0001_initial.py | 3 ++- .../migrations/0002_auto_20151118_1811.py | 3 ++- src/wiki/plugins/images/models.py | 6 +++-- .../images/templatetags/wiki_images_tags.py | 3 ++- src/wiki/plugins/images/views.py | 10 +++++--- src/wiki/plugins/images/wiki_plugin.py | 5 +++- src/wiki/plugins/links/wiki_plugin.py | 6 +++-- src/wiki/plugins/macros/mdx/toc.py | 4 ++- src/wiki/plugins/macros/mdx/wikilinks.py | 3 ++- src/wiki/plugins/notifications/forms.py | 10 +++++--- .../notifications/migrations/0001_initial.py | 3 ++- .../migrations/0002_auto_20151118_1811.py | 3 ++- src/wiki/plugins/notifications/views.py | 3 ++- src/wiki/plugins/notifications/wiki_plugin.py | 3 ++- src/wiki/plugins/redlinks/mdx/redlinks.py | 3 ++- src/wiki/sites.py | 3 ++- src/wiki/urls.py | 7 ++++-- src/wiki/views/accounts.py | 18 +++++++------ src/wiki/views/article.py | 25 +++++++++++-------- testproject/testproject/settings/base.py | 1 - testproject/testproject/settings/local.py | 2 -- testproject/testproject/urls.py | 8 +++--- testproject/testproject/wsgi.py | 3 ++- tests/base.py | 6 +++-- tests/core/test_accounts.py | 20 +++++++-------- tests/core/test_basic.py | 4 ++- tests/core/test_checks.py | 13 +++++----- tests/core/test_forms.py | 7 ++++-- tests/core/test_managers.py | 3 ++- tests/core/test_models.py | 4 ++- tests/core/test_sites.py | 9 ++++--- tests/core/test_template_filters.py | 22 ++++++++-------- tests/core/test_template_tags.py | 14 +++++------ tests/core/test_urls.py | 9 ++++--- tests/core/test_views.py | 25 ++++++++++--------- tests/plugins/attachments/test_commands.py | 3 ++- tests/plugins/attachments/test_models.py | 7 ++++-- tests/plugins/attachments/test_views.py | 4 ++- tests/plugins/editsection/test_editsection.py | 4 ++- .../globalhistory/test_globalhistory.py | 4 ++- tests/plugins/images/test_markdown.py | 4 ++- tests/plugins/images/test_views.py | 10 +++----- tests/plugins/links/test_urlize.py | 3 ++- tests/plugins/macros/test_links.py | 4 ++- tests/plugins/macros/test_macro.py | 4 ++- tests/plugins/notifications/test_forms.py | 2 +- tests/plugins/notifications/test_views.py | 9 +++---- tests/plugins/redlinks/test_redlinks.py | 4 ++- tests/testdata/migrations/0001_initial.py | 4 +-- tests/testdata/urls.py | 3 ++- 77 files changed, 290 insertions(+), 189 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1739d744..789949e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,3 +16,8 @@ repos: hooks: - id: black language_version: python3 + + - repo: https://github.com/asottile/reorder_python_imports + rev: v2.3.0 + hooks: + - id: reorder-python-imports diff --git a/docs/conf.py b/docs/conf.py index 9b687d80..0a07e67f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,13 +1,12 @@ import inspect import os import sys +from datetime import datetime import bleach - +import django from django.utils.encoding import force_text -from datetime import datetime - # # django-wiki documentation build configuration file, created by # sphinx-quickstart on Mon Jul 23 16:13:51 2012. @@ -19,20 +18,14 @@ from datetime import datetime # # All configuration values have a default; values that are commented out # serve to show the default. - - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) - # -- General configuration ----------------------------------------------------- - # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' -import django - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. diff --git a/setup.py b/setup.py index f32c3e0b..b23cd30f 100755 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - import os import sys from glob import glob -from setuptools import find_packages, setup +from setuptools import find_packages +from setuptools import setup sys.path.append(os.path.join(os.path.dirname(__file__), "src")) diff --git a/src/wiki/__init__.py b/src/wiki/__init__.py index 18dd5c09..6d1936b3 100644 --- a/src/wiki/__init__.py +++ b/src/wiki/__init__.py @@ -13,8 +13,6 @@ # # You should have received a copy of the GNU General Public License # along with django-wiki. If not, see . - - from wiki.core.version import get_version default_app_config = "wiki.apps.WikiConfig" diff --git a/src/wiki/admin.py b/src/wiki/admin.py index 8143bd6f..4180383f 100644 --- a/src/wiki/admin.py +++ b/src/wiki/admin.py @@ -4,7 +4,8 @@ from django.contrib.contenttypes.admin import GenericTabularInline from django.utils.translation import gettext_lazy as _ from mptt.admin import MPTTModelAdmin -from . import editors, models +from . import editors +from . import models class ArticleObjectAdmin(GenericTabularInline): diff --git a/src/wiki/core/markdown/__init__.py b/src/wiki/core/markdown/__init__.py index 832eb54f..6cc9a9fa 100644 --- a/src/wiki/core/markdown/__init__.py +++ b/src/wiki/core/markdown/__init__.py @@ -39,7 +39,11 @@ class ArticleMarkdown(markdown.Markdown): attrs.update(plugin_registry.get_html_attributes().items()) html = bleach.clean( - html, tags=tags, attributes=attrs, styles=settings.MARKDOWN_HTML_STYLES, strip=True + html, + tags=tags, + attributes=attrs, + styles=settings.MARKDOWN_HTML_STYLES, + strip=True, ) return html diff --git a/src/wiki/core/markdown/mdx/codehilite.py b/src/wiki/core/markdown/mdx/codehilite.py index b5e8fb05..85d950d9 100644 --- a/src/wiki/core/markdown/mdx/codehilite.py +++ b/src/wiki/core/markdown/mdx/codehilite.py @@ -1,7 +1,8 @@ import logging import re -from markdown.extensions.codehilite import CodeHilite, CodeHiliteExtension +from markdown.extensions.codehilite import CodeHilite +from markdown.extensions.codehilite import CodeHiliteExtension from markdown.preprocessors import Preprocessor from markdown.treeprocessors import Treeprocessor diff --git a/src/wiki/decorators.py b/src/wiki/decorators.py index 935c0e9b..e2fc1a44 100644 --- a/src/wiki/decorators.py +++ b/src/wiki/decorators.py @@ -1,11 +1,10 @@ from functools import wraps -from django.http import ( - HttpResponseForbidden, - HttpResponseNotFound, - HttpResponseRedirect, -) -from django.shortcuts import get_object_or_404, redirect +from django.http import HttpResponseForbidden +from django.http import HttpResponseNotFound +from django.http import HttpResponseRedirect +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect from django.template.loader import render_to_string from django.urls import reverse from django.utils.http import urlquote diff --git a/src/wiki/forms_account_handling.py b/src/wiki/forms_account_handling.py index a4be76ae..c6900889 100644 --- a/src/wiki/forms_account_handling.py +++ b/src/wiki/forms_account_handling.py @@ -6,7 +6,8 @@ from django import forms from django.contrib.auth import get_user_model from django.contrib.auth.forms import UserCreationForm from django.core.exceptions import FieldDoesNotExist -from django.db.models.fields import CharField, EmailField +from django.db.models.fields import CharField +from django.db.models.fields import EmailField from django.utils.translation import gettext_lazy as _ from wiki.conf import settings diff --git a/src/wiki/managers.py b/src/wiki/managers.py index b5dd2f32..04ba8204 100644 --- a/src/wiki/managers.py +++ b/src/wiki/managers.py @@ -1,6 +1,8 @@ from django.db import models -from django.db.models import Count, Q -from django.db.models.query import EmptyQuerySet, QuerySet +from django.db.models import Count +from django.db.models import Q +from django.db.models.query import EmptyQuerySet +from django.db.models.query import QuerySet from mptt.managers import TreeManager diff --git a/src/wiki/migrations/0001_initial.py b/src/wiki/migrations/0001_initial.py index e3210e23..ee615615 100644 --- a/src/wiki/migrations/0001_initial.py +++ b/src/wiki/migrations/0001_initial.py @@ -1,7 +1,8 @@ import django.db.models.deletion import mptt.fields from django.conf import settings -from django.db import migrations, models +from django.db import migrations +from django.db import models from django.db.models.fields import GenericIPAddressField as IPAddressField from wiki.conf.settings import GROUP_MODEL diff --git a/src/wiki/migrations/0003_mptt_upgrade.py b/src/wiki/migrations/0003_mptt_upgrade.py index c6e9b1eb..1c7bcc20 100644 --- a/src/wiki/migrations/0003_mptt_upgrade.py +++ b/src/wiki/migrations/0003_mptt_upgrade.py @@ -1,8 +1,8 @@ # Upgrades fields changed in django-mptt # See: https://github.com/django-mptt/django-mptt/pull/578 # Generated by Django 2.2.7 on 2020-02-06 20:36 - -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/wiki/models/__init__.py b/src/wiki/models/__init__.py index 8311014d..2a6e2b40 100644 --- a/src/wiki/models/__init__.py +++ b/src/wiki/models/__init__.py @@ -1,4 +1,5 @@ -from django import shortcuts, urls +from django import shortcuts +from django import urls from django.urls import base from django.utils.functional import lazy diff --git a/src/wiki/models/article.py b/src/wiki/models/article.py index 43f8f60f..beff6404 100644 --- a/src/wiki/models/article.py +++ b/src/wiki/models/article.py @@ -4,7 +4,9 @@ from django.contrib.contenttypes.models import ContentType from django.core.cache import cache from django.db import models from django.db.models.fields import GenericIPAddressField as IPAddressField -from django.db.models.signals import post_save, pre_delete, pre_save +from django.db.models.signals import post_save +from django.db.models.signals import pre_delete +from django.db.models.signals import pre_save from django.urls import reverse from django.utils import translation from django.utils.safestring import mark_safe diff --git a/src/wiki/models/pluginbase.py b/src/wiki/models/pluginbase.py index cd6b7aac..88f3673b 100644 --- a/src/wiki/models/pluginbase.py +++ b/src/wiki/models/pluginbase.py @@ -23,7 +23,8 @@ from django.db.models import signals from django.utils.translation import gettext_lazy as _ from wiki.decorators import disable_signal_for_loaddata -from .article import ArticleRevision, BaseRevisionMixin +from .article import ArticleRevision +from .article import BaseRevisionMixin __all__ = [ "ArticlePlugin", diff --git a/src/wiki/models/urlpath.py b/src/wiki/models/urlpath.py index 4a8422ab..2ffeae02 100644 --- a/src/wiki/models/urlpath.py +++ b/src/wiki/models/urlpath.py @@ -5,17 +5,23 @@ from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.core.exceptions import ValidationError -from django.db import models, transaction -from django.db.models.signals import post_save, pre_delete +from django.db import models +from django.db import transaction +from django.db.models.signals import post_save +from django.db.models.signals import pre_delete from django.urls import reverse -from django.utils.translation import gettext, gettext_lazy as _ +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ from mptt.fields import TreeForeignKey from mptt.models import MPTTModel from wiki import managers from wiki.conf import settings -from wiki.core.exceptions import MultipleRootURLs, NoRootURL +from wiki.core.exceptions import MultipleRootURLs +from wiki.core.exceptions import NoRootURL from wiki.decorators import disable_signal_for_loaddata -from wiki.models.article import Article, ArticleForObject, ArticleRevision +from wiki.models.article import Article +from wiki.models.article import ArticleForObject +from wiki.models.article import ArticleRevision __all__ = [ "URLPath", diff --git a/src/wiki/plugins/attachments/forms.py b/src/wiki/plugins/attachments/forms.py index fcde37df..8ca29245 100644 --- a/src/wiki/plugins/attachments/forms.py +++ b/src/wiki/plugins/attachments/forms.py @@ -3,7 +3,8 @@ import zipfile from django import forms from django.core.files.uploadedfile import File -from django.utils.translation import gettext, gettext_lazy as _ +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ from wiki.core.permissions import can_moderate from wiki.plugins.attachments import models from wiki.plugins.attachments.models import IllegalFileExtension diff --git a/src/wiki/plugins/attachments/migrations/0001_initial.py b/src/wiki/plugins/attachments/migrations/0001_initial.py index d0b0c437..8a399303 100644 --- a/src/wiki/plugins/attachments/migrations/0001_initial.py +++ b/src/wiki/plugins/attachments/migrations/0001_initial.py @@ -1,7 +1,8 @@ import django.db.models.deletion import wiki.plugins.attachments.models from django.conf import settings -from django.db import migrations, models +from django.db import migrations +from django.db import models from django.db.models.fields import GenericIPAddressField as IPAddressField diff --git a/src/wiki/plugins/attachments/migrations/0002_auto_20151118_1816.py b/src/wiki/plugins/attachments/migrations/0002_auto_20151118_1816.py index 30aa35f6..1f5bb412 100644 --- a/src/wiki/plugins/attachments/migrations/0002_auto_20151118_1816.py +++ b/src/wiki/plugins/attachments/migrations/0002_auto_20151118_1816.py @@ -1,4 +1,5 @@ -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/wiki/plugins/attachments/models.py b/src/wiki/plugins/attachments/models.py index 36ed0c69..555f5371 100644 --- a/src/wiki/plugins/attachments/models.py +++ b/src/wiki/plugins/attachments/models.py @@ -3,7 +3,8 @@ import os from django.conf import settings as django_settings from django.db import models from django.db.models import signals -from django.utils.translation import gettext, gettext_lazy as _ +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ from wiki import managers from wiki.decorators import disable_signal_for_loaddata from wiki.models.article import BaseRevisionMixin diff --git a/src/wiki/plugins/attachments/views.py b/src/wiki/plugins/attachments/views.py index 4fa630a3..155984ce 100644 --- a/src/wiki/plugins/attachments/views.py +++ b/src/wiki/plugins/attachments/views.py @@ -1,15 +1,23 @@ from django.contrib import messages from django.core.exceptions import ObjectDoesNotExist from django.db.models import Q -from django.http import Http404, HttpResponseRedirect -from django.shortcuts import get_object_or_404, redirect +from django.http import Http404 +from django.http import HttpResponseRedirect +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from django.views.generic import FormView, ListView, TemplateView, View +from django.views.generic import FormView +from django.views.generic import ListView +from django.views.generic import TemplateView +from django.views.generic import View from wiki.core.http import send_file from wiki.core.paginator import WikiPaginator -from wiki.decorators import get_article, response_forbidden -from wiki.plugins.attachments import forms, models, settings +from wiki.decorators import get_article +from wiki.decorators import response_forbidden +from wiki.plugins.attachments import forms +from wiki.plugins.attachments import models +from wiki.plugins.attachments import settings from wiki.views.mixins import ArticleMixin diff --git a/src/wiki/plugins/attachments/wiki_plugin.py b/src/wiki/plugins/attachments/wiki_plugin.py index 71395199..c644d78f 100644 --- a/src/wiki/plugins/attachments/wiki_plugin.py +++ b/src/wiki/plugins/attachments/wiki_plugin.py @@ -1,8 +1,11 @@ -from django.urls import include, re_path +from django.urls import include +from django.urls import re_path from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin -from wiki.plugins.attachments import models, settings, views +from wiki.plugins.attachments import models +from wiki.plugins.attachments import settings +from wiki.plugins.attachments import views from wiki.plugins.attachments.markdown_extensions import AttachmentExtension from wiki.plugins.notifications.settings import ARTICLE_EDIT from wiki.plugins.notifications.util import truncate_title diff --git a/src/wiki/plugins/editsection/views.py b/src/wiki/plugins/editsection/views.py index 8fdea953..83bdf906 100644 --- a/src/wiki/plugins/editsection/views.py +++ b/src/wiki/plugins/editsection/views.py @@ -1,7 +1,8 @@ import re from django.contrib import messages -from django.shortcuts import get_object_or_404, redirect +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect from django.utils.decorators import method_decorator from django.utils.translation import gettext_lazy from wiki import models diff --git a/src/wiki/plugins/editsection/wiki_plugin.py b/src/wiki/plugins/editsection/wiki_plugin.py index c2b77413..8ab7aeef 100644 --- a/src/wiki/plugins/editsection/wiki_plugin.py +++ b/src/wiki/plugins/editsection/wiki_plugin.py @@ -3,7 +3,8 @@ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin from wiki.plugins.editsection.markdown_extensions import EditSectionExtension -from . import settings, views +from . import settings +from . import views class EditSectionPlugin(BasePlugin): diff --git a/src/wiki/plugins/globalhistory/wiki_plugin.py b/src/wiki/plugins/globalhistory/wiki_plugin.py index c531652c..6797b8f3 100644 --- a/src/wiki/plugins/globalhistory/wiki_plugin.py +++ b/src/wiki/plugins/globalhistory/wiki_plugin.py @@ -2,7 +2,8 @@ from django.urls import re_path from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin -from . import settings, views +from . import settings +from . import views class GlobalHistoryPlugin(BasePlugin): diff --git a/src/wiki/plugins/images/forms.py b/src/wiki/plugins/images/forms.py index 72e84b8b..21918a4a 100644 --- a/src/wiki/plugins/images/forms.py +++ b/src/wiki/plugins/images/forms.py @@ -1,5 +1,6 @@ from django import forms -from django.utils.translation import gettext, gettext_lazy as _ +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ from wiki.core.plugins.base import PluginSidebarFormMixin from wiki.plugins.images import models diff --git a/src/wiki/plugins/images/markdown_extensions.py b/src/wiki/plugins/images/markdown_extensions.py index d5b5b799..59a39519 100644 --- a/src/wiki/plugins/images/markdown_extensions.py +++ b/src/wiki/plugins/images/markdown_extensions.py @@ -1,6 +1,7 @@ import markdown from django.template.loader import render_to_string -from wiki.plugins.images import models, settings +from wiki.plugins.images import models +from wiki.plugins.images import settings IMAGE_RE = ( r"(?:(?im)" diff --git a/src/wiki/plugins/images/migrations/0001_initial.py b/src/wiki/plugins/images/migrations/0001_initial.py index 6d85fe4d..1cd9336f 100644 --- a/src/wiki/plugins/images/migrations/0001_initial.py +++ b/src/wiki/plugins/images/migrations/0001_initial.py @@ -1,5 +1,6 @@ import wiki.plugins.images.models -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/wiki/plugins/images/migrations/0002_auto_20151118_1811.py b/src/wiki/plugins/images/migrations/0002_auto_20151118_1811.py index 3c16fca4..d4b9a588 100644 --- a/src/wiki/plugins/images/migrations/0002_auto_20151118_1811.py +++ b/src/wiki/plugins/images/migrations/0002_auto_20151118_1811.py @@ -1,4 +1,5 @@ -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/wiki/plugins/images/models.py b/src/wiki/plugins/images/models.py index 04b01fae..1435b080 100644 --- a/src/wiki/plugins/images/models.py +++ b/src/wiki/plugins/images/models.py @@ -3,8 +3,10 @@ import os.path from django.conf import settings as django_settings from django.db import models from django.db.models import signals -from django.utils.translation import gettext, gettext_lazy as _ -from wiki.models.pluginbase import RevisionPlugin, RevisionPluginRevision +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ +from wiki.models.pluginbase import RevisionPlugin +from wiki.models.pluginbase import RevisionPluginRevision from . import settings diff --git a/src/wiki/plugins/images/templatetags/wiki_images_tags.py b/src/wiki/plugins/images/templatetags/wiki_images_tags.py index 23945f82..4b745903 100644 --- a/src/wiki/plugins/images/templatetags/wiki_images_tags.py +++ b/src/wiki/plugins/images/templatetags/wiki_images_tags.py @@ -1,5 +1,6 @@ from django import template -from wiki.plugins.images import models, settings +from wiki.plugins.images import models +from wiki.plugins.images import settings register = template.Library() diff --git a/src/wiki/plugins/images/views.py b/src/wiki/plugins/images/views.py index a302a9c7..ec1882e4 100644 --- a/src/wiki/plugins/images/views.py +++ b/src/wiki/plugins/images/views.py @@ -1,16 +1,20 @@ import logging from django.contrib import messages -from django.shortcuts import get_object_or_404, redirect +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect from django.urls import reverse from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from django.views.generic import FormView, ListView, RedirectView +from django.views.generic import FormView +from django.views.generic import ListView +from django.views.generic import RedirectView from wiki.conf import settings as wiki_settings from wiki.core.paginator import WikiPaginator from wiki.decorators import get_article from wiki.models.pluginbase import RevisionPluginRevision -from wiki.plugins.images import forms, models +from wiki.plugins.images import forms +from wiki.plugins.images import models from wiki.views.mixins import ArticleMixin logger = logging.getLogger(__name__) diff --git a/src/wiki/plugins/images/wiki_plugin.py b/src/wiki/plugins/images/wiki_plugin.py index cdd57a8f..3cf849e7 100644 --- a/src/wiki/plugins/images/wiki_plugin.py +++ b/src/wiki/plugins/images/wiki_plugin.py @@ -2,7 +2,10 @@ from django.urls import re_path from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin -from wiki.plugins.images import forms, models, settings, views +from wiki.plugins.images import forms +from wiki.plugins.images import models +from wiki.plugins.images import settings +from wiki.plugins.images import views from wiki.plugins.images.markdown_extensions import ImageExtension from wiki.plugins.notifications.settings import ARTICLE_EDIT from wiki.plugins.notifications.util import truncate_title diff --git a/src/wiki/plugins/links/wiki_plugin.py b/src/wiki/plugins/links/wiki_plugin.py index b268efdb..f6b81343 100644 --- a/src/wiki/plugins/links/wiki_plugin.py +++ b/src/wiki/plugins/links/wiki_plugin.py @@ -1,8 +1,10 @@ -from django.urls import re_path, reverse_lazy +from django.urls import re_path +from django.urls import reverse_lazy from django.utils.translation import gettext as _ from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin -from wiki.plugins.links import settings, views +from wiki.plugins.links import settings +from wiki.plugins.links import views from wiki.plugins.links.mdx.djangowikilinks import WikiPathExtension from wiki.plugins.links.mdx.urlize import makeExtension as urlize_makeExtension diff --git a/src/wiki/plugins/macros/mdx/toc.py b/src/wiki/plugins/macros/mdx/toc.py index 981a6e4f..369e1fd8 100644 --- a/src/wiki/plugins/macros/mdx/toc.py +++ b/src/wiki/plugins/macros/mdx/toc.py @@ -1,6 +1,8 @@ import re -from markdown.extensions.toc import TocExtension, TocTreeprocessor, slugify +from markdown.extensions.toc import slugify +from markdown.extensions.toc import TocExtension +from markdown.extensions.toc import TocTreeprocessor from wiki.plugins.macros import settings HEADER_ID_PREFIX = "wiki-toc-" diff --git a/src/wiki/plugins/macros/mdx/wikilinks.py b/src/wiki/plugins/macros/mdx/wikilinks.py index c3b8a8b8..268373ec 100644 --- a/src/wiki/plugins/macros/mdx/wikilinks.py +++ b/src/wiki/plugins/macros/mdx/wikilinks.py @@ -5,7 +5,8 @@ import re import markdown from django.urls import reverse -from markdown.extensions import Extension, wikilinks +from markdown.extensions import Extension +from markdown.extensions import wikilinks def build_url(label, base, end, md): diff --git a/src/wiki/plugins/notifications/forms.py b/src/wiki/plugins/notifications/forms.py index d866ed3c..9b8206ec 100644 --- a/src/wiki/plugins/notifications/forms.py +++ b/src/wiki/plugins/notifications/forms.py @@ -1,9 +1,13 @@ from django import forms from django.contrib.contenttypes.models import ContentType -from django.forms.models import BaseModelFormSet, modelformset_factory +from django.forms.models import BaseModelFormSet +from django.forms.models import modelformset_factory from django.utils.safestring import mark_safe -from django.utils.translation import gettext, gettext_lazy as _ -from django_nyt.models import NotificationType, Settings, Subscription +from django.utils.translation import gettext +from django.utils.translation import gettext_lazy as _ +from django_nyt.models import NotificationType +from django_nyt.models import Settings +from django_nyt.models import Subscription from wiki.core.plugins.base import PluginSettingsFormMixin from wiki.plugins.notifications import models from wiki.plugins.notifications.settings import ARTICLE_EDIT diff --git a/src/wiki/plugins/notifications/migrations/0001_initial.py b/src/wiki/plugins/notifications/migrations/0001_initial.py index e43892fb..3cbdf713 100644 --- a/src/wiki/plugins/notifications/migrations/0001_initial.py +++ b/src/wiki/plugins/notifications/migrations/0001_initial.py @@ -1,4 +1,5 @@ -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/wiki/plugins/notifications/migrations/0002_auto_20151118_1811.py b/src/wiki/plugins/notifications/migrations/0002_auto_20151118_1811.py index c4b22b47..8117ff2f 100644 --- a/src/wiki/plugins/notifications/migrations/0002_auto_20151118_1811.py +++ b/src/wiki/plugins/notifications/migrations/0002_auto_20151118_1811.py @@ -1,4 +1,5 @@ -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/wiki/plugins/notifications/views.py b/src/wiki/plugins/notifications/views.py index 556e9043..84903b3f 100644 --- a/src/wiki/plugins/notifications/views.py +++ b/src/wiki/plugins/notifications/views.py @@ -5,7 +5,8 @@ from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ from django.views.generic import FormView -from . import forms, models +from . import forms +from . import models class NotificationSettings(FormView): diff --git a/src/wiki/plugins/notifications/wiki_plugin.py b/src/wiki/plugins/notifications/wiki_plugin.py index 4572b9cd..713e50b3 100644 --- a/src/wiki/plugins/notifications/wiki_plugin.py +++ b/src/wiki/plugins/notifications/wiki_plugin.py @@ -2,7 +2,8 @@ from django.urls import re_path from wiki.core.plugins import registry from wiki.core.plugins.base import BasePlugin -from . import settings, views +from . import settings +from . import views class NotifyPlugin(BasePlugin): diff --git a/src/wiki/plugins/redlinks/mdx/redlinks.py b/src/wiki/plugins/redlinks/mdx/redlinks.py index ba8cd525..e0bd8738 100644 --- a/src/wiki/plugins/redlinks/mdx/redlinks.py +++ b/src/wiki/plugins/redlinks/mdx/redlinks.py @@ -1,5 +1,6 @@ import html -from urllib.parse import urljoin, urlparse +from urllib.parse import urljoin +from urllib.parse import urlparse from markdown.extensions import Extension from markdown.postprocessors import AndSubstitutePostprocessor diff --git a/src/wiki/sites.py b/src/wiki/sites.py index 870bfd69..3d3ab474 100644 --- a/src/wiki/sites.py +++ b/src/wiki/sites.py @@ -1,5 +1,6 @@ from django.apps import apps -from django.urls import include, re_path +from django.urls import include +from django.urls import re_path from django.utils.functional import LazyObject from django.utils.module_loading import import_string from wiki.conf import settings diff --git a/src/wiki/urls.py b/src/wiki/urls.py index b9d22e8b..bfce5859 100644 --- a/src/wiki/urls.py +++ b/src/wiki/urls.py @@ -1,9 +1,12 @@ -from django.urls import include, re_path +from django.urls import include +from django.urls import re_path from django.utils.module_loading import import_string from wiki import sites from wiki.conf import settings from wiki.core.plugins import registry -from wiki.views import accounts, article, deleted_list +from wiki.views import accounts +from wiki.views import article +from wiki.views import deleted_list urlpatterns = [ re_path(r"^", sites.site.urls), diff --git a/src/wiki/views/accounts.py b/src/wiki/views/accounts.py index 6b7c9f9d..469fddc2 100644 --- a/src/wiki/views/accounts.py +++ b/src/wiki/views/accounts.py @@ -8,19 +8,21 @@ settings.WIKI_SIGNUP_URL = '/your/signup/url' SETTINGS.LOGIN_URL SETTINGS.LOGOUT_URL """ - from django.conf import settings as django_settings from django.contrib import messages -from django.contrib.auth import ( - get_user_model, - login as auth_login, - logout as auth_logout, -) +from django.contrib.auth import get_user_model +from django.contrib.auth import login as auth_login +from django.contrib.auth import logout as auth_logout from django.contrib.auth.forms import AuthenticationForm -from django.shortcuts import get_object_or_404, redirect, render +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect +from django.shortcuts import render from django.urls import reverse from django.utils.translation import gettext as _ -from django.views.generic import CreateView, FormView, UpdateView, View +from django.views.generic import CreateView +from django.views.generic import FormView +from django.views.generic import UpdateView +from django.views.generic import View from wiki import forms from wiki.conf import settings diff --git a/src/wiki/views/article.py b/src/wiki/views/article.py index 1a1cee35..b2ace1a8 100644 --- a/src/wiki/views/article.py +++ b/src/wiki/views/article.py @@ -7,20 +7,23 @@ from django.contrib.auth.decorators import login_required from django.db import transaction from django.db.models import Q from django.http import Http404 -from django.shortcuts import get_object_or_404, redirect, render +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect +from django.shortcuts import render from django.urls import reverse from django.utils.decorators import method_decorator -from django.utils.translation import gettext as _, ngettext +from django.utils.translation import gettext as _ +from django.utils.translation import ngettext from django.views.decorators.clickjacking import xframe_options_sameorigin -from django.views.generic import ( - DetailView, - FormView, - ListView, - RedirectView, - TemplateView, - View, -) -from wiki import editors, forms, models +from django.views.generic import DetailView +from django.views.generic import FormView +from django.views.generic import ListView +from django.views.generic import RedirectView +from django.views.generic import TemplateView +from django.views.generic import View +from wiki import editors +from wiki import forms +from wiki import models from wiki.conf import settings from wiki.core import permissions from wiki.core.diff import simple_merge diff --git a/testproject/testproject/settings/base.py b/testproject/testproject/settings/base.py index b09f3994..9093a5bc 100644 --- a/testproject/testproject/settings/base.py +++ b/testproject/testproject/settings/base.py @@ -7,7 +7,6 @@ https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ - import os from django.urls import reverse_lazy diff --git a/testproject/testproject/settings/local.py b/testproject/testproject/settings/local.py index 5b94dc26..76b9de21 100644 --- a/testproject/testproject/settings/local.py +++ b/testproject/testproject/settings/local.py @@ -1,6 +1,4 @@ # Add your own changes here -- but do not push to remote!! # After changing the file, from root of repository execute: - # git update-index --assume-unchanged testproject/testproject/settings/local.py - from .dev import * # noqa @UnusedWildImport diff --git a/testproject/testproject/urls.py b/testproject/testproject/urls.py index e1601da9..e55a6a4c 100644 --- a/testproject/testproject/urls.py +++ b/testproject/testproject/urls.py @@ -2,8 +2,9 @@ from django.conf import settings from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.http.response import HttpResponse +from django.urls import include +from django.urls import re_path from django.views.static import serve as static_serve -from django.urls import include, re_path admin.autodiscover() @@ -25,12 +26,11 @@ if settings.DEBUG: if settings.DEBUG: try: import debug_toolbar - urlpatterns = [ - re_path('__debug__/', include(debug_toolbar.urls)), + urlpatterns = [ + re_path("__debug__/", include(debug_toolbar.urls)), # For django versions before 2.0: # url(r'^__debug__/', include(debug_toolbar.urls)), - ] + urlpatterns except ImportError as ie: pass diff --git a/testproject/testproject/wsgi.py b/testproject/testproject/wsgi.py index f0495dcc..9b0b5083 100644 --- a/testproject/testproject/wsgi.py +++ b/testproject/testproject/wsgi.py @@ -16,10 +16,11 @@ framework. import os import sys +from django.core.wsgi import get_wsgi_application + # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. -from django.core.wsgi import get_wsgi_application PROJECT_PATH = os.path.abspath(os.path.split(__file__)[0]) PROJECT_PARENT = os.path.abspath(os.path.split(PROJECT_PATH)[0]) diff --git a/tests/base.py b/tests/base.py index 44f2463b..05ac44e0 100644 --- a/tests/base.py +++ b/tests/base.py @@ -3,8 +3,10 @@ import unittest import django_functest from django.contrib.staticfiles.testing import StaticLiveServerTestCase -from django.template import Context, Template -from django.test import TestCase, override_settings +from django.template import Context +from django.template import Template +from django.test import override_settings +from django.test import TestCase from django.urls import reverse from wiki.models import URLPath diff --git a/tests/core/test_accounts.py b/tests/core/test_accounts.py index 7058cfa3..1b13878c 100644 --- a/tests/core/test_accounts.py +++ b/tests/core/test_accounts.py @@ -6,15 +6,13 @@ from django.shortcuts import resolve_url from wiki.conf import settings as wiki_settings from wiki.models import reverse -from ..base import ( - SUPERUSER1_PASSWORD, - SUPERUSER1_USERNAME, - ArticleWebTestUtils, - DjangoClientTestBase, - RequireRootArticleMixin, - TestBase, - wiki_override_settings, -) +from ..base import ArticleWebTestUtils +from ..base import DjangoClientTestBase +from ..base import RequireRootArticleMixin +from ..base import SUPERUSER1_PASSWORD +from ..base import SUPERUSER1_USERNAME +from ..base import TestBase +from ..base import wiki_override_settings from ..testdata.models import CustomUser @@ -38,7 +36,9 @@ class AccountUpdateTest( # save a new revision response = self.client.post(resolve_url("wiki:profile_update"), example_data) - self.assertContains(response, "Passwords don", status_code=200) # Django 2/3 output different escaped versions of single quote in don't + self.assertContains( + response, "Passwords don", status_code=200 + ) # Django 2/3 output different escaped versions of single quote in don't # Now check that we don't succeed with unmatching passwords example_data = { diff --git a/tests/core/test_basic.py b/tests/core/test_basic.py index 7ed2feff..21a17759 100644 --- a/tests/core/test_basic.py +++ b/tests/core/test_basic.py @@ -5,7 +5,9 @@ from django.test import TestCase from wiki.conf import settings as wiki_settings from wiki.core.http import send_file from wiki.forms import Group -from wiki.models import Article, ArticleRevision, URLPath +from wiki.models import Article +from wiki.models import ArticleRevision +from wiki.models import URLPath from ..base import wiki_override_settings from ..testdata.models import CustomGroup diff --git a/tests/core/test_checks.py b/tests/core/test_checks.py index b33526c0..0f05962e 100644 --- a/tests/core/test_checks.py +++ b/tests/core/test_checks.py @@ -1,14 +1,13 @@ import copy from django.conf import settings -from django.core.checks import Error, registry +from django.core.checks import Error +from django.core.checks import registry from django.test import TestCase -from wiki.checks import ( - FIELDS_IN_CUSTOM_USER_MODEL, - REQUIRED_CONTEXT_PROCESSORS, - REQUIRED_INSTALLED_APPS, - Tags, -) +from wiki.checks import FIELDS_IN_CUSTOM_USER_MODEL +from wiki.checks import REQUIRED_CONTEXT_PROCESSORS +from wiki.checks import REQUIRED_INSTALLED_APPS +from wiki.checks import Tags from ..base import wiki_override_settings diff --git a/tests/core/test_forms.py b/tests/core/test_forms.py index 20c4c40b..fdf967a9 100644 --- a/tests/core/test_forms.py +++ b/tests/core/test_forms.py @@ -1,7 +1,10 @@ from django.test import TestCase from django.utils.translation import gettext -from tests.base import DjangoClientTestBase, RequireRootArticleMixin -from wiki.forms import DeleteForm, UserCreationForm +from wiki.forms import DeleteForm +from wiki.forms import UserCreationForm + +from tests.base import DjangoClientTestBase +from tests.base import RequireRootArticleMixin class DeleteFormTests(RequireRootArticleMixin, DjangoClientTestBase): diff --git a/tests/core/test_managers.py b/tests/core/test_managers.py index 44209f1e..14b74216 100644 --- a/tests/core/test_managers.py +++ b/tests/core/test_managers.py @@ -4,7 +4,8 @@ because the pattern of building them is different from Django 1.5 to 1.6 to 1.7 so there will be 3 patterns in play at the same time. """ -from wiki.models import Article, URLPath +from wiki.models import Article +from wiki.models import URLPath from wiki.plugins.attachments.models import Attachment from ..base import ArticleTestBase diff --git a/tests/core/test_models.py b/tests/core/test_models.py index aa823b85..a8aac90d 100644 --- a/tests/core/test_models.py +++ b/tests/core/test_models.py @@ -5,7 +5,9 @@ from django.test.testcases import TestCase from django.urls import re_path from wiki.conf import settings from wiki.managers import ArticleManager -from wiki.models import Article, ArticleRevision, URLPath +from wiki.models import Article +from wiki.models import ArticleRevision +from wiki.models import URLPath from wiki.urls import WikiURLPatterns User = get_user_model() diff --git a/tests/core/test_sites.py b/tests/core/test_sites.py index 796e4021..bb8e57f8 100644 --- a/tests/core/test_sites.py +++ b/tests/core/test_sites.py @@ -2,10 +2,13 @@ from importlib import reload from django.contrib.sites.models import Site from django.test.testcases import TestCase -from django.urls import include, re_path -from wiki import sites, urls +from django.urls import include +from django.urls import re_path +from wiki import sites +from wiki import urls from wiki.apps import WikiConfig -from wiki.models import Article, URLPath +from wiki.models import Article +from wiki.models import URLPath from ..base import wiki_override_settings diff --git a/tests/core/test_template_filters.py b/tests/core/test_template_filters.py index eed51421..dd8f9d13 100644 --- a/tests/core/test_template_filters.py +++ b/tests/core/test_template_filters.py @@ -1,15 +1,15 @@ from django.contrib.auth import get_user_model -from wiki.models import Article, ArticleRevision -from wiki.templatetags.wiki_tags import ( - can_delete, - can_moderate, - can_read, - can_write, - get_content_snippet, - is_locked, -) - -from ..base import TemplateTestCase, wiki_override_settings +from wiki.models import Article +from wiki.models import ArticleRevision +from wiki.templatetags.wiki_tags import can_delete +from wiki.templatetags.wiki_tags import can_moderate +from wiki.templatetags.wiki_tags import can_read +from wiki.templatetags.wiki_tags import can_write +from wiki.templatetags.wiki_tags import get_content_snippet +from wiki.templatetags.wiki_tags import is_locked + +from ..base import TemplateTestCase +from ..base import wiki_override_settings User = get_user_model() diff --git a/tests/core/test_template_tags.py b/tests/core/test_template_tags.py index a072994b..abaa4245 100644 --- a/tests/core/test_template_tags.py +++ b/tests/core/test_template_tags.py @@ -6,13 +6,13 @@ from django.contrib.contenttypes.models import ContentType from django.http import HttpRequest from wiki.conf import settings from wiki.forms import CreateRootForm -from wiki.models import Article, ArticleForObject, ArticleRevision -from wiki.templatetags.wiki_tags import ( - article_for_object, - login_url, - wiki_form, - wiki_render, -) +from wiki.models import Article +from wiki.models import ArticleForObject +from wiki.models import ArticleRevision +from wiki.templatetags.wiki_tags import article_for_object +from wiki.templatetags.wiki_tags import login_url +from wiki.templatetags.wiki_tags import wiki_form +from wiki.templatetags.wiki_tags import wiki_render from ..base import TemplateTestCase diff --git a/tests/core/test_urls.py b/tests/core/test_urls.py index ed85f051..d3f22b8e 100644 --- a/tests/core/test_urls.py +++ b/tests/core/test_urls.py @@ -1,8 +1,11 @@ from django.contrib.sites.models import Site from django.test.testcases import TestCase -from django.urls import include, re_path -from wiki.models import Article, URLPath -from wiki.urls import WikiURLPatterns, get_pattern as get_wiki_pattern +from django.urls import include +from django.urls import re_path +from wiki.models import Article +from wiki.models import URLPath +from wiki.urls import get_pattern as get_wiki_pattern +from wiki.urls import WikiURLPatterns from ..base import wiki_override_settings diff --git a/tests/core/test_views.py b/tests/core/test_views.py index d9e6c31c..f725ccc9 100644 --- a/tests/core/test_views.py +++ b/tests/core/test_views.py @@ -7,19 +7,20 @@ from django.test import override_settings from django.utils import translation from django.utils.html import escape from django_functest import FuncBaseMixin -from tests.testdata.models import CustomGroup from wiki import models -from wiki.forms import PermissionsForm, validate_slug_numbers -from wiki.models import ArticleRevision, URLPath, reverse - -from ..base import ( - SUPERUSER1_USERNAME, - ArticleWebTestUtils, - DjangoClientTestBase, - RequireRootArticleMixin, - SeleniumBase, - WebTestBase, -) +from wiki.forms import PermissionsForm +from wiki.forms import validate_slug_numbers +from wiki.models import ArticleRevision +from wiki.models import reverse +from wiki.models import URLPath + +from ..base import ArticleWebTestUtils +from ..base import DjangoClientTestBase +from ..base import RequireRootArticleMixin +from ..base import SeleniumBase +from ..base import SUPERUSER1_USERNAME +from ..base import WebTestBase +from tests.testdata.models import CustomGroup class RootArticleViewTestsBase(FuncBaseMixin): diff --git a/tests/plugins/attachments/test_commands.py b/tests/plugins/attachments/test_commands.py index 5b40345c..5db2aa34 100644 --- a/tests/plugins/attachments/test_commands.py +++ b/tests/plugins/attachments/test_commands.py @@ -1,10 +1,11 @@ import os import tempfile -from tests.core.test_commands import TestManagementCommands from wiki.models import URLPath from wiki.plugins.attachments import models +from tests.core.test_commands import TestManagementCommands + class TestAttachmentManagementCommands(TestManagementCommands): """ diff --git a/tests/plugins/attachments/test_models.py b/tests/plugins/attachments/test_models.py index b48a2144..91192ec6 100644 --- a/tests/plugins/attachments/test_models.py +++ b/tests/plugins/attachments/test_models.py @@ -1,5 +1,8 @@ -from tests.base import RequireRootArticleMixin, TestBase -from wiki.plugins.attachments.models import Attachment, AttachmentRevision +from wiki.plugins.attachments.models import Attachment +from wiki.plugins.attachments.models import AttachmentRevision + +from tests.base import RequireRootArticleMixin +from tests.base import TestBase class AttachmentRevisionTests(RequireRootArticleMixin, TestBase): diff --git a/tests/plugins/attachments/test_views.py b/tests/plugins/attachments/test_views.py index 97e1aa54..c19fd70c 100644 --- a/tests/plugins/attachments/test_views.py +++ b/tests/plugins/attachments/test_views.py @@ -4,7 +4,9 @@ from django.core.files.uploadedfile import InMemoryUploadedFile from django.urls import reverse from wiki.models import URLPath -from ...base import ArticleWebTestUtils, DjangoClientTestBase, RequireRootArticleMixin +from ...base import ArticleWebTestUtils +from ...base import DjangoClientTestBase +from ...base import RequireRootArticleMixin class AttachmentTests( diff --git a/tests/plugins/editsection/test_editsection.py b/tests/plugins/editsection/test_editsection.py index c864362e..a45419f3 100644 --- a/tests/plugins/editsection/test_editsection.py +++ b/tests/plugins/editsection/test_editsection.py @@ -2,7 +2,9 @@ from django.urls import reverse from django_functest import FuncBaseMixin from wiki.models import URLPath -from ...base import DjangoClientTestBase, RequireRootArticleMixin, WebTestBase +from ...base import DjangoClientTestBase +from ...base import RequireRootArticleMixin +from ...base import WebTestBase TEST_CONTENT = ( "Title 1\n" diff --git a/tests/plugins/globalhistory/test_globalhistory.py b/tests/plugins/globalhistory/test_globalhistory.py index 2d2cc0a1..c1dad197 100644 --- a/tests/plugins/globalhistory/test_globalhistory.py +++ b/tests/plugins/globalhistory/test_globalhistory.py @@ -2,7 +2,9 @@ from django.urls import reverse from django.utils import translation from wiki.models import URLPath -from ...base import ArticleWebTestUtils, DjangoClientTestBase, RequireRootArticleMixin +from ...base import ArticleWebTestUtils +from ...base import DjangoClientTestBase +from ...base import RequireRootArticleMixin class GlobalhistoryTests( diff --git a/tests/plugins/images/test_markdown.py b/tests/plugins/images/test_markdown.py index 6c7106f6..2222a78c 100644 --- a/tests/plugins/images/test_markdown.py +++ b/tests/plugins/images/test_markdown.py @@ -2,10 +2,12 @@ import base64 from io import BytesIO from django.core.files.uploadedfile import InMemoryUploadedFile -from tests.base import RequireRootArticleMixin, TestBase from wiki.core import markdown from wiki.plugins.images import models +from tests.base import RequireRootArticleMixin +from tests.base import TestBase + class ImageMarkdownTests(RequireRootArticleMixin, TestBase): def setUp(self): diff --git a/tests/plugins/images/test_views.py b/tests/plugins/images/test_views.py index f2c0a821..dc20db4d 100644 --- a/tests/plugins/images/test_views.py +++ b/tests/plugins/images/test_views.py @@ -10,12 +10,10 @@ from wiki.models import URLPath from wiki.plugins.images import models from wiki.plugins.images.wiki_plugin import ImagePlugin -from ...base import ( - ArticleWebTestUtils, - DjangoClientTestBase, - RequireRootArticleMixin, - wiki_override_settings, -) +from ...base import ArticleWebTestUtils +from ...base import DjangoClientTestBase +from ...base import RequireRootArticleMixin +from ...base import wiki_override_settings class ImageTests(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase): diff --git a/tests/plugins/links/test_urlize.py b/tests/plugins/links/test_urlize.py index 0c3f2f16..d1ab800b 100644 --- a/tests/plugins/links/test_urlize.py +++ b/tests/plugins/links/test_urlize.py @@ -2,7 +2,8 @@ import html import markdown import pytest -from wiki.plugins.links.mdx.urlize import UrlizeExtension, makeExtension +from wiki.plugins.links.mdx.urlize import makeExtension +from wiki.plugins.links.mdx.urlize import UrlizeExtension # Template accepts two strings - href value and link text value. EXPECTED_LINK_TEMPLATE = ( diff --git a/tests/plugins/macros/test_links.py b/tests/plugins/macros/test_links.py index b1650f9c..54cd2238 100644 --- a/tests/plugins/macros/test_links.py +++ b/tests/plugins/macros/test_links.py @@ -1,6 +1,8 @@ -from tests.base import RequireRootArticleMixin, TestBase from wiki.core import markdown +from tests.base import RequireRootArticleMixin +from tests.base import TestBase + class WikiLinksTests(RequireRootArticleMixin, TestBase): def test_wikilink(self): diff --git a/tests/plugins/macros/test_macro.py b/tests/plugins/macros/test_macro.py index bc188145..124fd729 100644 --- a/tests/plugins/macros/test_macro.py +++ b/tests/plugins/macros/test_macro.py @@ -1,6 +1,8 @@ -from tests.base import RequireRootArticleMixin, TestBase from wiki.core import markdown +from tests.base import RequireRootArticleMixin +from tests.base import TestBase + class MacroTests(RequireRootArticleMixin, TestBase): def test_article_list(self): diff --git a/tests/plugins/notifications/test_forms.py b/tests/plugins/notifications/test_forms.py index 28eadacd..74562bbe 100644 --- a/tests/plugins/notifications/test_forms.py +++ b/tests/plugins/notifications/test_forms.py @@ -1,8 +1,8 @@ from django.test import TestCase from django_nyt.forms import SettingsForm +from wiki.plugins.notifications.forms import SettingsFormSet from tests.base import RequireSuperuserMixin -from wiki.plugins.notifications.forms import SettingsFormSet class SettingsFormTests(RequireSuperuserMixin, TestCase): diff --git a/tests/plugins/notifications/test_views.py b/tests/plugins/notifications/test_views.py index 0b899ce5..4bc6993a 100644 --- a/tests/plugins/notifications/test_views.py +++ b/tests/plugins/notifications/test_views.py @@ -1,10 +1,9 @@ from django.shortcuts import resolve_url from django_nyt.models import Settings -from tests.base import ( - ArticleWebTestUtils, - DjangoClientTestBase, - RequireRootArticleMixin, -) + +from tests.base import ArticleWebTestUtils +from tests.base import DjangoClientTestBase +from tests.base import RequireRootArticleMixin class NotificationSettingsTests( diff --git a/tests/plugins/redlinks/test_redlinks.py b/tests/plugins/redlinks/test_redlinks.py index 53a90efc..de4967a6 100644 --- a/tests/plugins/redlinks/test_redlinks.py +++ b/tests/plugins/redlinks/test_redlinks.py @@ -1,7 +1,9 @@ -from tests.base import RequireRootArticleMixin, TestBase from wiki.core import markdown from wiki.models import URLPath +from tests.base import RequireRootArticleMixin +from tests.base import TestBase + class RedlinksTests(RequireRootArticleMixin, TestBase): def setUp(self): diff --git a/tests/testdata/migrations/0001_initial.py b/tests/testdata/migrations/0001_initial.py index 86a189a5..7b62bcd9 100644 --- a/tests/testdata/migrations/0001_initial.py +++ b/tests/testdata/migrations/0001_initial.py @@ -1,9 +1,9 @@ # Generated by Django 2.2.1 on 2019-07-03 19:03 - import django.contrib.auth.models import django.contrib.auth.validators import django.utils.timezone -from django.db import migrations, models +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/tests/testdata/urls.py b/tests/testdata/urls.py index 683fe18d..7e076224 100644 --- a/tests/testdata/urls.py +++ b/tests/testdata/urls.py @@ -1,7 +1,8 @@ from django.conf import settings from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns -from django.urls import include, re_path +from django.urls import include +from django.urls import re_path urlpatterns = [ re_path(r"^admin/doc/", include("django.contrib.admindocs.urls")), -- 2.45.2