diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2014-12-06 13:00:09 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-08 07:58:23 -0500 |
| commit | 4468c08d70b5b722f3ebd4872909e56580ec7d68 (patch) | |
| tree | 3da12d757bc9b586df4ba39da20b8793abcae76e /django/db/models/sql | |
| parent | b327a614eb7d885441c6a2575e10b70ac1352aae (diff) | |
Fixed #23968 -- Replaced list comprehension with generators and dict comprehension
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index dadca18129..cad6372eea 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -377,7 +377,7 @@ class Query(object): inner_query.select_related = False inner_query.related_select_cols = [] - relabels = dict((t, 'subquery') for t in inner_query.tables) + relabels = {t: 'subquery' for t in inner_query.tables} relabels[None] = 'subquery' # Remove any aggregates marked for reduction from the subquery # and move them to the outer AggregateQuery. @@ -390,10 +390,10 @@ class Query(object): try: outer_query.add_subquery(inner_query, using) except EmptyResultSet: - return dict( - (alias, None) + return { + alias: None for alias in outer_query.annotation_select - ) + } else: outer_query = self self.select = [] @@ -421,11 +421,11 @@ class Query(object): converters[position] = ([], [annotation.convert_value], annotation.output_field) result = compiler.apply_converters(result, converters) - return dict( - (alias, val) + return { + alias: val for (alias, annotation), val in zip(outer_query.annotation_select.items(), result) - ) + } def get_count(self, using): """ |
