Skip to content

Commit

Permalink
Removed __future__ and six usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sdolemelipone committed Dec 8, 2020
1 parent 3ab652d commit 4a91620
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
10 changes: 3 additions & 7 deletions extra_views/contrib/mixins.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from __future__ import unicode_literals

import datetime
import functools
import operator

import six
from django.contrib import messages
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Q
from django.views.generic.base import ContextMixin
from six.moves import reduce

VALID_STRING_LOOKUPS = (
"iexact",
Expand Down Expand Up @@ -61,7 +57,7 @@ def get_words(self, query):
def get_search_fields_with_filters(self):
fields = []
for sf in self.search_fields:
if isinstance(sf, six.string_types):
if isinstance(sf, str):
fields.append((sf, "icontains"))
else:
if self.check_lookups and sf[1] not in VALID_STRING_LOOKUPS:
Expand Down Expand Up @@ -107,8 +103,8 @@ def get_queryset(self):
for field_name in self.search_date_fields
]
)
w_qs.append(reduce(operator.or_, filters))
qs = qs.filter(reduce(operator.and_, w_qs))
w_qs.append(functools.reduce(operator.or_, filters))
qs = qs.filter(functools.reduce(operator.and_, w_qs))
qs = qs.distinct()
return qs

Expand Down
10 changes: 1 addition & 9 deletions extra_views/dates.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from __future__ import unicode_literals

import datetime
import math
from calendar import Calendar
from collections import defaultdict

from django.core.exceptions import ImproperlyConfigured
from django.db.models import Q
# Remove check when support for python < 3 is dropped.
# https://docs.djangoproject.com/en/3.0/releases/3.0/#features-deprecated-in-3-0
import sys
if sys.version_info[0] >= 3:
from django.utils.translation import gettext_lazy as _
else:
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.generic.dates import (
DateMixin,
MonthMixin,
Expand Down
2 changes: 0 additions & 2 deletions extra_views_tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

import datetime
from decimal import Decimal as D
from unittest import expectedFailure
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
name="django-extra-views",
version=VERSION,
url="https://github.com/AndrewIngram/django-extra-views",
install_requires=["Django >=1.11", "six>=1.5.2"],
install_requires=["Django >=1.11"],
description="Extra class-based views for Django",
long_description=open("README.rst", "r").read(),
license="MIT",
Expand Down

0 comments on commit 4a91620

Please sign in to comment.