Commit c3791463 authored by Jason Myers's avatar Jason Myers
Browse files

Fixing E302 Errors

parent 2a03a9a9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ class Media(object):
            getattr(combined, 'add_' + name)(getattr(other, '_' + name, None))
        return combined


def media_property(cls):
    def _media(self):
        # Get the media property of the superclass, if it exists
@@ -131,6 +132,7 @@ def media_property(cls):
            return base
    return property(_media)


class MediaDefiningClass(type):
    """
    Metaclass for classes that can have media definitions.
@@ -162,6 +164,7 @@ class SubWidget(object):
            args.append(self.choices)
        return self.parent_widget.render(*args)


class Widget(six.with_metaclass(MediaDefiningClass)):
    is_hidden = False             # Determines whether this corresponds to an <input type="hidden">.
    needs_multipart_form = False  # Determines does this widget need multipart form
@@ -224,6 +227,7 @@ class Widget(six.with_metaclass(MediaDefiningClass)):
        """
        return id_


class Input(Widget):
    """
    Base class for all <input> widgets (except type='checkbox' and
@@ -279,10 +283,12 @@ class PasswordInput(TextInput):
            value = None
        return super(PasswordInput, self).render(name, value, attrs)


class HiddenInput(Input):
    input_type = 'hidden'
    is_hidden = True


class MultipleHiddenInput(HiddenInput):
    """
    A widget that handles <input type="hidden"> for fields that have a list
@@ -313,6 +319,7 @@ class MultipleHiddenInput(HiddenInput):
            return data.getlist(name)
        return data.get(name, None)


class FileInput(Input):
    input_type = 'file'
    needs_multipart_form = True
@@ -327,6 +334,7 @@ class FileInput(Input):

FILE_INPUT_CONTRADICTION = object()


class ClearableFileInput(FileInput):
    initial_text = ugettext_lazy('Currently')
    input_text = ugettext_lazy('Change')
@@ -380,6 +388,7 @@ class ClearableFileInput(FileInput):
        upload = super(ClearableFileInput, self).value_from_datadict(data, files, name)
        if not self.is_required and CheckboxInput().value_from_datadict(
                data, files, self.clear_checkbox_name(name)):

            if upload:
                # If the user contradicts themselves (uploads a new file AND
                # checks the "clear" checkbox), we return a unique marker
@@ -389,6 +398,7 @@ class ClearableFileInput(FileInput):
            return False
        return upload


class Textarea(Widget):
    def __init__(self, attrs=None):
        # The 'rows' and 'cols' attributes are required for HTML correctness.
@@ -515,6 +525,7 @@ class Select(Widget):
                output.append(self.render_option(selected_choices, option_value, option_label))
        return '\n'.join(output)


class NullBooleanSelect(Select):
    """
    A Select Widget intended to be used with NullBooleanField.
@@ -849,6 +860,7 @@ class SplitDateTimeWidget(MultiWidget):
            return [value.date(), value.time().replace(microsecond=0)]
        return [None, None]


class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
    """
    A Widget that splits datetime input into two <input type="hidden"> inputs.
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh

[flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py,./django/conf/app_template/*
ignore=E124,E125,E127,E128,E226,E251,E302,E501,E261,W601
ignore=E124,E125,E127,E128,E226,E251,E501,E261,W601

[metadata]
license-file = LICENSE
+21 −15
Original line number Diff line number Diff line
@@ -50,7 +50,8 @@ class QueryTestCase(TestCase):
        except Book.DoesNotExist:
            self.fail('"Pro Django" should exist on default database')

        self.assertRaises(Book.DoesNotExist,
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('other').get,
            title="Pro Django"
        )
@@ -61,7 +62,8 @@ class QueryTestCase(TestCase):
        except Book.DoesNotExist:
            self.fail('"Dive into Python" should exist on default database')

        self.assertRaises(Book.DoesNotExist,
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('other').get,
            title="Dive into Python"
        )
@@ -84,11 +86,13 @@ class QueryTestCase(TestCase):
        except Book.DoesNotExist:
            self.fail('"Pro Django" should exist on other database')

        self.assertRaises(Book.DoesNotExist,
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.get,
            title="Pro Django"
        )
        self.assertRaises(Book.DoesNotExist,
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('default').get,
            title="Pro Django"
        )
@@ -98,11 +102,13 @@ class QueryTestCase(TestCase):
        except Book.DoesNotExist:
            self.fail('"Dive into Python" should exist on other database')

        self.assertRaises(Book.DoesNotExist,
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.get,
            title="Dive into Python"
        )
        self.assertRaises(Book.DoesNotExist,
        self.assertRaises(
            Book.DoesNotExist,
            Book.objects.using('default').get,
            title="Dive into Python"
        )
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ class Parent(models.Model):
    # Use a simple string for forward declarations.
    bestchild = models.ForeignKey("Child", null=True, related_name="favoured_by")


class Child(models.Model):
    name = models.CharField(max_length=100)

+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ class Event(models.Model):
class Screening(Event):
    movie = models.ForeignKey(Movie)


class ScreeningNullFK(Event):
    movie = models.ForeignKey(Movie, null=True)

@@ -24,5 +25,6 @@ class ScreeningNullFK(Event):
class Package(models.Model):
    screening = models.ForeignKey(Screening, null=True)


class PackageNullFK(models.Model):
    screening = models.ForeignKey(ScreeningNullFK, null=True)
Loading