Skip to content

Commit

Permalink
feat: remove future dependency
Browse files Browse the repository at this point in the history
And __future__ imports too
  • Loading branch information
jerivas committed Sep 9, 2020
1 parent 1a818fa commit d4db5e6
Show file tree
Hide file tree
Showing 22 changed files with 1 addition and 50 deletions.
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from __future__ import unicode_literals

from datetime import datetime
import sys
import os
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/accounts/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from django.conf.urls import url

from mezzanine.accounts import views
Expand Down
1 change: 0 additions & 1 deletion mezzanine/bin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""
Provides scripts for building and working with Mezzanine.
"""
from __future__ import unicode_literals
2 changes: 0 additions & 2 deletions mezzanine/boot/lazy_admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from django.conf import settings
from django.conf.urls import include, url
from django.contrib.auth import get_user_model
Expand Down
5 changes: 0 additions & 5 deletions mezzanine/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
or Django itself. Settings can also be made editable via the admin.
"""

from __future__ import unicode_literals
from weakref import WeakKeyDictionary
from future.builtins import bytes, str

from functools import partial
from importlib import import_module
Expand Down Expand Up @@ -63,9 +61,6 @@ def register_setting(
if label is None:
label = name.replace("_", " ").title()

# Python 2/3 compatibility. isinstance() is overridden by future
# on Python 2 to behave as Python 3 in conjunction with either
# Python 2's native types or the future.builtins types.
if isinstance(default, bool):
# Prevent bools treated as ints
setting_type = bool
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/conf/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from warnings import warn

from django.utils.encoding import python_2_unicode_compatible
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from copy import deepcopy

from django.contrib import admin
Expand Down
3 changes: 0 additions & 3 deletions mezzanine/core/templatetags/mezzanine_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import absolute_import, division, unicode_literals
from future.builtins import int, open, str

from hashlib import md5
import os

Expand Down
2 changes: 0 additions & 2 deletions mezzanine/forms/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
Expand Down
3 changes: 0 additions & 3 deletions mezzanine/pages/templatetags/pages_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import unicode_literals
from future.builtins import str

from collections import defaultdict

from django.core.exceptions import ImproperlyConfigured
Expand Down
3 changes: 0 additions & 3 deletions mezzanine/project_template/fabfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import print_function, unicode_literals
from future.builtins import open

import os
import re
import sys
Expand Down
1 change: 0 additions & 1 deletion mezzanine/project_template/project_name/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, unicode_literals
import os

from django import VERSION as DJANGO_VERSION
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/template/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from functools import wraps
import warnings

Expand Down
2 changes: 0 additions & 2 deletions mezzanine/twitter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
Provides models and utilities for displaying different types of Twitter feeds.
"""
from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _

from mezzanine import __version__ # noqa
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/twitter/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import truncatechars
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/twitter/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""
from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting
from mezzanine.twitter import QUERY_TYPE_CHOICES, QUERY_TYPE_SEARCH
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/twitter/management/commands/poll_twitter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function, unicode_literals

from django.core.management.base import BaseCommand
from django import db

Expand Down
2 changes: 0 additions & 2 deletions mezzanine/twitter/managers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from django.db.models import Manager


Expand Down
3 changes: 0 additions & 3 deletions mezzanine/twitter/templatetags/twitter_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import unicode_literals
from future.builtins import int, str

from collections import defaultdict

from mezzanine.conf import settings
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/utils/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import warnings

from future.builtins import int

from datetime import datetime, timedelta

from urllib.parse import urlencode
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ install_requires =
tzlocal >= 2, <3
bleach >= 2, <4
beautifulsoup4 >= 4.5.3
future >= 0.9
requests >= 2.1.0, <3
requests-oauthlib >= 1.3, <2
pillow >= 7, <8
Expand Down
5 changes: 1 addition & 4 deletions tests/test_generic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.template import Context
from django.template import Template
from future.utils import native_str

from unittest import skipUnless

Expand Down Expand Up @@ -33,9 +32,7 @@ def test_rating(self):
for value in settings.RATINGS_RANGE:
data["value"] = value
response = self.client.post(reverse("rating"), data=data)
# Django doesn't seem to support unicode cookie keys correctly on
# Python 2. See https://code.djangoproject.com/ticket/19802
response.delete_cookie(native_str("mezzanine-rating"))
response.delete_cookie("mezzanine-rating")
blog_post = BlogPost.objects.get(id=blog_post.id)
count = len(settings.RATINGS_RANGE)
_sum = sum(settings.RATINGS_RANGE)
Expand Down

0 comments on commit d4db5e6

Please sign in to comment.