aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin')
-rw-r--r--mediagoblin/_compat.py13
-rw-r--r--mediagoblin/auth/tools.py1
-rw-r--r--mediagoblin/auth/views.py2
-rw-r--r--mediagoblin/db/base.py5
-rw-r--r--mediagoblin/db/migrations.py2
-rw-r--r--mediagoblin/db/models.py3
-rw-r--r--mediagoblin/db/open.py1
-rw-r--r--mediagoblin/decorators.py2
-rw-r--r--mediagoblin/edit/views.py4
-rw-r--r--mediagoblin/gmg_commands/__init__.py2
-rw-r--r--mediagoblin/gmg_commands/addmedia.py4
-rw-r--r--mediagoblin/gmg_commands/batchaddmedia.py8
-rw-r--r--mediagoblin/gmg_commands/dbupdate.py1
-rw-r--r--mediagoblin/gmg_commands/users.py2
-rw-r--r--mediagoblin/gmg_commands/util.py4
-rw-r--r--mediagoblin/init/celery/__init__.py2
-rw-r--r--mediagoblin/media_types/ascii/processing.py2
-rw-r--r--mediagoblin/media_types/audio/processing.py2
-rw-r--r--mediagoblin/media_types/blog/views.py2
-rw-r--r--mediagoblin/media_types/image/processing.py2
-rw-r--r--mediagoblin/media_types/video/processing.py2
-rw-r--r--mediagoblin/mg_globals.py2
-rw-r--r--mediagoblin/moderation/tools.py2
-rw-r--r--mediagoblin/oauth/views.py2
-rw-r--r--mediagoblin/plugins/api/tools.py2
-rw-r--r--mediagoblin/plugins/api/views.py2
-rw-r--r--mediagoblin/plugins/archivalook/tools.py2
-rw-r--r--mediagoblin/plugins/basic_auth/tools.py2
-rw-r--r--mediagoblin/plugins/httpapiauth/__init__.py2
-rw-r--r--mediagoblin/plugins/ldap/tools.py2
-rw-r--r--mediagoblin/plugins/ldap/views.py2
-rw-r--r--mediagoblin/plugins/openid/store.py2
-rw-r--r--mediagoblin/plugins/openid/views.py2
-rw-r--r--mediagoblin/plugins/persona/views.py2
-rw-r--r--mediagoblin/plugins/piwigo/tools.py1
-rw-r--r--mediagoblin/plugins/piwigo/views.py2
-rw-r--r--mediagoblin/plugins/subtitles/views.py2
-rw-r--r--mediagoblin/processing/__init__.py2
-rw-r--r--mediagoblin/processing/task.py2
-rw-r--r--mediagoblin/storage/__init__.py2
-rw-r--r--mediagoblin/storage/filestorage.py2
-rw-r--r--mediagoblin/storage/mountstorage.py2
-rw-r--r--mediagoblin/submit/lib.py2
-rw-r--r--mediagoblin/submit/views.py2
-rw-r--r--mediagoblin/tests/test_auth.py4
-rw-r--r--mediagoblin/tests/test_basic_auth.py2
-rw-r--r--mediagoblin/tests/test_edit.py4
-rw-r--r--mediagoblin/tests/test_ldap.py3
-rw-r--r--mediagoblin/tests/test_notifications.py2
-rw-r--r--mediagoblin/tests/test_oauth1.py2
-rw-r--r--mediagoblin/tests/test_openid.py3
-rw-r--r--mediagoblin/tests/test_persona.py3
-rw-r--r--mediagoblin/tests/test_privileges.py23
-rw-r--r--mediagoblin/tests/test_reporting.py2
-rw-r--r--mediagoblin/tests/test_sql_migrations.py2
-rw-r--r--mediagoblin/tests/test_storage.py2
-rw-r--r--mediagoblin/tests/test_submission.py9
-rw-r--r--mediagoblin/tests/test_util.py2
-rw-r--r--mediagoblin/tests/tools.py2
-rw-r--r--mediagoblin/tools/exif.py2
-rw-r--r--mediagoblin/tools/files.py2
-rw-r--r--mediagoblin/tools/mail.py1
-rw-r--r--mediagoblin/tools/pagination.py2
-rw-r--r--mediagoblin/tools/processing.py2
-rw-r--r--mediagoblin/tools/request.py1
-rw-r--r--mediagoblin/tools/response.py1
-rw-r--r--mediagoblin/tools/routing.py4
-rw-r--r--mediagoblin/tools/staticdirect.py2
-rw-r--r--mediagoblin/tools/template.py2
-rw-r--r--mediagoblin/tools/translate.py7
-rw-r--r--mediagoblin/tools/url.py2
-rw-r--r--mediagoblin/tools/validator.py2
-rw-r--r--mediagoblin/tools/workbench.py2
-rw-r--r--mediagoblin/user_pages/views.py2
74 files changed, 35 insertions, 175 deletions
diff --git a/mediagoblin/_compat.py b/mediagoblin/_compat.py
index c992f44e..09270ab4 100644
--- a/mediagoblin/_compat.py
+++ b/mediagoblin/_compat.py
@@ -1,15 +1,11 @@
import functools
import warnings
-import six
-
from email.mime.text import MIMEText
def encode_to_utf8(method):
def wrapper(self):
- if six.PY2 and isinstance(method(self), str):
- return method(self).encode('utf-8')
return method(self)
functools.update_wrapper(wrapper, method, ['__name__', '__doc__'])
return wrapper
@@ -17,13 +13,4 @@ def encode_to_utf8(method):
# based on django.utils.encoding.python_2_unicode_compatible
def py2_unicode(klass):
- if six.PY2:
- if '__str__' not in klass.__dict__:
- warnings.warn("@py2_unicode cannot be applied "
- "to %s because it doesn't define __str__()." %
- klass.__name__)
- klass.__unicode__ = klass.__str__
- klass.__str__ = encode_to_utf8(klass.__unicode__)
- if '__repr__' in klass.__dict__:
- klass.__repr__ = encode_to_utf8(klass.__repr__)
return klass
diff --git a/mediagoblin/auth/tools.py b/mediagoblin/auth/tools.py
index 0312cc8f..3ab9be37 100644
--- a/mediagoblin/auth/tools.py
+++ b/mediagoblin/auth/tools.py
@@ -17,7 +17,6 @@
import logging
-import six
import wtforms
from sqlalchemy import or_
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py
index 08228d1b..c1d9cb7f 100644
--- a/mediagoblin/auth/views.py
+++ b/mediagoblin/auth/views.py
@@ -16,8 +16,6 @@
import logging
-import six
-
from itsdangerous import BadSignature
from mediagoblin import messages, mg_globals
diff --git a/mediagoblin/db/base.py b/mediagoblin/db/base.py
index d2595ce2..deae2a01 100644
--- a/mediagoblin/db/base.py
+++ b/mediagoblin/db/base.py
@@ -13,7 +13,6 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
import copy
from sqlalchemy.ext.declarative import declarative_base
@@ -41,14 +40,14 @@ class FakeCursor:
return FakeCursor(copy.copy(self.cursor), self.mapper, self.filter)
def __iter__(self):
- return six.moves.filter(self.filter, six.moves.map(self.mapper, self.cursor))
+ return filter(self.filter, map(self.mapper, self.cursor))
def __getitem__(self, key):
return self.mapper(self.cursor[key])
def slice(self, *args, **kwargs):
r = self.cursor.slice(*args, **kwargs)
- return list(six.moves.filter(self.filter, six.moves.map(self.mapper, r)))
+ return list(filter(self.filter, map(self.mapper, r)))
class GMGTableBase:
# Deletion types
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index e6a80310..6c5b027c 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -18,8 +18,6 @@
import datetime
import uuid
-import six
-
try:
import migrate
except ImportError:
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 11d7b275..c5809185 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -44,8 +44,7 @@ from mediagoblin.tools.common import import_component
from mediagoblin.tools.routing import extract_url_arguments
from mediagoblin.tools.text import convert_to_tag_list_of_dicts
-import six
-from six.moves.urllib.parse import urljoin
+from urllib.parse import urljoin
from pytz import UTC
_log = logging.getLogger(__name__)
diff --git a/mediagoblin/db/open.py b/mediagoblin/db/open.py
index 3252f175..6cdf2fbb 100644
--- a/mediagoblin/db/open.py
+++ b/mediagoblin/db/open.py
@@ -18,7 +18,6 @@
from contextlib import contextmanager
import logging
-import six
from sqlalchemy import create_engine, event
from mediagoblin import mg_globals
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index d64992df..4fc510ff 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -19,7 +19,7 @@ from functools import wraps
from werkzeug.exceptions import Forbidden, NotFound
from oauthlib.oauth1 import ResourceEndpoint
-from six.moves.urllib.parse import urljoin
+from urllib.parse import urljoin
from mediagoblin import mg_globals as mgg
from mediagoblin import messages
diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py
index 202d42a2..5b9dc7b2 100644
--- a/mediagoblin/edit/views.py
+++ b/mediagoblin/edit/views.py
@@ -13,8 +13,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from datetime import datetime
from itsdangerous import BadSignature
@@ -537,4 +535,4 @@ def edit_metadata(request, media):
request,
'mediagoblin/edit/metadata.html',
{'form':form,
- 'media':media}) \ No newline at end of file
+ 'media':media})
diff --git a/mediagoblin/gmg_commands/__init__.py b/mediagoblin/gmg_commands/__init__.py
index 963c3952..47ebd0c9 100644
--- a/mediagoblin/gmg_commands/__init__.py
+++ b/mediagoblin/gmg_commands/__init__.py
@@ -18,8 +18,6 @@ import argparse
import os
import shutil
-import six
-
from mediagoblin.tools.common import import_component
import logging
diff --git a/mediagoblin/gmg_commands/addmedia.py b/mediagoblin/gmg_commands/addmedia.py
index fbec7071..f8bd1715 100644
--- a/mediagoblin/gmg_commands/addmedia.py
+++ b/mediagoblin/gmg_commands/addmedia.py
@@ -17,8 +17,6 @@
import os
-import six
-
from mediagoblin.db.models import LocalUser
from mediagoblin.gmg_commands import util as commands_util
from mediagoblin.submit.lib import (
@@ -93,8 +91,6 @@ def addmedia(args):
# this is kinda terrible
if some_string is None:
return None
- if six.PY2:
- return str(some_string, 'utf-8')
return some_string
try:
diff --git a/mediagoblin/gmg_commands/batchaddmedia.py b/mediagoblin/gmg_commands/batchaddmedia.py
index 86c9425f..8c5b8a09 100644
--- a/mediagoblin/gmg_commands/batchaddmedia.py
+++ b/mediagoblin/gmg_commands/batchaddmedia.py
@@ -21,8 +21,7 @@ import shutil
import tempfile
import requests
-import six
-from six.moves.urllib.parse import urlparse
+from urllib.parse import urlparse
from mediagoblin.db.models import LocalUser, MediaEntry
from mediagoblin.gmg_commands import util as commands_util
@@ -86,9 +85,6 @@ def batchaddmedia(args):
all_metadata = open(abs_metadata_filename)
media_metadata = csv.DictReader(all_metadata)
for index, file_metadata in enumerate(media_metadata):
- if six.PY2:
- file_metadata = {k.decode('utf-8'): v.decode('utf-8') for k, v in file_metadata.items()}
-
files_attempted += 1
# In case the metadata was not uploaded initialize an empty dictionary.
json_ld_metadata = compact_and_validate({})
@@ -146,8 +142,6 @@ Metadata was not uploaded.""".format(
# `batchaddmedia` to upload a file larger than 200MB.
media_file = tempfile.TemporaryFile()
shutil.copyfileobj(res.raw, media_file)
- if six.PY2:
- media_file.seek(0)
elif url.scheme == '':
path = url.path
diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py
index 988c0e26..c62de91e 100644
--- a/mediagoblin/gmg_commands/dbupdate.py
+++ b/mediagoblin/gmg_commands/dbupdate.py
@@ -16,7 +16,6 @@
import logging
-import six
from alembic import command
from sqlalchemy.orm import sessionmaker
diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py
index b61a5571..4d4740ca 100644
--- a/mediagoblin/gmg_commands/users.py
+++ b/mediagoblin/gmg_commands/users.py
@@ -17,8 +17,6 @@
import sys
-import six
-
from mediagoblin.db.models import LocalUser
from mediagoblin.gmg_commands import util as commands_util
from mediagoblin import auth
diff --git a/mediagoblin/gmg_commands/util.py b/mediagoblin/gmg_commands/util.py
index f27a9535..15300ace 100644
--- a/mediagoblin/gmg_commands/util.py
+++ b/mediagoblin/gmg_commands/util.py
@@ -18,8 +18,6 @@
from mediagoblin import app
import getpass
-import six
-
def setup_app(args):
"""
@@ -35,7 +33,7 @@ def prompt_if_not_set(variable, text, password=False):
"""
if variable is None:
if not password:
- variable = six.moves.input(text + ' ')
+ variable = input(text + ' ')
else:
variable=getpass.getpass(text + ' ')
diff --git a/mediagoblin/init/celery/__init__.py b/mediagoblin/init/celery/__init__.py
index 26f7cb61..4dfe51b9 100644
--- a/mediagoblin/init/celery/__init__.py
+++ b/mediagoblin/init/celery/__init__.py
@@ -19,8 +19,6 @@ import sys
import datetime
import logging
-import six
-
from celery import Celery
from kombu import Exchange, Queue
from mediagoblin.tools.pluginapi import hook_runall
diff --git a/mediagoblin/media_types/ascii/processing.py b/mediagoblin/media_types/ascii/processing.py
index 3c24360d..6c5f3365 100644
--- a/mediagoblin/media_types/ascii/processing.py
+++ b/mediagoblin/media_types/ascii/processing.py
@@ -22,8 +22,6 @@ except ImportError:
import Image
import logging
-import six
-
from mediagoblin import mg_globals as mgg
from mediagoblin.processing import (
create_pub_filepath, FilenameBuilder,
diff --git a/mediagoblin/media_types/audio/processing.py b/mediagoblin/media_types/audio/processing.py
index e2dc8937..0b06c529 100644
--- a/mediagoblin/media_types/audio/processing.py
+++ b/mediagoblin/media_types/audio/processing.py
@@ -18,8 +18,6 @@ import argparse
import logging
import os
-import six
-
from mediagoblin import mg_globals as mgg
from mediagoblin.processing import (
BadMediaFail, FilenameBuilder,
diff --git a/mediagoblin/media_types/blog/views.py b/mediagoblin/media_types/blog/views.py
index 00c583b2..b9ddbe6e 100644
--- a/mediagoblin/media_types/blog/views.py
+++ b/mediagoblin/media_types/blog/views.py
@@ -19,8 +19,6 @@ _log = logging.getLogger(__name__)
from datetime import datetime
-import six
-
from werkzeug.exceptions import Forbidden
from mediagoblin.tools import pluginapi
diff --git a/mediagoblin/media_types/image/processing.py b/mediagoblin/media_types/image/processing.py
index 8f227edc..95023731 100644
--- a/mediagoblin/media_types/image/processing.py
+++ b/mediagoblin/media_types/image/processing.py
@@ -23,8 +23,6 @@ import os
import logging
import argparse
-import six
-
from mediagoblin import mg_globals as mgg
from mediagoblin.db.models import Location
from mediagoblin.processing import (
diff --git a/mediagoblin/media_types/video/processing.py b/mediagoblin/media_types/video/processing.py
index 0aa70a93..466ab194 100644
--- a/mediagoblin/media_types/video/processing.py
+++ b/mediagoblin/media_types/video/processing.py
@@ -20,8 +20,6 @@ import logging
import datetime
import celery
-import six
-
from celery import group
from mediagoblin import mg_globals as mgg
from mediagoblin.processing import (
diff --git a/mediagoblin/mg_globals.py b/mediagoblin/mg_globals.py
index 4bd08ab0..4146bec7 100644
--- a/mediagoblin/mg_globals.py
+++ b/mediagoblin/mg_globals.py
@@ -21,8 +21,6 @@ import gettext
import pkg_resources
import threading
-import six
-
#############################
# General mediagoblin globals
#############################
diff --git a/mediagoblin/moderation/tools.py b/mediagoblin/moderation/tools.py
index 2e85a238..de7b6ed9 100644
--- a/mediagoblin/moderation/tools.py
+++ b/mediagoblin/moderation/tools.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from mediagoblin import mg_globals
from mediagoblin.db.models import User, Privilege, UserBan, LocalUser
from mediagoblin.db.base import Session
diff --git a/mediagoblin/oauth/views.py b/mediagoblin/oauth/views.py
index 97426f22..41652172 100644
--- a/mediagoblin/oauth/views.py
+++ b/mediagoblin/oauth/views.py
@@ -17,8 +17,6 @@
import datetime
import urllib
-import six
-
from oauthlib.oauth1.rfc5849.utils import UNICODE_ASCII_CHARACTER_SET
from oauthlib.oauth1 import (RequestTokenEndpoint, AuthorizationEndpoint,
AccessTokenEndpoint)
diff --git a/mediagoblin/plugins/api/tools.py b/mediagoblin/plugins/api/tools.py
index eff9009d..954b6e8b 100644
--- a/mediagoblin/plugins/api/tools.py
+++ b/mediagoblin/plugins/api/tools.py
@@ -21,7 +21,7 @@ from functools import wraps
from werkzeug.exceptions import Forbidden
from werkzeug.wrappers import Response
-from six.moves.urllib.parse import urljoin
+from urllib.parse import urljoin
from mediagoblin import mg_globals
from mediagoblin.tools.pluginapi import PluginManager
diff --git a/mediagoblin/plugins/api/views.py b/mediagoblin/plugins/api/views.py
index 84f919b4..85254a8c 100644
--- a/mediagoblin/plugins/api/views.py
+++ b/mediagoblin/plugins/api/views.py
@@ -17,8 +17,6 @@
import json
import logging
-import six
-
from werkzeug.exceptions import BadRequest
from werkzeug.wrappers import Response
diff --git a/mediagoblin/plugins/archivalook/tools.py b/mediagoblin/plugins/archivalook/tools.py
index 47eec7dc..a7d3e1f4 100644
--- a/mediagoblin/plugins/archivalook/tools.py
+++ b/mediagoblin/plugins/archivalook/tools.py
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from mediagoblin.db.models import MediaEntry, User, LocalUser
from mediagoblin.plugins.archivalook.models import FeaturedMedia
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
diff --git a/mediagoblin/plugins/basic_auth/tools.py b/mediagoblin/plugins/basic_auth/tools.py
index ad3cb1b0..3e807297 100644
--- a/mediagoblin/plugins/basic_auth/tools.py
+++ b/mediagoblin/plugins/basic_auth/tools.py
@@ -16,8 +16,6 @@
import bcrypt
import random
-import six
-
from mediagoblin import mg_globals
from mediagoblin.tools.crypto import get_timed_signer_url
from mediagoblin.tools.mail import send_email
diff --git a/mediagoblin/plugins/httpapiauth/__init__.py b/mediagoblin/plugins/httpapiauth/__init__.py
index 505cea5d..c670b70d 100644
--- a/mediagoblin/plugins/httpapiauth/__init__.py
+++ b/mediagoblin/plugins/httpapiauth/__init__.py
@@ -16,8 +16,6 @@
import logging
-import six
-
from werkzeug.exceptions import Unauthorized
from mediagoblin.auth.tools import check_login_simple
diff --git a/mediagoblin/plugins/ldap/tools.py b/mediagoblin/plugins/ldap/tools.py
index 89ac8c11..c928ee7c 100644
--- a/mediagoblin/plugins/ldap/tools.py
+++ b/mediagoblin/plugins/ldap/tools.py
@@ -16,8 +16,6 @@
import ldap
import logging
-import six
-
from mediagoblin.tools import pluginapi
_log = logging.getLogger(__name__)
diff --git a/mediagoblin/plugins/ldap/views.py b/mediagoblin/plugins/ldap/views.py
index 99ecb456..94af5465 100644
--- a/mediagoblin/plugins/ldap/views.py
+++ b/mediagoblin/plugins/ldap/views.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from mediagoblin import mg_globals, messages
from mediagoblin.auth.tools import register_user
from mediagoblin.db.models import User, LocalUser
diff --git a/mediagoblin/plugins/openid/store.py b/mediagoblin/plugins/openid/store.py
index dd794786..62a43e93 100644
--- a/mediagoblin/plugins/openid/store.py
+++ b/mediagoblin/plugins/openid/store.py
@@ -16,8 +16,6 @@
import base64
import time
-import six
-
from openid.association import Association as OIDAssociation
from openid.store.interface import OpenIDStore
from openid.store import nonce
diff --git a/mediagoblin/plugins/openid/views.py b/mediagoblin/plugins/openid/views.py
index 03dee7d4..e1156ee9 100644
--- a/mediagoblin/plugins/openid/views.py
+++ b/mediagoblin/plugins/openid/views.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from openid.consumer import consumer
from openid.consumer.discover import DiscoveryFailure
from openid.extensions.sreg import SRegRequest, SRegResponse
diff --git a/mediagoblin/plugins/persona/views.py b/mediagoblin/plugins/persona/views.py
index 3f1f1afb..d97429be 100644
--- a/mediagoblin/plugins/persona/views.py
+++ b/mediagoblin/plugins/persona/views.py
@@ -17,8 +17,6 @@ import json
import logging
import requests
-import six
-
from werkzeug.exceptions import BadRequest
from mediagoblin import messages, mg_globals
diff --git a/mediagoblin/plugins/piwigo/tools.py b/mediagoblin/plugins/piwigo/tools.py
index 7b3e931a..dadd3e77 100644
--- a/mediagoblin/plugins/piwigo/tools.py
+++ b/mediagoblin/plugins/piwigo/tools.py
@@ -17,7 +17,6 @@
from collections import namedtuple
import logging
-import six
import lxml.etree as ET
from werkzeug.exceptions import MethodNotAllowed, BadRequest
diff --git a/mediagoblin/plugins/piwigo/views.py b/mediagoblin/plugins/piwigo/views.py
index ecc7054e..bd1265c5 100644
--- a/mediagoblin/plugins/piwigo/views.py
+++ b/mediagoblin/plugins/piwigo/views.py
@@ -17,8 +17,6 @@
import logging
import re
-import six
-
from werkzeug.exceptions import MethodNotAllowed, BadRequest, NotImplemented
from werkzeug.wrappers import BaseResponse
diff --git a/mediagoblin/plugins/subtitles/views.py b/mediagoblin/plugins/subtitles/views.py
index 7ca45329..75090ea0 100644
--- a/mediagoblin/plugins/subtitles/views.py
+++ b/mediagoblin/plugins/subtitles/views.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from datetime import datetime
from itsdangerous import BadSignature
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py
index f9289d14..540c8304 100644
--- a/mediagoblin/processing/__init__.py
+++ b/mediagoblin/processing/__init__.py
@@ -24,8 +24,6 @@ except:
import logging
import os
-import six
-
from mediagoblin import mg_globals as mgg
from mediagoblin.db.util import atomic_update
from mediagoblin.db.models import MediaEntry
diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py
index c62293e8..9951c756 100644
--- a/mediagoblin/processing/task.py
+++ b/mediagoblin/processing/task.py
@@ -16,7 +16,7 @@
import logging
-from six.moves.urllib import request, parse
+from urllib import request, parse
import celery
from celery.registry import tasks
diff --git a/mediagoblin/storage/__init__.py b/mediagoblin/storage/__init__.py
index bd6bad02..8060bb9a 100644
--- a/mediagoblin/storage/__init__.py
+++ b/mediagoblin/storage/__init__.py
@@ -18,8 +18,6 @@
import shutil
import uuid
-import six
-
from werkzeug.utils import secure_filename
from mediagoblin.tools import common
diff --git a/mediagoblin/storage/filestorage.py b/mediagoblin/storage/filestorage.py
index fe0d3c11..6e4a60fd 100644
--- a/mediagoblin/storage/filestorage.py
+++ b/mediagoblin/storage/filestorage.py
@@ -18,7 +18,7 @@ import io
import os
import shutil
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
from mediagoblin.storage import (
StorageInterface,
diff --git a/mediagoblin/storage/mountstorage.py b/mediagoblin/storage/mountstorage.py
index 66ae7c3c..fad3e943 100644
--- a/mediagoblin/storage/mountstorage.py
+++ b/mediagoblin/storage/mountstorage.py
@@ -15,8 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from mediagoblin.storage import StorageInterface, clean_listy_filepath
diff --git a/mediagoblin/submit/lib.py b/mediagoblin/submit/lib.py
index ad08e14f..6580a6c1 100644
--- a/mediagoblin/submit/lib.py
+++ b/mediagoblin/submit/lib.py
@@ -18,8 +18,6 @@ import logging
import uuid
from os.path import splitext
-import six
-
from celery import chord
from werkzeug.utils import secure_filename
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index db7ad82a..6446edd3 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from mediagoblin import messages
import mediagoblin.mg_globals as mg_globals
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index dafaa1e7..c5218050 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -17,9 +17,7 @@
import pkg_resources
import pytest
-import six
-
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
from mediagoblin import mg_globals
from mediagoblin.db.models import User, LocalUser
diff --git a/mediagoblin/tests/test_basic_auth.py b/mediagoblin/tests/test_basic_auth.py
index f7553fe1..444bb1aa 100644
--- a/mediagoblin/tests/test_basic_auth.py
+++ b/mediagoblin/tests/test_basic_auth.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
from mediagoblin.db.models import User, LocalUser
from mediagoblin.plugins.basic_auth import tools as auth_tools
diff --git a/mediagoblin/tests/test_edit.py b/mediagoblin/tests/test_edit.py
index c2cee048..424796e8 100644
--- a/mediagoblin/tests/test_edit.py
+++ b/mediagoblin/tests/test_edit.py
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
import pytest
from mediagoblin import mg_globals
@@ -206,7 +205,6 @@ class TestMetaDataEdit:
context_data = context_data[key]
return response, context_data
- @pytest.mark.skipif(six.PY2, reason='Breaks in Python 2 but seems non-critical')
def test_edit_metadata(self, test_app):
media_entry = fixture_media_entry(uploader=self.user.id,
state='processed')
diff --git a/mediagoblin/tests/test_ldap.py b/mediagoblin/tests/test_ldap.py
index 0af1b7f5..7d8f2f34 100644
--- a/mediagoblin/tests/test_ldap.py
+++ b/mediagoblin/tests/test_ldap.py
@@ -16,13 +16,12 @@
import pkg_resources
import pytest
-import six
try:
from unittest import mock
except ImportError:
import unittest.mock as mock
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
from mediagoblin import mg_globals
from mediagoblin.db.base import Session
diff --git a/mediagoblin/tests/test_notifications.py b/mediagoblin/tests/test_notifications.py
index 2bdc4223..d19f2951 100644
--- a/mediagoblin/tests/test_notifications.py
+++ b/mediagoblin/tests/test_notifications.py
@@ -16,7 +16,7 @@
import pytest
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
from mediagoblin.tools import template, mail
diff --git a/mediagoblin/tests/test_oauth1.py b/mediagoblin/tests/test_oauth1.py
index fc4a2b01..345b308e 100644
--- a/mediagoblin/tests/test_oauth1.py
+++ b/mediagoblin/tests/test_oauth1.py
@@ -16,7 +16,7 @@
import pytest
-from six.moves.urllib.parse import parse_qs, urlparse
+from urllib.parse import parse_qs, urlparse
from oauthlib.oauth1 import Client
diff --git a/mediagoblin/tests/test_openid.py b/mediagoblin/tests/test_openid.py
index a0d129a9..8af0894a 100644
--- a/mediagoblin/tests/test_openid.py
+++ b/mediagoblin/tests/test_openid.py
@@ -16,8 +16,7 @@
import pkg_resources
import pytest
-import six
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
try:
from unittest import mock
except ImportError:
diff --git a/mediagoblin/tests/test_persona.py b/mediagoblin/tests/test_persona.py
index 25f0ca1e..6e7ee419 100644
--- a/mediagoblin/tests/test_persona.py
+++ b/mediagoblin/tests/test_persona.py
@@ -16,13 +16,12 @@
import pkg_resources
import pytest
-import six
try:
from unittest import mock
except ImportError:
import unittest.mock as mock
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
pytest.importorskip("requests")
diff --git a/mediagoblin/tests/test_privileges.py b/mediagoblin/tests/test_privileges.py
index b7a9ff3b..ddf2449b 100644
--- a/mediagoblin/tests/test_privileges.py
+++ b/mediagoblin/tests/test_privileges.py
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
import pytest
from datetime import date, timedelta
from webtest import AppError
@@ -128,7 +127,7 @@ class TestPrivilegeFunctionality:
#----------------------------------------------------------------------
with pytest.raises(AppError) as excinfo:
response = self.test_app.get('/submit/')
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
@@ -136,7 +135,7 @@ class TestPrivilegeFunctionality:
response = self.do_post({'upload_files':[('file',GOOD_JPG)],
'title':'Normal Upload 1'},
url='/submit/')
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
# Test that a user cannot comment without the commenter privilege
@@ -159,14 +158,14 @@ class TestPrivilegeFunctionality:
response = self.test_app.post(
media_uri_id + 'comment/add/',
{'comment_content': 'Test comment #42'})
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
# Test that a user cannot report without the reporter privilege
#----------------------------------------------------------------------
with pytest.raises(AppError) as excinfo:
response = self.test_app.get(media_uri_slug+"report/")
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
with pytest.raises(AppError) as excinfo:
@@ -174,7 +173,7 @@ class TestPrivilegeFunctionality:
{'report_reason':'Testing Reports #1',
'reporter_id':'3'},
url=(media_uri_slug+"report/"))
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
# Test that a user cannot access the moderation pages w/o moderator
@@ -182,27 +181,27 @@ class TestPrivilegeFunctionality:
#----------------------------------------------------------------------
with pytest.raises(AppError) as excinfo:
response = self.test_app.get("/mod/users/")
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
with pytest.raises(AppError) as excinfo:
response = self.test_app.get("/mod/reports/")
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
with pytest.raises(AppError) as excinfo:
response = self.test_app.get("/mod/media/")
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
with pytest.raises(AppError) as excinfo:
response = self.test_app.get("/mod/users/1/")
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
with pytest.raises(AppError) as excinfo:
response = self.test_app.get("/mod/reports/1/")
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
self.query_for_users()
@@ -213,5 +212,5 @@ class TestPrivilegeFunctionality:
'targeted_user':self.admin_user.id},
url='/mod/reports/1/')
self.query_for_users()
- excinfo = str(excinfo) if six.PY2 else str(excinfo).encode('ascii')
+ excinfo = str(excinfo).encode('ascii')
assert b'Bad response: 403 FORBIDDEN' in excinfo
diff --git a/mediagoblin/tests/test_reporting.py b/mediagoblin/tests/test_reporting.py
index a59ea28e..81dc1d89 100644
--- a/mediagoblin/tests/test_reporting.py
+++ b/mediagoblin/tests/test_reporting.py
@@ -15,8 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
-import six
-
from mediagoblin.tools import template
from mediagoblin.tests.tools import (fixture_add_user, fixture_media_entry,
fixture_add_comment, fixture_add_comment_report)
diff --git a/mediagoblin/tests/test_sql_migrations.py b/mediagoblin/tests/test_sql_migrations.py
index 9bc9d8c4..bf7924b1 100644
--- a/mediagoblin/tests/test_sql_migrations.py
+++ b/mediagoblin/tests/test_sql_migrations.py
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
import pytest
pytest.importorskip("migrate")
@@ -569,7 +568,6 @@ def _get_level3_exits(session, level):
session.query(LevelExit3).filter_by(from_level=level.id)}
-@pytest.mark.skipif(six.PY2, reason='Breaks in Python 2 but migrations seem to run ok')
def test_set1_to_set3():
# Create / connect to database
# ----------------------------
diff --git a/mediagoblin/tests/test_storage.py b/mediagoblin/tests/test_storage.py
index 4591cbdf..d72757b3 100644
--- a/mediagoblin/tests/test_storage.py
+++ b/mediagoblin/tests/test_storage.py
@@ -19,8 +19,6 @@ import os
import tempfile
import pytest
-import six
-
from werkzeug.utils import secure_filename
from mediagoblin import storage
diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py
index 72faf1b9..c9df1c21 100644
--- a/mediagoblin/tests/test_submission.py
+++ b/mediagoblin/tests/test_submission.py
@@ -36,13 +36,6 @@ try:
except ImportError:
SKIP_AUDIO = True
-import six
-
-if six.PY2: # this hack only work in Python 2
- import sys
- reload(sys)
- sys.setdefaultencoding('utf-8')
-
import os
import pytest
import webtest.forms
@@ -52,7 +45,7 @@ try:
except ImportError:
import unittest.mock as mock
-import six.moves.urllib.parse as urlparse
+import urllib.parse as urlparse
from celery import Signature
from mediagoblin.tests.tools import (
diff --git a/mediagoblin/tests/test_util.py b/mediagoblin/tests/test_util.py
index e1d2bdc1..851acf6e 100644
--- a/mediagoblin/tests/test_util.py
+++ b/mediagoblin/tests/test_util.py
@@ -24,8 +24,6 @@ import pytest
import smtplib
import pkg_resources
-import six
-
from mediagoblin.tests.tools import get_app
from mediagoblin import mg_globals
from mediagoblin.tools import common, url, translate, mail, text, testing
diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py
index 626ff323..82725059 100644
--- a/mediagoblin/tests/tools.py
+++ b/mediagoblin/tests/tools.py
@@ -19,8 +19,6 @@ import os
import pkg_resources
import shutil
-import six
-
from paste.deploy import loadapp
from webtest import TestApp
diff --git a/mediagoblin/tools/exif.py b/mediagoblin/tools/exif.py
index cf739b07..99285d67 100644
--- a/mediagoblin/tools/exif.py
+++ b/mediagoblin/tools/exif.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from exifread import process_file
from exifread.utils import Ratio
diff --git a/mediagoblin/tools/files.py b/mediagoblin/tools/files.py
index e2e07733..8da1758c 100644
--- a/mediagoblin/tools/files.py
+++ b/mediagoblin/tools/files.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
from mediagoblin import mg_globals
diff --git a/mediagoblin/tools/mail.py b/mediagoblin/tools/mail.py
index 3e46fb36..2a1bd6c3 100644
--- a/mediagoblin/tools/mail.py
+++ b/mediagoblin/tools/mail.py
@@ -17,7 +17,6 @@
import socket
import logging
-import six
import smtplib
import sys
from mediagoblin import mg_globals, messages
diff --git a/mediagoblin/tools/pagination.py b/mediagoblin/tools/pagination.py
index 5e859a5f..51f31301 100644
--- a/mediagoblin/tools/pagination.py
+++ b/mediagoblin/tools/pagination.py
@@ -19,7 +19,7 @@ from math import ceil, floor
from itertools import count
from werkzeug.datastructures import MultiDict
-from six.moves import urllib
+import urllib
PAGINATION_DEFAULT_PER_PAGE = 30
diff --git a/mediagoblin/tools/processing.py b/mediagoblin/tools/processing.py
index 5af3b5ad..aa086a30 100644
--- a/mediagoblin/tools/processing.py
+++ b/mediagoblin/tools/processing.py
@@ -18,7 +18,7 @@ import logging
import json
import traceback
-from six.moves.urllib import request, parse
+from urllib import request, parse
_log = logging.getLogger(__name__)
diff --git a/mediagoblin/tools/request.py b/mediagoblin/tools/request.py
index 51403f05..f1cd01a7 100644
--- a/mediagoblin/tools/request.py
+++ b/mediagoblin/tools/request.py
@@ -17,7 +17,6 @@
import json
import logging
-import six
from werkzeug.http import parse_options_header
from mediagoblin.db.models import User, AccessToken
diff --git a/mediagoblin/tools/response.py b/mediagoblin/tools/response.py
index 93b9c6e7..eb9d4e6f 100644
--- a/mediagoblin/tools/response.py
+++ b/mediagoblin/tools/response.py
@@ -16,7 +16,6 @@
import json
-import six
import werkzeug.utils
from werkzeug.wrappers import Response as wz_Response
from mediagoblin.tools.template import render_template
diff --git a/mediagoblin/tools/routing.py b/mediagoblin/tools/routing.py
index 1c360bff..ebd2c08e 100644
--- a/mediagoblin/tools/routing.py
+++ b/mediagoblin/tools/routing.py
@@ -16,9 +16,7 @@
import logging
-import six
-
-from six.moves.urllib.parse import urlparse
+from urllib.parse import urlparse
from werkzeug.routing import Map, Rule
from mediagoblin.tools.common import import_component
diff --git a/mediagoblin/tools/staticdirect.py b/mediagoblin/tools/staticdirect.py
index 545500bc..5a125576 100644
--- a/mediagoblin/tools/staticdirect.py
+++ b/mediagoblin/tools/staticdirect.py
@@ -24,8 +24,6 @@
import logging
-import six
-
_log = logging.getLogger(__name__)
diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py
index 1a335fe4..a99e042a 100644
--- a/mediagoblin/tools/template.py
+++ b/mediagoblin/tools/template.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
-
import jinja2
from jinja2.ext import Extension
from jinja2.nodes import Include, Const
diff --git a/mediagoblin/tools/translate.py b/mediagoblin/tools/translate.py
index c383fce0..ce4cd4d3 100644
--- a/mediagoblin/tools/translate.py
+++ b/mediagoblin/tools/translate.py
@@ -17,8 +17,6 @@
import gettext
import pkg_resources
-import six
-
from babel import localedata
from babel.support import LazyProxy
@@ -147,10 +145,9 @@ def pass_to_ugettext(*args, **kwargs):
The reason we can't have a global ugettext method is because
mg_globals gets swapped out by the application per-request.
"""
- if six.PY2:
- return mg_globals.thread_scope.translations.ugettext(*args, **kwargs)
return mg_globals.thread_scope.translations.gettext(*args, **kwargs)
+
def pass_to_ungettext(*args, **kwargs):
"""
Pass a translation on to the appropriate ungettext method.
@@ -158,8 +155,6 @@ def pass_to_ungettext(*args, **kwargs):
The reason we can't have a global ugettext method is because
mg_globals gets swapped out by the application per-request.
"""
- if six.PY2:
- return mg_globals.thread_scope.translations.ungettext(*args, **kwargs)
return mg_globals.thread_scope.translations.ngettext(*args, **kwargs)
diff --git a/mediagoblin/tools/url.py b/mediagoblin/tools/url.py
index fbfeefae..b7f0f6aa 100644
--- a/mediagoblin/tools/url.py
+++ b/mediagoblin/tools/url.py
@@ -17,8 +17,6 @@
import re
from unidecode import unidecode
-import six
-
_punct_re = re.compile(r'[\t !"#:$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
diff --git a/mediagoblin/tools/validator.py b/mediagoblin/tools/validator.py
index 93296eab..0d5d94b5 100644
--- a/mediagoblin/tools/validator.py
+++ b/mediagoblin/tools/validator.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from six.moves.urllib.parse import urlparse
+from urllib.parse import urlparse
def validate_email(email):
"""
diff --git a/mediagoblin/tools/workbench.py b/mediagoblin/tools/workbench.py
index bcc48640..ce295d7a 100644
--- a/mediagoblin/tools/workbench.py
+++ b/mediagoblin/tools/workbench.py
@@ -18,8 +18,6 @@ import os
import shutil
import tempfile
-import six
-
from mediagoblin._compat import py2_unicode
# Actual workbench stuff
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 599fda53..2993c6e6 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -18,8 +18,6 @@ import logging
import datetime
import json
-import six
-
from mediagoblin import messages, mg_globals
from mediagoblin.db.models import (MediaEntry, MediaTag, Collection, Comment,
CollectionItem, LocalUser, Activity, \