diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-01-07 12:11:46 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-18 21:33:28 +0100 |
| commit | 2b281cc35ed9d997614ca3c416928d7fabfef1ad (patch) | |
| tree | d3e73cf44b15139aa9f1f53e398942ba64f5e190 /django/db/models/sql | |
| parent | 7b2f2e74adb36a4334e83130f6abc2f79d395235 (diff) | |
Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 1 | ||||
| -rw-r--r-- | django/db/models/sql/query.py | 17 | ||||
| -rw-r--r-- | django/db/models/sql/subqueries.py | 5 |
3 files changed, 10 insertions, 13 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 37442c06c4..41733210c4 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -11,7 +11,6 @@ from django.db.models.sql.constants import ( from django.db.models.sql.query import Query, get_order_dir from django.db.transaction import TransactionManagementError from django.db.utils import DatabaseError -from django.utils.six.moves import zip FORCE = object() diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 57ba7dfc8d..3acef8faf5 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -30,7 +30,6 @@ from django.db.models.sql.datastructures import ( from django.db.models.sql.where import ( AND, OR, ExtraWhere, NothingNode, WhereNode, ) -from django.utils import six from django.utils.encoding import force_text from django.utils.tree import Node @@ -104,7 +103,7 @@ class RawQuery(object): if params_type is tuple: params = tuple(adapter(val) for val in self.params) elif params_type is dict: - params = dict((key, adapter(val)) for key, val in six.iteritems(self.params)) + params = {key: adapter(val) for key, val in self.params.items()} else: raise RuntimeError("Unexpected params type: %s" % params_type) @@ -665,23 +664,23 @@ class Query(object): # slight complexity here is handling fields that exist on parent # models. workset = {} - for model, values in six.iteritems(seen): + for model, values in seen.items(): for field in model._meta.fields: if field in values: continue m = field.model._meta.concrete_model add_to_dict(workset, m, field) - for model, values in six.iteritems(must_include): + for model, values in must_include.items(): # If we haven't included a model in workset, we don't add the # corresponding must_include fields for that model, since an # empty set means "include all fields". That's why there's no # "else" branch here. if model in workset: workset[model].update(values) - for model, values in six.iteritems(workset): + for model, values in workset.items(): callback(target, model, values) else: - for model, values in six.iteritems(must_include): + for model, values in must_include.items(): if model in seen: seen[model].update(values) else: @@ -695,7 +694,7 @@ class Query(object): for model in orig_opts.get_parent_list(): if model not in seen: seen[model] = set() - for model, values in six.iteritems(seen): + for model, values in seen.items(): callback(target, model, values) def table_alias(self, table_name, create=False): @@ -813,7 +812,7 @@ class Query(object): (key, col.relabeled_clone(change_map)) for key, col in self._annotations.items()) # 2. Rename the alias in the internal table/alias datastructures. - for old_alias, new_alias in six.iteritems(change_map): + for old_alias, new_alias in change_map.items(): if old_alias not in self.alias_map: continue alias_data = self.alias_map[old_alias].relabeled_clone(change_map) @@ -1698,7 +1697,7 @@ class Query(object): self.group_by.append(col) if self.annotation_select: - for alias, annotation in six.iteritems(self.annotation_select): + for alias, annotation in self.annotation_select.items(): for col in annotation.get_group_by_cols(): self.group_by.append(col) diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index 089f04e04e..cfdadefdff 100644 --- a/django/db/models/sql/subqueries.py +++ b/django/db/models/sql/subqueries.py @@ -9,7 +9,6 @@ from django.db.models.sql.constants import ( CURSOR, GET_ITERATOR_CHUNK_SIZE, NO_RESULTS, ) from django.db.models.sql.query import Query -from django.utils import six __all__ = ['DeleteQuery', 'UpdateQuery', 'InsertQuery', 'AggregateQuery'] @@ -120,7 +119,7 @@ class UpdateQuery(Query): querysets. """ values_seq = [] - for name, val in six.iteritems(values): + for name, val in values.items(): field = self.get_meta().get_field(name) direct = not (field.auto_created and not field.concrete) or not field.concrete model = field.model._meta.concrete_model @@ -164,7 +163,7 @@ class UpdateQuery(Query): if not self.related_updates: return [] result = [] - for model, values in six.iteritems(self.related_updates): + for model, values in self.related_updates.items(): query = UpdateQuery(model) query.values = values if self.related_ids is not None: |
