diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-09 13:19:34 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-09 14:24:06 -0500 |
| commit | a8b70d251d238b4e6cfc7bb4296da15494f8dff3 (patch) | |
| tree | 94ef5bc53e59131906aecfcf792eeac86242aa62 /django/db/models | |
| parent | eb406aa686ff1809903366ef6896037af2f1f69b (diff) | |
[1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d155635da9f79d4dd67e4889087d3673c6da from master
Diffstat (limited to 'django/db/models')
| -rw-r--r-- | django/db/models/aggregates.py | 2 | ||||
| -rw-r--r-- | django/db/models/deletion.py | 2 | ||||
| -rw-r--r-- | django/db/models/expressions.py | 2 | ||||
| -rw-r--r-- | django/db/models/fields/files.py | 10 | ||||
| -rw-r--r-- | django/db/models/fields/related.py | 21 | ||||
| -rw-r--r-- | django/db/models/loading.py | 1 | ||||
| -rw-r--r-- | django/db/models/lookups.py | 2 | ||||
| -rw-r--r-- | django/db/models/manager.py | 2 | ||||
| -rw-r--r-- | django/db/models/options.py | 8 | ||||
| -rw-r--r-- | django/db/models/query.py | 21 | ||||
| -rw-r--r-- | django/db/models/query_utils.py | 4 | ||||
| -rw-r--r-- | django/db/models/sql/aggregates.py | 3 | ||||
| -rw-r--r-- | django/db/models/sql/compiler.py | 11 | ||||
| -rw-r--r-- | django/db/models/sql/query.py | 29 | ||||
| -rw-r--r-- | django/db/models/sql/subqueries.py | 1 | ||||
| -rw-r--r-- | django/db/models/sql/where.py | 8 |
16 files changed, 65 insertions, 62 deletions
diff --git a/django/db/models/aggregates.py b/django/db/models/aggregates.py index c1ddc75d4c..01ab61f71a 100644 --- a/django/db/models/aggregates.py +++ b/django/db/models/aggregates.py @@ -3,7 +3,7 @@ Classes to represent the definitions of aggregate functions. """ from django.core.exceptions import FieldError from django.db.models.expressions import Func, Value -from django.db.models.fields import IntegerField, FloatField +from django.db.models.fields import FloatField, IntegerField __all__ = [ 'Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance', diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index 016fc5637e..431b15b0ef 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -2,7 +2,7 @@ from collections import OrderedDict from itertools import chain from operator import attrgetter -from django.db import connections, transaction, IntegrityError +from django.db import IntegrityError, connections, transaction from django.db.models import signals, sql from django.utils import six diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 87a08ecc3b..c15b095bc2 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -6,7 +6,7 @@ from django.core.exceptions import FieldError from django.db.backends import utils as backend_utils from django.db.models import fields from django.db.models.constants import LOOKUP_SEP -from django.db.models.query_utils import refs_aggregate, Q +from django.db.models.query_utils import Q, refs_aggregate from django.utils import timezone from django.utils.functional import cached_property diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py index 301244bbef..5eb6e7845f 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -1,19 +1,19 @@ import datetime -from inspect import getargspec import os import warnings +from inspect import getargspec from django import forms -from django.db.models.fields import Field from django.core import checks from django.core.files.base import File -from django.core.files.storage import default_storage from django.core.files.images import ImageFile +from django.core.files.storage import default_storage from django.db.models import signals -from django.utils.encoding import force_str, force_text +from django.db.models.fields import Field from django.utils import six -from django.utils.translation import ugettext_lazy as _ from django.utils.deprecation import RemovedInDjango20Warning +from django.utils.encoding import force_str, force_text +from django.utils.translation import ugettext_lazy as _ class FieldFile(File): diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 8acae08efb..922d8b4bd0 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -1,27 +1,28 @@ from __future__ import unicode_literals -from operator import attrgetter import warnings +from operator import attrgetter +from django import forms from django.apps import apps -from django.core import checks +from django.core import checks, exceptions from django.core.exceptions import FieldDoesNotExist from django.db import connection, connections, router, transaction from django.db.backends import utils -from django.db.models import signals, Q -from django.db.models.deletion import SET_NULL, SET_DEFAULT, CASCADE -from django.db.models.fields import (AutoField, Field, IntegerField, - PositiveIntegerField, PositiveSmallIntegerField, BLANK_CHOICE_DASH) +from django.db.models import Q, signals +from django.db.models.deletion import CASCADE, SET_DEFAULT, SET_NULL +from django.db.models.fields import ( + BLANK_CHOICE_DASH, AutoField, Field, IntegerField, PositiveIntegerField, + PositiveSmallIntegerField, +) from django.db.models.lookups import IsNull from django.db.models.query import QuerySet from django.db.models.query_utils import PathInfo -from django.utils.encoding import force_text, smart_text from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning +from django.utils.encoding import force_text, smart_text +from django.utils.functional import cached_property, curry from django.utils.translation import ugettext_lazy as _ -from django.utils.functional import curry, cached_property -from django.core import exceptions -from django import forms RECURSIVE_RELATIONSHIP_CONSTANT = 'self' diff --git a/django/db/models/loading.py b/django/db/models/loading.py index 82cb2dc4da..32526533b3 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -3,7 +3,6 @@ import warnings from django.apps import apps from django.utils.deprecation import RemovedInDjango19Warning - warnings.warn( "The utilities in django.db.models.loading are deprecated " "in favor of the new application loading system.", diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py index 7610c0dde4..9a966bfc1b 100644 --- a/django/db/models/lookups.py +++ b/django/db/models/lookups.py @@ -1,5 +1,5 @@ -from copy import copy import inspect +from copy import copy from django.conf import settings from django.utils import timezone diff --git a/django/db/models/manager.py b/django/db/models/manager.py index aa2df3f0e8..e194e28feb 100644 --- a/django/db/models/manager.py +++ b/django/db/models/manager.py @@ -1,6 +1,6 @@ import copy -from importlib import import_module import inspect +from importlib import import_module from django.db import router from django.db.models.query import QuerySet diff --git a/django/db/models/options.py b/django/db/models/options.py index fa9726556b..83f1eb036a 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -1,20 +1,22 @@ from __future__ import unicode_literals +import warnings from bisect import bisect from collections import OrderedDict, defaultdict from itertools import chain -import warnings from django.apps import apps from django.conf import settings from django.core.exceptions import FieldDoesNotExist -from django.db.models.fields.related import ManyToManyField from django.db.models.fields import AutoField from django.db.models.fields.proxy import OrderWrt +from django.db.models.fields.related import ManyToManyField from django.utils import six from django.utils.datastructures import ImmutableList, OrderedSet from django.utils.deprecation import RemovedInDjango20Warning -from django.utils.encoding import force_text, smart_text, python_2_unicode_compatible +from django.utils.encoding import ( + force_text, python_2_unicode_compatible, smart_text, +) from django.utils.functional import cached_property from django.utils.lru_cache import lru_cache from django.utils.text import camel_case_to_spaces diff --git a/django/db/models/query.py b/django/db/models/query.py index 2b7aab6ac4..0ec3cfd730 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -2,25 +2,28 @@ The main QuerySet implementation. This provides the public API for the ORM. """ -from collections import deque, OrderedDict import copy import sys import warnings +from collections import OrderedDict, deque from django.conf import settings from django.core import exceptions -from django.db import (connections, router, transaction, IntegrityError, - DJANGO_VERSION_PICKLE_KEY) +from django.db import ( + DJANGO_VERSION_PICKLE_KEY, IntegrityError, connections, router, + transaction, +) +from django.db.models import sql from django.db.models.constants import LOOKUP_SEP -from django.db.models.fields import AutoField, Empty -from django.db.models.query_utils import Q, deferred_class_factory, InvalidQuery from django.db.models.deletion import Collector +from django.db.models.expressions import F, Date, DateTime +from django.db.models.fields import AutoField, Empty +from django.db.models.query_utils import ( + Q, InvalidQuery, deferred_class_factory, +) from django.db.models.sql.constants import CURSOR -from django.db.models import sql -from django.db.models.expressions import Date, DateTime, F +from django.utils import six, timezone from django.utils.functional import partition -from django.utils import six -from django.utils import timezone from django.utils.version import get_version # The maximum number of items to display in a QuerySet.__repr__ diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index 7751f988db..10580f77a6 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -13,9 +13,7 @@ from django.apps import apps from django.core.exceptions import FieldDoesNotExist from django.db.backends import utils from django.db.models.constants import LOOKUP_SEP -from django.utils import six -from django.utils import tree - +from django.utils import six, tree # PathInfo is used when converting lookups (fk__somecol). The contents # describe the relation in Model terms (model Options and Fields for both diff --git a/django/db/models/sql/aggregates.py b/django/db/models/sql/aggregates.py index 713f530a91..0ebe10e83f 100644 --- a/django/db/models/sql/aggregates.py +++ b/django/db/models/sql/aggregates.py @@ -4,12 +4,11 @@ Classes to represent the default SQL aggregate functions import copy import warnings -from django.db.models.fields import IntegerField, FloatField +from django.db.models.fields import FloatField, IntegerField from django.db.models.lookups import RegisterLookupMixin from django.utils.deprecation import RemovedInDjango20Warning from django.utils.functional import cached_property - __all__ = ['Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance'] diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 8f3af37031..5c1dcf4f05 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1,15 +1,16 @@ -from itertools import chain import re import warnings +from itertools import chain from django.core.exceptions import FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref -from django.db.models.query_utils import select_related_descend, QueryWrapper -from django.db.models.sql.constants import (CURSOR, SINGLE, MULTI, NO_RESULTS, - ORDER_DIR, GET_ITERATOR_CHUNK_SIZE) +from django.db.models.query_utils import QueryWrapper, select_related_descend +from django.db.models.sql.constants import ( + CURSOR, GET_ITERATOR_CHUNK_SIZE, MULTI, NO_RESULTS, ORDER_DIR, SINGLE, +) from django.db.models.sql.datastructures import EmptyResultSet -from django.db.models.sql.query import get_order_dir, Query +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.deprecation import RemovedInDjango20Warning diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 4fb22149d0..f99b58b84f 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -6,28 +6,31 @@ themselves do not have to (and could be backed by things other than SQL databases). The abstraction barrier only works one way: this module has to know all about the internals of models in order to get the information it needs. """ -from string import ascii_uppercase -from itertools import count, product - -from collections import Mapping, OrderedDict import copy -from itertools import chain import warnings +from collections import Mapping, OrderedDict +from itertools import chain, count, product +from string import ascii_uppercase from django.core.exceptions import FieldDoesNotExist, FieldError -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections from django.db.models.aggregates import Count from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import Col, Ref -from django.db.models.query_utils import PathInfo, Q, refs_aggregate -from django.db.models.sql.constants import (QUERY_TERMS, ORDER_DIR, SINGLE, - ORDER_PATTERN, INNER, LOUTER) +from django.db.models.query_utils import Q, PathInfo, refs_aggregate +from django.db.models.sql.constants import ( + INNER, LOUTER, ORDER_DIR, ORDER_PATTERN, QUERY_TERMS, SINGLE, +) from django.db.models.sql.datastructures import ( - EmptyResultSet, Empty, MultiJoin, Join, BaseTable) -from django.db.models.sql.where import (WhereNode, Constraint, EverythingNode, - ExtraWhere, AND, OR, EmptyWhere) + BaseTable, Empty, EmptyResultSet, Join, MultiJoin, +) +from django.db.models.sql.where import ( + AND, OR, Constraint, EmptyWhere, EverythingNode, ExtraWhere, WhereNode, +) from django.utils import six -from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning +from django.utils.deprecation import ( + RemovedInDjango19Warning, RemovedInDjango20Warning, +) from django.utils.encoding import force_text from django.utils.tree import Node diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index be7438b2a7..78c13816d1 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 GET_ITERATOR_CHUNK_SIZE, NO_RESULTS from django.db.models.sql.query import Query from django.utils import six - __all__ = ['DeleteQuery', 'UpdateQuery', 'InsertQuery', 'AggregateQuery'] diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 6a03210a93..2ba6ceac33 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -4,18 +4,16 @@ Code to manage the creation and SQL rendering of 'where' constraints. import collections import datetime -from itertools import repeat import warnings +from itertools import repeat from django.conf import settings from django.db.models.fields import DateTimeField, Field -from django.db.models.sql.datastructures import EmptyResultSet, Empty +from django.db.models.sql.datastructures import Empty, EmptyResultSet +from django.utils import timezone, tree from django.utils.deprecation import RemovedInDjango19Warning from django.utils.functional import cached_property from django.utils.six.moves import range -from django.utils import timezone -from django.utils import tree - # Connection types AND = 'AND' |
