Commit 062ce508 authored by Tim Graham's avatar Tim Graham
Browse files

[1.8.x] Fixed flake8 warnings on Python 3.

Backport of 47fcbe50 from master
parent 53323a5c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ WHEN (new.%(col_name)s IS NULL)
        # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement
        # The DB API definition does not define this attribute.
        statement = cursor.statement
        if statement and six.PY2 and not isinstance(statement, unicode):
        if statement and six.PY2 and not isinstance(statement, unicode):  # NOQA: unicode undefined on PY3
            statement = statement.decode('utf-8')
        # Unlike Psycopg's `query` and MySQLdb`'s `_last_executed`, CxOracle's
        # `statement` doesn't contain the query parameters. refs #20010.
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ DEFAULT_DB_ALIAS = 'default'
DJANGO_VERSION_PICKLE_KEY = '_django_version'


class Error(Exception if six.PY3 else StandardError):
class Error(Exception if six.PY3 else StandardError):  # NOQA: StandardError undefined on PY3
    pass


+1 −1
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ class LazyObject(object):
        __bool__ = new_method_proxy(bool)
    else:
        __str__ = new_method_proxy(str)
        __unicode__ = new_method_proxy(unicode)
        __unicode__ = new_method_proxy(unicode)  # NOQA: unicode undefined on PY3
        __nonzero__ = new_method_proxy(bool)

    # Introspection support
+1 −1
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ def html_safe(klass):
            )
        klass_unicode = klass.__unicode__
        klass.__unicode__ = lambda self: mark_safe(klass_unicode(self))
        klass.__html__ = lambda self: unicode(self)
        klass.__html__ = lambda self: unicode(self)  # NOQA: unicode undefined on PY3
    else:
        if '__str__' not in klass.__dict__:
            raise ValueError(
+5 −2
Original line number Diff line number Diff line
@@ -206,7 +206,10 @@ class TranslationTests(TestCase):
        result = ungettext_lazy('%(name)s has %(num)d good result', '%(name)s has %(num)d good results', 4)
        self.assertEqual(result % {'name': 'Joe', 'num': 4}, "Joe has 4 good results")
        # Now with a long
        result = ungettext_lazy('%(name)s has %(num)d good result', '%(name)s has %(num)d good results', long(4))
        result = ungettext_lazy(
            '%(name)s has %(num)d good result', '%(name)s has %(num)d good results',
            long(4)   # NOQA: long undefined on PY3
        )
        self.assertEqual(result % {'name': 'Joe', 'num': 4}, "Joe has 4 good results")

    @override_settings(LOCALE_PATHS=extended_locale_paths)
@@ -472,7 +475,7 @@ class FormattingTests(TestCase):
        self.d = datetime.date(2009, 12, 31)
        self.dt = datetime.datetime(2009, 12, 31, 20, 50)
        self.t = datetime.time(10, 15, 48)
        self.l = 10000 if PY3 else long(10000)
        self.l = 10000 if PY3 else long(10000)  # NOQA: long undefined on PY3
        self.ctxt = Context({
            'n': self.n,
            't': self.t,
Loading