From 2cd2d188516475ddf256e6267cd82c495fb5c430 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sun, 3 Apr 2016 20:37:32 -0400 Subject: Fixed W503 flake8 warnings. --- django/db/models/sql/query.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'django/db/models/sql') diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 1223e9a109..4a5eb1701a 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -735,9 +735,7 @@ class Query(object): # Only the first alias (skipped above) should have None join_type assert self.alias_map[alias].join_type is not None parent_alias = self.alias_map[alias].parent_alias - parent_louter = ( - parent_alias - and self.alias_map[parent_alias].join_type == LOUTER) + parent_louter = parent_alias and self.alias_map[parent_alias].join_type == LOUTER already_louter = self.alias_map[alias].join_type == LOUTER if ((self.alias_map[alias].nullable or parent_louter) and not already_louter): @@ -746,8 +744,8 @@ class Query(object): # refer to this one. aliases.extend( join for join in self.alias_map.keys() - if (self.alias_map[join].parent_alias == alias - and join not in aliases)) + if self.alias_map[join].parent_alias == alias and join not in aliases + ) def demote_joins(self, aliases): """ @@ -1641,8 +1639,7 @@ class Query(object): # from the model on which the lookup failed. raise else: - names = sorted(list(get_field_names_from_opts(opts)) + list(self.extra) - + list(self.annotation_select)) + names = sorted(list(get_field_names_from_opts(opts)) + list(self.extra) + list(self.annotation_select)) raise FieldError("Cannot resolve keyword %r into field. " "Choices are: %s" % (name, ", ".join(names))) @@ -1963,8 +1960,7 @@ class Query(object): # used. The proper fix would be to defer all decisions where # is_nullable() is needed to the compiler stage, but that is not easy # to do currently. - if ((connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls) - and field.empty_strings_allowed): + if connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls and field.empty_strings_allowed: return True else: return field.null -- cgit v1.3