diff --git a/django_enumfield/enum.py b/django_enumfield/enum.py index 2a75a88..4724b39 100644 --- a/django_enumfield/enum.py +++ b/django_enumfield/enum.py @@ -1,7 +1,5 @@ import difflib -import six - from .item import Item @@ -73,7 +71,7 @@ def from_value(self, value): raise ValueError("%r is not a valid value for enum %s" % (value, self.name)) def from_slug(self, slug): - if not isinstance(slug, six.string_types): + if not isinstance(slug, str): raise TypeError("item slug should be a str, not %r" % type(slug)) try: diff --git a/django_enumfield/item.py b/django_enumfield/item.py index e11bb75..8d37bad 100644 --- a/django_enumfield/item.py +++ b/django_enumfield/item.py @@ -1,4 +1,3 @@ -import six import functools from .utils import is_lazy_translation @@ -34,7 +33,7 @@ def __init__(self, value, slug, display=None): if ( display is not None - and not isinstance(display, six.string_types) + and not isinstance(display, str) and not is_lazy_translation(display) ): raise TypeError( @@ -59,11 +58,11 @@ def __eq__(self, other): if isinstance(other, Item): return self.value == other.value - if isinstance(other, six.integer_types + six.string_types): + if isinstance(other, (int, str)): try: return self.value == int(other) except ValueError: - return six.text_type(self.slug) == six.text_type(other) + return str(self.slug) == str(other) return False diff --git a/django_enumfield/utils.py b/django_enumfield/utils.py index 1146eec..031aba2 100644 --- a/django_enumfield/utils.py +++ b/django_enumfield/utils.py @@ -1,5 +1,3 @@ -import six - from django.http import Http404 from django.utils.functional import Promise @@ -42,4 +40,4 @@ def is_lazy_translation(obj): return False resultclasses = obj.__reduce__()[1][3:] - return any(issubclass(x, six.string_types) for x in resultclasses) + return any(issubclass(x, str) for x in resultclasses) diff --git a/tox.ini b/tox.ini index a22cabf..280864e 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,6 @@ commands = coverage erase coverage run --parallel-mode --branch --source ./django_enumfield runtests.py deps = - six coverage django22: django==2.2 django32: django==3.2