Skip to content

Commit c11456c

Browse files
committed
Remove the need for six, as future.utils also provides these utils
1 parent 535b077 commit c11456c

File tree

9 files changed

+15
-17
lines changed

9 files changed

+15
-17
lines changed

docs/_ext/djangodummy/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ django-polymorphic == 2.1.1
88
django-tag-parser == 3.1
99
sphinxcontrib-django == 0.4
1010
future == 0.17.1
11-
six == 1.12.0

fluent_contents/extensions/pluginpool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"""
55
from threading import Lock
66

7-
import six
87
from django.contrib.contenttypes.models import ContentType
98
from django.core.exceptions import ImproperlyConfigured
9+
from future.utils import string_types
1010
from fluent_utils.load import import_apps_submodule
1111
from future.builtins import str
1212

@@ -152,7 +152,7 @@ def get_plugins_by_name(self, *names):
152152
self._import_plugins()
153153
plugin_instances = []
154154
for name in names:
155-
if isinstance(name, six.string_types):
155+
if isinstance(name, string_types):
156156
try:
157157
plugin_instances.append(self.plugins[name.lower()])
158158
except KeyError:

fluent_contents/management/commands/find_contentitem_urls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
from django.core.management.base import BaseCommand
66
from django.db import ProgrammingError, models
77
from django.db.models import Q
8-
from django.utils import six, translation
8+
from django.utils import translation
99
from django.utils.encoding import force_text
10+
from future.utils import text_type
1011
from html5lib import HTMLParser, treebuilders
1112

1213
from fluent_contents.extensions import (
@@ -124,7 +125,7 @@ def inspect_model(self, model):
124125
for field in url_fields:
125126
value = getattr(object, field.name)
126127
if value:
127-
if isinstance(value, six.text_type):
128+
if isinstance(value, text_type):
128129
value = force_text(value)
129130
else:
130131
value = value.to_db_value() # AnyUrlValue

fluent_contents/models/managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""
22
The manager classes are accessed via ``Placeholder.objects``.
33
"""
4-
import six
54
from django.conf import settings
65
from django.contrib.contenttypes.models import ContentType
76
from django.db import models
87
from django.utils.translation import get_language
98
from future.builtins import str
9+
from future.utils import string_types
1010
from parler import appsettings as parler_appsettings
1111
from parler.utils import get_language_title
1212
from polymorphic.managers import PolymorphicManager
@@ -71,7 +71,7 @@ def translated(self, *language_codes):
7171
# Since some code operates on a True/str switch, make sure that doesn't drip into this low level code.
7272
for language_code in language_codes:
7373
if not isinstance(
74-
language_code, six.string_types
74+
language_code, string_types
7575
) or language_code.lower() in ("1", "0", "true", "false"):
7676
raise ValueError(
7777
"ContentItemQuerySet.translated() expected language_code to be an ISO code"

fluent_contents/rendering/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22

3-
import six
43
from django.conf import settings
54
from django.core.cache import cache
65
from django.db.models.query import EmptyQuerySet
@@ -9,6 +8,7 @@
98
from django.utils.html import escape
109
from django.utils.safestring import mark_safe
1110
from future.builtins import str
11+
from future.utils import integer_types
1212
from parler.utils.context import smart_override
1313

1414
from fluent_contents import appsettings
@@ -587,10 +587,10 @@ def _get_stale_item_class_name(item):
587587
def _min_timeout(val1, val2):
588588
# Avoid min(int, object). That may work but it's
589589
# a CPython implementation detail to compare that as "int" < "object"
590-
if not isinstance(val2, six.integer_types):
590+
if not isinstance(val2, integer_types):
591591
return val1
592592

593-
if not isinstance(val1, six.integer_types):
593+
if not isinstance(val1, integer_types):
594594
return val2
595595

596596
return min(val1, val2)

fluent_contents/rendering/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import os
66

77
import django
8-
import six
98
from django.conf import settings
109
from django.contrib.sites.models import Site
1110
from django.core.cache import cache
1211
from django.template.backends.django import Template as TemplateAdapter
1312
from django.template.loader import select_template
1413
from django.test import RequestFactory
1514
from django.utils.translation import get_language
15+
from future.utils import string_types
1616

1717
from fluent_contents.extensions import ContentPlugin
1818

@@ -109,7 +109,7 @@ def is_template_updated(request, contentitem, cachekey):
109109

110110
if not template_names:
111111
return False
112-
if isinstance(template_names, six.string_types):
112+
if isinstance(template_names, string_types):
113113
template_names = [template_names]
114114

115115
# With TEMPLATE_DEBUG = True, each node tracks it's origin.

fluent_contents/templatetags/fluent_contents_tags.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
2424
The CMS interface can scan for those tags using the :ref:`fluent_contents.analyzer` module.
2525
"""
26-
import six
2726
from django.conf import settings
2827
from django.db.models import Manager
2928
from django.forms import Media
@@ -470,7 +469,7 @@ def _split_css(media, domain):
470469

471470
needs_local = domain == "local"
472471
new_css = {}
473-
for medium, url in six.iteritems(media._css):
472+
for medium, url in media._css.items():
474473
if needs_local == _is_local(url):
475474
new_css.setdefault(medium, []).append(url)
476475

fluent_contents/utils/search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Internal utils for search.
33
"""
4-
import six
54
from django.utils.encoding import force_text
65
from django.utils.html import strip_tags
6+
from future.utils import string_types
77

88

99
def get_search_field_values(contentitem):
@@ -17,7 +17,7 @@ def get_search_field_values(contentitem):
1717

1818
# Just assume all strings may contain HTML.
1919
# Not checking for just the PluginHtmlField here.
20-
if value and isinstance(value, six.string_types):
20+
if value and isinstance(value, string_types):
2121
value = get_cleaned_string(value)
2222

2323
values.append(value)

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def find_version(*parts):
4545
"django-tag-parser>=3.2",
4646
"django-template-analyzer>=1.6.2",
4747
"future>=0.12.2",
48-
"six>=1.5.2",
4948
# Work around https://github.com/html5lib/html5lib-python/issues/189
5049
"html5lib >= 0.999, != 0.9999, != 1.0b5, != 0.99999, != 1.0b6",
5150
],

0 commit comments

Comments
 (0)