Commit 60586dd7 authored by userimack's avatar userimack Committed by Tim Graham
Browse files

Fixed #26125 -- Fixed E731 flake warnings.

parent abc0777b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
"""
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
from __future__ import unicode_literals

# Default Django settings. Override these with settings in the module
# pointed-to by the DJANGO_SETTINGS_MODULE environment variable.

# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
gettext_noop = lambda s: s
def gettext_noop(s):
    return s

####################
# CORE             #
+5 −2
Original line number Diff line number Diff line
@@ -143,7 +143,9 @@ def result_headers(cl):
        o_list_primary = []  # URL for making this field the primary sort
        o_list_remove = []  # URL for removing this field from sort
        o_list_toggle = []  # URL for toggling order type for this field
        make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n)

        def make_qs_param(t, n):
            return ('-' if t == 'desc' else '') + str(n)

        for j, ot in ordering_field_columns.items():
            if j == i:  # Same column
@@ -341,7 +343,8 @@ def date_hierarchy(cl):
        month_lookup = cl.params.get(month_field)
        day_lookup = cl.params.get(day_field)

        link = lambda filters: cl.get_query_string(filters, [field_generic])
        def link(filters):
            return cl.get_query_string(filters, [field_generic])

        if not (year_lookup or month_lookup or day_lookup):
            # select appropriate start level
+4 −2
Original line number Diff line number Diff line
@@ -69,10 +69,12 @@ class KeysValidator(object):


class RangeMaxValueValidator(MaxValueValidator):
    compare = lambda self, a, b: a.upper > b
    def compare(self, a, b):
        return a.upper > b
    message = _('Ensure that this range is completely less than or equal to %(limit_value)s.')


class RangeMinValueValidator(MinValueValidator):
    compare = lambda self, a, b: a.lower < b
    def compare(self, a, b):
        return a.lower < b
    message = _('Ensure that this range is completely greater than or equal to %(limit_value)s.')
+7 −3
Original line number Diff line number Diff line
@@ -217,11 +217,15 @@ class HashedFilesMixin(object):
        hashed_files = OrderedDict()

        # build a list of adjustable files
        matches = lambda path: matches_patterns(path, self._patterns.keys())
        adjustable_paths = [path for path in paths if matches(path)]
        adjustable_paths = [
            path for path in paths
            if matches_patterns(path, self._patterns.keys())
        ]

        # then sort the files by the directory level
        path_level = lambda name: len(name.split(os.sep))
        def path_level(name):
            return len(name.split(os.sep))

        for name in sorted(paths.keys(), key=path_level, reverse=True):

            # use the original, local file, not the copied-but-unprocessed
+1 −2
Original line number Diff line number Diff line
@@ -146,8 +146,7 @@ class BaseMemcachedCache(BaseCache):
        self._cache.set_multi(safe_data, self.get_backend_timeout(timeout))

    def delete_many(self, keys, version=None):
        l = lambda x: self.make_key(x, version=version)
        self._cache.delete_multi(map(l, keys))
        self._cache.delete_multi(self.make_key(key, version=version) for key in keys)

    def clear(self):
        self._cache.flush_all()
Loading