diff options
| author | Tim Graham <timograham@gmail.com> | 2015-01-28 07:35:27 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-06 08:16:28 -0500 |
| commit | 0ed7d155635da9f79d4dd67e4889087d3673c6da (patch) | |
| tree | cf5c59b563f01774f32e20b3af8cb24a387fdc4d /django/db/models | |
| parent | 388d986b8a6bb1363dab9f53ea435dff4dfe92cb (diff) | |
Sorted imports with isort; refs #23860.
Diffstat (limited to 'django/db/models')
| -rw-r--r-- | django/db/models/aggregates.py | 2 | ||||
| -rw-r--r-- | django/db/models/base.py | 25 | ||||
| -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/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 | 25 | ||||
| -rw-r--r-- | django/db/models/sql/subqueries.py | 1 | ||||
| -rw-r--r-- | django/db/models/sql/where.py | 1 |
16 files changed, 75 insertions, 65 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/base.py b/django/db/models/base.py index 4f00a6f0ce..4faccd89f4 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -2,33 +2,40 @@ from __future__ import unicode_literals import copy import inspect -from itertools import chain import sys import warnings +from itertools import chain from django.apps import apps from django.apps.config import MODELS_MODULE_NAME from django.conf import settings from django.core import checks -from django.core.exceptions import (FieldDoesNotExist, ObjectDoesNotExist, - MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS) -from django.db import (router, connections, transaction, DatabaseError, - DEFAULT_DB_ALIAS, DJANGO_VERSION_PICKLE_KEY) +from django.core.exceptions import ( + NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned, + ObjectDoesNotExist, ValidationError, +) +from django.db import ( + DEFAULT_DB_ALIAS, DJANGO_VERSION_PICKLE_KEY, DatabaseError, connections, + router, transaction, +) from django.db.models import signals from django.db.models.constants import LOOKUP_SEP from django.db.models.deletion import Collector from django.db.models.fields import AutoField -from django.db.models.fields.related import (ForeignObjectRel, ManyToOneRel, - OneToOneField, add_lazy_relation) +from django.db.models.fields.related import ( + ForeignObjectRel, ManyToOneRel, OneToOneField, add_lazy_relation, +) from django.db.models.manager import ensure_default_manager from django.db.models.options import Options from django.db.models.query import Q -from django.db.models.query_utils import DeferredAttribute, deferred_class_factory +from django.db.models.query_utils import ( + DeferredAttribute, deferred_class_factory, +) from django.utils import six from django.utils.encoding import force_str, force_text from django.utils.functional import curry from django.utils.six.moves import zip -from django.utils.text import get_text_list, capfirst +from django.utils.text import capfirst, get_text_list from django.utils.translation import ugettext_lazy as _ from django.utils.version import get_version 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 40e1028f1c..c045391aaa 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/lookups.py b/django/db/models/lookups.py index f3bb0fcd33..de64129e19 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 57684bb23a..f7a49059bf 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 -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 +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 1d6e8f731b..005bd99956 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 210ca742f6..3ca2d6d675 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 5335d27570..9dede765f7 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -6,26 +6,27 @@ 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, ExtraWhere, AND, OR, - NothingNode) + BaseTable, Empty, EmptyResultSet, Join, MultiJoin, +) +from django.db.models.sql.where import ( + AND, OR, ExtraWhere, NothingNode, WhereNode, +) from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_text diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index 727eabc5f5..14739dea0e 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 de51e1db04..9836da8735 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -6,7 +6,6 @@ from django.db.models.sql.datastructures import EmptyResultSet from django.utils import tree from django.utils.functional import cached_property - # Connection types AND = 'AND' OR = 'OR' |
