Remove remaining imports/calls to six not automatically removed by pyupgrade.
This commit is contained in:
parent
dec47c7102
commit
9bf3bc1944
@ -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
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
import wtforms
|
||||
from sqlalchemy import or_
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from itsdangerous import BadSignature
|
||||
|
||||
from mediagoblin import messages, mg_globals
|
||||
|
@ -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
|
||||
|
@ -18,8 +18,6 @@
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
import six
|
||||
|
||||
try:
|
||||
import migrate
|
||||
except ImportError:
|
||||
|
@ -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__)
|
||||
|
@ -18,7 +18,6 @@
|
||||
from contextlib import contextmanager
|
||||
import logging
|
||||
|
||||
import six
|
||||
from sqlalchemy import create_engine, event
|
||||
|
||||
from mediagoblin import mg_globals
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -18,8 +18,6 @@ import argparse
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import six
|
||||
|
||||
from mediagoblin.tools.common import import_component
|
||||
|
||||
import logging
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
from alembic import command
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 + ' ')
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -19,8 +19,6 @@ _log = logging.getLogger(__name__)
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import six
|
||||
|
||||
from werkzeug.exceptions import Forbidden
|
||||
from mediagoblin.tools import pluginapi
|
||||
|
||||
|
@ -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 (
|
||||
|
@ -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 (
|
||||
|
@ -21,8 +21,6 @@ import gettext
|
||||
import pkg_resources
|
||||
import threading
|
||||
|
||||
import six
|
||||
|
||||
#############################
|
||||
# General mediagoblin globals
|
||||
#############################
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -17,8 +17,6 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from werkzeug.exceptions import BadRequest
|
||||
from werkzeug.wrappers import Response
|
||||
|
||||
|
@ -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 _
|
||||
|
@ -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
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from werkzeug.exceptions import Unauthorized
|
||||
|
||||
from mediagoblin.auth.tools import check_login_simple
|
||||
|
@ -16,8 +16,6 @@
|
||||
import ldap
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from mediagoblin.tools import pluginapi
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -17,8 +17,6 @@ import json
|
||||
import logging
|
||||
import requests
|
||||
|
||||
import six
|
||||
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
from mediagoblin import messages, mg_globals
|
||||
|
@ -17,7 +17,6 @@
|
||||
from collections import namedtuple
|
||||
import logging
|
||||
|
||||
import six
|
||||
import lxml.etree as ET
|
||||
from werkzeug.exceptions import MethodNotAllowed, BadRequest
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
import logging
|
||||
import re
|
||||
|
||||
import six
|
||||
|
||||
from werkzeug.exceptions import MethodNotAllowed, BadRequest, NotImplemented
|
||||
from werkzeug.wrappers import BaseResponse
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -18,8 +18,6 @@
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
import six
|
||||
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from mediagoblin.tools import common
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import urllib.parse as urlparse
|
||||
|
||||
from mediagoblin.tools import template, mail
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
# ----------------------------
|
||||
|
@ -19,8 +19,6 @@ import os
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
import six
|
||||
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from mediagoblin import storage
|
||||
|
@ -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 (
|
||||
|
@ -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
|
||||
|
@ -19,8 +19,6 @@ import os
|
||||
import pkg_resources
|
||||
import shutil
|
||||
|
||||
import six
|
||||
|
||||
from paste.deploy import loadapp
|
||||
from webtest import TestApp
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import socket
|
||||
import logging
|
||||
import six
|
||||
import smtplib
|
||||
import sys
|
||||
from mediagoblin import mg_globals, messages
|
||||
|
@ -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
|
||||
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
import json
|
||||
import logging
|
||||
|
||||
import six
|
||||
from werkzeug.http import parse_options_header
|
||||
|
||||
from mediagoblin.db.models import User, AccessToken
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -24,8 +24,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
import re
|
||||
from unidecode import unidecode
|
||||
|
||||
import six
|
||||
|
||||
_punct_re = re.compile(r'[\t !"#:$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
|
||||
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -18,8 +18,6 @@ import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import six
|
||||
|
||||
from mediagoblin._compat import py2_unicode
|
||||
|
||||
# Actual workbench stuff
|
||||
|
@ -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, \
|
||||
|
Loading…
x
Reference in New Issue
Block a user