diff options
author | Ramin Farajpour Cami <ramin.blackhat@gmail.com> | 2016-11-15 02:10:28 +0330 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-11-14 17:40:28 -0500 |
commit | 0a63ef3f61f42c5fd22f2d0b626e386fd426ebed (patch) | |
tree | 4529b5f5c23db4062a5195f961e4ae468120741e /django | |
parent | c7bfcd2f377ad5803e25ee547dee9cf58ee68ab2 (diff) | |
download | django-0a63ef3f61f42c5fd22f2d0b626e386fd426ebed.tar.gz |
Fixed #27463 -- Fixed E741 flake8 warnings.
Diffstat (limited to 'django')
-rw-r--r-- | django/contrib/admin/options.py | 8 | ||||
-rw-r--r-- | django/contrib/gis/gdal/datasource.py | 8 | ||||
-rw-r--r-- | django/db/migrations/loader.py | 6 | ||||
-rw-r--r-- | django/template/smartif.py | 8 | ||||
-rw-r--r-- | django/utils/crypto.py | 8 | ||||
-rw-r--r-- | django/utils/dateformat.py | 6 |
6 files changed, 22 insertions, 22 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 33daf244f0..12487dcc9b 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -340,11 +340,11 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): # Check FKey lookups that are allowed, so that popups produced by # ForeignKeyRawIdWidget, on the basis of ForeignKey.limit_choices_to, # are allowed to work. - for l in model._meta.related_fkey_lookups: + for fk_lookup in model._meta.related_fkey_lookups: # As ``limit_choices_to`` can be a callable, invoke it here. - if callable(l): - l = l() - for k, v in widgets.url_params_from_lookup_dict(l).items(): + if callable(fk_lookup): + fk_lookup = fk_lookup() + for k, v in widgets.url_params_from_lookup_dict(fk_lookup).items(): if k == lookup and v == value: return True diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py index e9d588e285..adb32a0784 100644 --- a/django/contrib/gis/gdal/datasource.py +++ b/django/contrib/gis/gdal/datasource.py @@ -100,16 +100,16 @@ class DataSource(GDALBase): def __getitem__(self, index): "Allows use of the index [] operator to get a layer at the index." if isinstance(index, six.string_types): - l = capi.get_layer_by_name(self.ptr, force_bytes(index)) - if not l: + layer = capi.get_layer_by_name(self.ptr, force_bytes(index)) + if not layer: raise OGRIndexError('invalid OGR Layer name given: "%s"' % index) elif isinstance(index, int): if index < 0 or index >= self.layer_count: raise OGRIndexError('index out of range') - l = capi.get_layer(self._ptr, index) + layer = capi.get_layer(self._ptr, index) else: raise TypeError('Invalid index type: %s' % type(index)) - return Layer(l, self) + return Layer(layer, self) def __len__(self): "Returns the number of layers within the data source." diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py index ce6fd9e3c0..bbbde07a98 100644 --- a/django/db/migrations/loader.py +++ b/django/db/migrations/loader.py @@ -129,9 +129,9 @@ class MigrationLoader(object): "Returns the migration(s) which match the given app label and name _prefix_" # Do the search results = [] - for l, n in self.disk_migrations: - if l == app_label and n.startswith(name_prefix): - results.append((l, n)) + for migration_app_label, migration_name in self.disk_migrations: + if migration_app_label == app_label and migration_name.startswith(name_prefix): + results.append((migration_app_label, migration_name)) if len(results) > 1: raise AmbiguityError( "There is more than one migration for '%s' with the prefix '%s'" % (app_label, name_prefix) diff --git a/django/template/smartif.py b/django/template/smartif.py index ee062d537d..d0cebadc01 100644 --- a/django/template/smartif.py +++ b/django/template/smartif.py @@ -152,15 +152,15 @@ class IfParser(object): def __init__(self, tokens): # Turn 'is','not' and 'not','in' into single tokens. - l = len(tokens) + num_tokens = len(tokens) mapped_tokens = [] i = 0 - while i < l: + while i < num_tokens: token = tokens[i] - if token == "is" and i + 1 < l and tokens[i + 1] == "not": + if token == "is" and i + 1 < num_tokens and tokens[i + 1] == "not": token = "is not" i += 1 # skip 'not' - elif token == "not" and i + 1 < l and tokens[i + 1] == "in": + elif token == "not" and i + 1 < num_tokens and tokens[i + 1] == "in": token = "not in" i += 1 # skip 'in' mapped_tokens.append(self.translate_token(token)) diff --git a/django/utils/crypto.py b/django/utils/crypto.py index b364762275..3804dd9111 100644 --- a/django/utils/crypto.py +++ b/django/utils/crypto.py @@ -164,8 +164,8 @@ else: dklen = hlen if dklen > (2 ** 32 - 1) * hlen: raise OverflowError('dklen too big') - l = -(-dklen // hlen) - r = dklen - (l - 1) * hlen + L = -(-dklen // hlen) + r = dklen - (L - 1) * hlen hex_format_string = "%%0%ix" % (hlen * 2) @@ -187,5 +187,5 @@ else: result ^= _bin_to_long(u) return _long_to_bin(result, hex_format_string) - T = [F(x) for x in range(1, l)] - return b''.join(T) + F(l)[:r] + T = [F(x) for x in range(1, L)] + return b''.join(T) + F(L)[:r] diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py index 5e39648343..70650bf625 100644 --- a/django/utils/dateformat.py +++ b/django/utils/dateformat.py @@ -130,7 +130,7 @@ class TimeFormat(Formatter): "Minutes; i.e. '00' to '59'" return '%02d' % self.data.minute - def O(self): + def O(self): # NOQA: E743 """ Difference to Greenwich time in hours; e.g. '+0200', '-0430'. @@ -247,7 +247,7 @@ class DateFormat(TimeFormat): "Month, textual, long; e.g. 'January'" return MONTHS[self.data.month] - def I(self): + def I(self): # NOQA: E743 "'1' if Daylight Savings Time, '0' otherwise." try: if self.timezone and self.timezone.dst(self.data): @@ -264,7 +264,7 @@ class DateFormat(TimeFormat): "Day of the month without leading zeros; i.e. '1' to '31'" return self.data.day - def l(self): + def l(self): # NOQA: E743 "Day of the week, textual, long; e.g. 'Friday'" return WEEKDAYS[self.data.weekday()] |