Commit df8d8d42 authored by Tim Graham's avatar Tim Graham
Browse files

Fixed E128 flake8 warnings in django/.

parent 2956e2f5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -297,8 +297,10 @@ class Apps(object):
        available = set(available)
        installed = set(app_config.name for app_config in self.get_app_configs())
        if not available.issubset(installed):
            raise ValueError("Available apps isn't a subset of installed "
                "apps, extra apps: %s" % ", ".join(available - installed))
            raise ValueError(
                "Available apps isn't a subset of installed apps, extra apps: %s"
                % ", ".join(available - installed)
            )

        self.stored_app_configs.append(self.app_configs)
        self.app_configs = OrderedDict(
+1 −2
Original line number Diff line number Diff line
@@ -108,8 +108,7 @@ class Settings(BaseSettings):

                if (setting in tuple_settings and
                        not isinstance(setting_value, (list, tuple))):
                    raise ImproperlyConfigured("The %s setting must be a list or a tuple. "
                            "Please fix your settings." % setting)
                    raise ImproperlyConfigured("The %s setting must be a list or a tuple. " % setting)
                setattr(self, setting, setting_value)
                self._explicit_settings.add(setting)

+10 −8
Original line number Diff line number Diff line
@@ -20,12 +20,12 @@ compress all jQuery-based files of the admin app. Requires the Google Closure
Compiler library and Java version 6 or later."""
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument('file', nargs='*')
    parser.add_argument("-c", dest="compiler", default="~/bin/compiler.jar",
                      help="path to Closure Compiler jar file")
    parser.add_argument("-v", "--verbose",
                      action="store_true", dest="verbose")
    parser.add_argument("-q", "--quiet",
                      action="store_false", dest="verbose")
    parser.add_argument(
        "-c", dest="compiler", default="~/bin/compiler.jar",
        help="path to Closure Compiler jar file",
    )
    parser.add_argument("-v", "--verbose", action="store_true", dest="verbose")
    parser.add_argument("-q", "--quiet", action="store_false", dest="verbose")
    options = parser.parse_args()

    compiler = closure_compiler if closure_compiler else os.path.expanduser(options.compiler)
@@ -38,8 +38,10 @@ Compiler library and Java version 6 or later."""
    if not options.file:
        if options.verbose:
            sys.stdout.write("No filenames given; defaulting to admin scripts\n")
        files = [os.path.join(js_path, f) for f in [
            "actions.js", "collapse.js", "inlines.js", "prepopulate.js"]]
        files = [
            os.path.join(js_path, f) for f in
            ["actions.js", "collapse.js", "inlines.js", "prepopulate.js"]
        ]
    else:
        files = options.file

+12 −12
Original line number Diff line number Diff line
@@ -155,8 +155,7 @@ class FieldListFilter(ListFilter):
        for test, list_filter_class in cls._field_list_filters:
            if not test(field):
                continue
            return list_filter_class(field, request, params,
                model, model_admin, field_path=field_path)
            return list_filter_class(field, request, params, model, model_admin, field_path=field_path)


class RelatedFieldListFilter(FieldListFilter):
@@ -200,8 +199,10 @@ class RelatedFieldListFilter(FieldListFilter):
    def choices(self, changelist):
        yield {
            'selected': self.lookup_val is None and not self.lookup_val_isnull,
            'query_string': changelist.get_query_string({},
                [self.lookup_kwarg, self.lookup_kwarg_isnull]),
            'query_string': changelist.get_query_string(
                {},
                [self.lookup_kwarg, self.lookup_kwarg_isnull]
            ),
            'display': _('All'),
        }
        for pk_val, val in self.lookup_choices:
@@ -230,8 +231,7 @@ class BooleanFieldListFilter(FieldListFilter):
        self.lookup_kwarg2 = '%s__isnull' % field_path
        self.lookup_val = request.GET.get(self.lookup_kwarg)
        self.lookup_val2 = request.GET.get(self.lookup_kwarg2)
        super(BooleanFieldListFilter, self).__init__(field,
            request, params, model, model_admin, field_path)
        super(BooleanFieldListFilter, self).__init__(field, request, params, model, model_admin, field_path)

    def expected_parameters(self):
        return [self.lookup_kwarg, self.lookup_kwarg2]
@@ -257,8 +257,10 @@ class BooleanFieldListFilter(FieldListFilter):
                'display': _('Unknown'),
            }

FieldListFilter.register(lambda f: isinstance(f,
    (models.BooleanField, models.NullBooleanField)), BooleanFieldListFilter)
FieldListFilter.register(
    lambda f: isinstance(f, (models.BooleanField, models.NullBooleanField)),
    BooleanFieldListFilter
)


class ChoicesFieldListFilter(FieldListFilter):
@@ -290,8 +292,7 @@ FieldListFilter.register(lambda f: bool(f.choices), ChoicesFieldListFilter)
class DateFieldListFilter(FieldListFilter):
    def __init__(self, field, request, params, model, model_admin, field_path):
        self.field_generic = '%s__' % field_path
        self.date_params = {k: v for k, v in params.items()
                            if k.startswith(self.field_generic)}
        self.date_params = {k: v for k, v in params.items() if k.startswith(self.field_generic)}

        now = timezone.now()
        # When time zone support is enabled, convert "now" to the user's time
@@ -387,8 +388,7 @@ class AllValuesFieldListFilter(FieldListFilter):
    def choices(self, changelist):
        yield {
            'selected': self.lookup_val is None and self.lookup_val_isnull is None,
            'query_string': changelist.get_query_string({},
                [self.lookup_kwarg, self.lookup_kwarg_isnull]),
            'query_string': changelist.get_query_string({}, [self.lookup_kwarg, self.lookup_kwarg_isnull]),
            'display': _('All'),
        }
        include_none = False
+4 −3
Original line number Diff line number Diff line
@@ -10,9 +10,10 @@ class AdminAuthenticationForm(AuthenticationForm):
    A custom authentication form used in the admin app.
    """
    error_messages = {
        'invalid_login': _("Please enter the correct %(username)s and password "
                           "for a staff account. Note that both fields may be "
                           "case-sensitive."),
        'invalid_login': _(
            "Please enter the correct %(username)s and password for a staff "
            "account. Note that both fields may be case-sensitive."
        ),
    }
    required_css_class = 'required'

Loading