A large number of stylistic cleanups across django/db/

This commit is contained in:
Alex Gaynor 2013-07-08 10:39:54 +10:00
parent 0b69a75502
commit 03d9566e0d
48 changed files with 383 additions and 195 deletions

View file

@ -615,7 +615,6 @@ class Query(object):
for model, values in six.iteritems(seen):
callback(target, model, values)
def deferred_to_columns_cb(self, target, model, fields):
"""
Callback used by deferred_to_columns(). The "target" parameter should
@ -627,7 +626,6 @@ class Query(object):
for field in fields:
target[table].add(field.column)
def table_alias(self, table_name, create=False):
"""
Returns a table alias for the given table_name and whether this is a
@ -955,7 +953,6 @@ class Query(object):
self.unref_alias(alias)
self.included_inherited_models = {}
def add_aggregate(self, aggregate, model, alias, is_summary):
"""
Adds a single aggregate expression to the Query
@ -1780,7 +1777,7 @@ class Query(object):
return self._aggregate_select_cache
elif self.aggregate_select_mask is not None:
self._aggregate_select_cache = SortedDict([
(k,v) for k,v in self.aggregates.items()
(k, v) for k, v in self.aggregates.items()
if k in self.aggregate_select_mask
])
return self._aggregate_select_cache
@ -1793,7 +1790,7 @@ class Query(object):
return self._extra_select_cache
elif self.extra_select_mask is not None:
self._extra_select_cache = SortedDict([
(k,v) for k,v in self.extra.items()
(k, v) for k, v in self.extra.items()
if k in self.extra_select_mask
])
return self._extra_select_cache
@ -1876,6 +1873,7 @@ class Query(object):
else:
return field.null
def get_order_dir(field, default='ASC'):
"""
Returns the field name and direction for an order specification. For
@ -1900,6 +1898,7 @@ def add_to_dict(data, key, value):
else:
data[key] = set([value])
def is_reverse_o2o(field):
"""
A little helper to check if the given field is reverse-o2o. The field is
@ -1907,6 +1906,7 @@ def is_reverse_o2o(field):
"""
return not hasattr(field, 'rel') and field.field.unique
def alias_diff(refcounts_before, refcounts_after):
"""
Given the before and after copies of refcounts works out which aliases