From 5df639b43d52d232a2a90da99e4fc77ff2757c90 Mon Sep 17 00:00:00 2001 From: Raffaele Salmaso Date: Sun, 18 Feb 2018 10:46:12 +0100 Subject: [PATCH] Removed six usage. --- src/wiki/core/plugins/registry.py | 4 +--- src/wiki/models/__init__.py | 5 ++--- src/wiki/plugins/macros/mdx/macro.py | 3 +-- tests/core/test_template_tags.py | 7 +++---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/wiki/core/plugins/registry.py b/src/wiki/core/plugins/registry.py index 732a0a0f..75dac1fd 100644 --- a/src/wiki/core/plugins/registry.py +++ b/src/wiki/core/plugins/registry.py @@ -1,7 +1,5 @@ from importlib import import_module -from django.utils.six import string_types - _cache = {} _settings_forms = [] _markdown_extensions = [] @@ -23,7 +21,7 @@ def register(PluginClass): settings_form = getattr(PluginClass, 'settings_form', None) if settings_form: - if isinstance(settings_form, string_types): + if isinstance(settings_form, str): klassname = settings_form.split(".")[-1] modulename = ".".join(settings_form.split(".")[:-1]) form_module = import_module(modulename) diff --git a/src/wiki/models/__init__.py b/src/wiki/models/__init__.py index c78a98b7..8ccc7b0f 100644 --- a/src/wiki/models/__init__.py +++ b/src/wiki/models/__init__.py @@ -1,7 +1,6 @@ from django.apps import apps from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured -from django.utils.six import string_types, text_type # TODO: Don't use wildcards from .article import * # noqa @@ -76,7 +75,7 @@ def reverse(*args, **kwargs): return the result of calling reverse._transform_url(reversed_url) for every url in the wiki namespace. """ - if isinstance(args[0], string_types) and args[0].startswith('wiki:'): + if isinstance(args[0], str) and args[0].startswith('wiki:'): url_kwargs = kwargs.get('kwargs', {}) path = url_kwargs.get('path', False) # If a path is supplied then discard the article_id @@ -95,7 +94,7 @@ def reverse(*args, **kwargs): # Now we redefine reverse method -reverse_lazy = lazy(reverse, text_type) +reverse_lazy = lazy(reverse, str) urlresolvers.reverse = reverse urlresolvers.reverse_lazy = reverse_lazy diff --git a/src/wiki/plugins/macros/mdx/macro.py b/src/wiki/plugins/macros/mdx/macro.py index 85e36acf..4030d4e5 100644 --- a/src/wiki/plugins/macros/mdx/macro.py +++ b/src/wiki/plugins/macros/mdx/macro.py @@ -3,7 +3,6 @@ import re import markdown from django.template.loader import render_to_string from django.utils.translation import gettext as _ -from django.utils.six import string_types from wiki.plugins.macros import settings # See: @@ -51,7 +50,7 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor): value = kwarg.group('value') if value is None: value = True - if isinstance(value, string_types): + if isinstance(value, str): # If value is enclosed with ': Remove and # remove escape sequences if value.startswith("'") and len(value) > 2: diff --git a/tests/core/test_template_tags.py b/tests/core/test_template_tags.py index 18d7026f..52e38151 100644 --- a/tests/core/test_template_tags.py +++ b/tests/core/test_template_tags.py @@ -4,7 +4,6 @@ Almost all test cases covers both tag calling and template using. from django.conf import settings as django_settings from django.contrib.contenttypes.models import ContentType from django.http import HttpRequest -from django.utils.six import assertCountEqual from wiki.conf import settings from wiki.forms import CreateRootForm @@ -168,7 +167,7 @@ class WikiRenderTest(TemplateTestCase): output = wiki_render({}, article) - assertCountEqual(self, self.keys, output) + self.assertCountEqual(self.keys, output) self.assertEqual(output['article'], article) self.assertIsNone(output['content']) @@ -207,7 +206,7 @@ class WikiRenderTest(TemplateTestCase): registry._cache = {'spam': 'eggs'} output = wiki_render({}, article, preview_content=content) - assertCountEqual(self, self.keys, output) + self.assertCountEqual(self.keys, output) self.assertEqual(output['article'], article) self.assertMultiLineEqual(output['content'], expected_markdown) self.assertIs(output['preview'], True) @@ -236,7 +235,7 @@ class WikiRenderTest(TemplateTestCase): output = wiki_render({}, article, preview_content=content) - assertCountEqual(self, self.keys, output) + self.assertCountEqual(self.keys, output) self.assertEqual(output['article'], article) -- 2.45.2