mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d15563 from master
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
from collections import deque
|
||||
from contextlib import contextmanager
|
||||
import time
|
||||
import warnings
|
||||
from collections import deque
|
||||
from contextlib import contextmanager
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import DEFAULT_DB_ALIAS
|
||||
from django.db.backends.signals import connection_created
|
||||
from django.db.backends import utils
|
||||
from django.db.backends.signals import connection_created
|
||||
from django.db.transaction import TransactionManagementError
|
||||
from django.db.utils import DatabaseError, DatabaseErrorWrapper
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.six.moves import _thread as thread
|
||||
|
||||
|
||||
NO_DB_ALIAS = '__no_db__'
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ from django.utils.encoding import force_bytes
|
||||
from django.utils.six import StringIO
|
||||
from django.utils.six.moves import input
|
||||
|
||||
|
||||
# The prefix to put on the default database name when creating
|
||||
# the test database.
|
||||
TEST_DATABASE_PREFIX = 'test_'
|
||||
|
||||
@@ -2,7 +2,6 @@ from collections import namedtuple
|
||||
|
||||
from django.utils import six
|
||||
|
||||
|
||||
# Structure returned by DatabaseIntrospection.get_table_list()
|
||||
TableInfo = namedtuple('TableInfo', ['name', 'type'])
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
import decimal
|
||||
from importlib import import_module
|
||||
import warnings
|
||||
from importlib import import_module
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.backends import utils
|
||||
|
||||
@@ -12,8 +12,8 @@ from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
from django.db.backends.base.creation import BaseDatabaseCreation
|
||||
from django.db.backends.base.features import BaseDatabaseFeatures
|
||||
from django.db.backends.base.operations import BaseDatabaseOperations
|
||||
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
||||
from django.db.backends.base.operations import BaseDatabaseOperations
|
||||
from django.db.backends.base.validation import BaseDatabaseValidation
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,8 @@ from django.conf import settings
|
||||
from django.db import utils
|
||||
from django.db.backends import utils as backend_utils
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.utils.encoding import force_str
|
||||
from django.db.backends.mysql.schema import DatabaseSchemaEditor
|
||||
from django.utils import six, timezone
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.safestring import SafeBytes, SafeText
|
||||
|
||||
@@ -27,16 +26,17 @@ except ImportError as e:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
|
||||
|
||||
from MySQLdb.converters import conversions, Thing2Literal
|
||||
from MySQLdb.constants import FIELD_TYPE, CLIENT
|
||||
from MySQLdb.constants import CLIENT, FIELD_TYPE # isort:skip
|
||||
from MySQLdb.converters import Thing2Literal, conversions # isort:skip
|
||||
|
||||
# Some of these import MySQLdb, so import them after checking if it's installed.
|
||||
from .client import DatabaseClient
|
||||
from .creation import DatabaseCreation
|
||||
from .features import DatabaseFeatures
|
||||
from .introspection import DatabaseIntrospection
|
||||
from .operations import DatabaseOperations
|
||||
from .validation import DatabaseValidation
|
||||
from .client import DatabaseClient # isort:skip
|
||||
from .creation import DatabaseCreation # isort:skip
|
||||
from .features import DatabaseFeatures # isort:skip
|
||||
from .introspection import DatabaseIntrospection # isort:skip
|
||||
from .operations import DatabaseOperations # isort:skip
|
||||
from .schema import DatabaseSchemaEditor # isort:skip
|
||||
from .validation import DatabaseValidation # isort:skip
|
||||
|
||||
# We want version (1, 2, 1, 'final', 2) or later. We can't just use
|
||||
# lexicographic ordering in this check because then (1, 2, 1, 'gamma')
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
from collections import namedtuple
|
||||
import re
|
||||
from collections import namedtuple
|
||||
|
||||
from MySQLdb.constants import FIELD_TYPE
|
||||
|
||||
from django.utils.datastructures import OrderedSet
|
||||
from django.db.backends.base.introspection import (
|
||||
BaseDatabaseIntrospection, FieldInfo, TableInfo,
|
||||
)
|
||||
from django.utils.datastructures import OrderedSet
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from MySQLdb.constants import FIELD_TYPE
|
||||
|
||||
FieldInfo = namedtuple('FieldInfo', FieldInfo._fields + ('extra',))
|
||||
|
||||
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
|
||||
|
||||
@@ -55,13 +55,13 @@ except ImportError as e:
|
||||
raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
|
||||
|
||||
# Some of these import cx_Oracle, so import them after checking if it's installed.
|
||||
from .client import DatabaseClient
|
||||
from .creation import DatabaseCreation
|
||||
from .features import DatabaseFeatures
|
||||
from .introspection import DatabaseIntrospection
|
||||
from .operations import DatabaseOperations
|
||||
from .schema import DatabaseSchemaEditor
|
||||
from .utils import convert_unicode, Oracle_datetime
|
||||
from .client import DatabaseClient # isort:skip
|
||||
from .creation import DatabaseCreation # isort:skip
|
||||
from .features import DatabaseFeatures # isort:skip
|
||||
from .introspection import DatabaseIntrospection # isort:skip
|
||||
from .operations import DatabaseOperations # isort:skip
|
||||
from .schema import DatabaseSchemaEditor # isort:skip
|
||||
from .utils import Oracle_datetime, convert_unicode # isort:skip
|
||||
|
||||
DatabaseError = Database.DatabaseError
|
||||
IntegrityError = Database.IntegrityError
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.db.backends.base.creation import BaseDatabaseCreation
|
||||
from django.db.utils import DatabaseError
|
||||
from django.utils.six.moves import input
|
||||
|
||||
|
||||
TEST_DATABASE_PREFIX = 'test_'
|
||||
PASSWORD = 'Im_a_lumberjack'
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from django.utils import six, timezone
|
||||
from django.utils.encoding import force_bytes, force_text
|
||||
|
||||
from .base import Database
|
||||
from .utils import convert_unicode, InsertIdVar, Oracle_datetime
|
||||
from .utils import InsertIdVar, Oracle_datetime, convert_unicode
|
||||
|
||||
|
||||
class DatabaseOperations(BaseDatabaseOperations):
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import binascii
|
||||
import copy
|
||||
import datetime
|
||||
import binascii
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.text import force_text
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.db.utils import DatabaseError
|
||||
from django.utils import six
|
||||
from django.utils.text import force_text
|
||||
|
||||
|
||||
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
|
||||
@@ -9,7 +9,7 @@ from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.base.validation import BaseDatabaseValidation
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.safestring import SafeText, SafeBytes
|
||||
from django.utils.safestring import SafeBytes, SafeText
|
||||
|
||||
try:
|
||||
import psycopg2 as Database
|
||||
@@ -20,14 +20,14 @@ except ImportError as e:
|
||||
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
|
||||
|
||||
# Some of these import psycopg2, so import them after checking if it's installed.
|
||||
from .client import DatabaseClient
|
||||
from .creation import DatabaseCreation
|
||||
from .features import DatabaseFeatures
|
||||
from .introspection import DatabaseIntrospection
|
||||
from .operations import DatabaseOperations
|
||||
from .schema import DatabaseSchemaEditor
|
||||
from .utils import utc_tzinfo_factory
|
||||
from .version import get_version
|
||||
from .client import DatabaseClient # isort:skip
|
||||
from .creation import DatabaseCreation # isort:skip
|
||||
from .features import DatabaseFeatures # isort:skip
|
||||
from .introspection import DatabaseIntrospection # isort:skip
|
||||
from .operations import DatabaseOperations # isort:skip
|
||||
from .schema import DatabaseSchemaEditor # isort:skip
|
||||
from .utils import utc_tzinfo_factory # isort:skip
|
||||
from .version import get_version # isort:skip
|
||||
|
||||
DatabaseError = Database.DatabaseError
|
||||
IntegrityError = Database.IntegrityError
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
from django.db.backends.base.introspection import (
|
||||
@@ -6,7 +7,6 @@ from django.db.backends.base.introspection import (
|
||||
)
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
||||
FieldInfo = namedtuple('FieldInfo', FieldInfo._fields + ('default',))
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from psycopg2.extras import Inet
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.backends.base.operations import BaseDatabaseOperations
|
||||
|
||||
from psycopg2.extras import Inet
|
||||
|
||||
|
||||
class DatabaseOperations(BaseDatabaseOperations):
|
||||
def unification_cast_sql(self, output_field):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
|
||||
import psycopg2
|
||||
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
|
||||
|
||||
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ except ImportError as exc:
|
||||
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
|
||||
|
||||
# Some of these import sqlite3, so import them after checking if it's installed.
|
||||
from .client import DatabaseClient
|
||||
from .creation import DatabaseCreation
|
||||
from .features import DatabaseFeatures
|
||||
from .introspection import DatabaseIntrospection
|
||||
from .operations import DatabaseOperations
|
||||
from .schema import DatabaseSchemaEditor
|
||||
from .utils import parse_datetime_with_timezone_support
|
||||
from .client import DatabaseClient # isort:skip
|
||||
from .creation import DatabaseCreation # isort:skip
|
||||
from .features import DatabaseFeatures # isort:skip
|
||||
from .introspection import DatabaseIntrospection # isort:skip
|
||||
from .operations import DatabaseOperations # isort:skip
|
||||
from .schema import DatabaseSchemaEditor # isort:skip
|
||||
from .utils import parse_datetime_with_timezone_support # isort:skip
|
||||
|
||||
DatabaseError = Database.DatabaseError
|
||||
IntegrityError = Database.IntegrityError
|
||||
|
||||
@@ -4,7 +4,6 @@ from django.db.backends.base.introspection import (
|
||||
BaseDatabaseIntrospection, FieldInfo, TableInfo,
|
||||
)
|
||||
|
||||
|
||||
field_size_re = re.compile(r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$')
|
||||
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ import datetime
|
||||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured, FieldError
|
||||
from django.core.exceptions import FieldError, ImproperlyConfigured
|
||||
from django.db import utils
|
||||
from django.db.backends import utils as backend_utils
|
||||
from django.db.backends.base.operations import BaseDatabaseOperations
|
||||
from django.db.models import fields, aggregates
|
||||
from django.db.models import aggregates, fields
|
||||
from django.utils import six, timezone
|
||||
from django.utils.dateparse import parse_date, parse_time
|
||||
from django.utils.duration import duration_string
|
||||
from django.utils import six, timezone
|
||||
|
||||
from .utils import parse_datetime_with_timezone_support
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ import codecs
|
||||
import copy
|
||||
from decimal import Decimal
|
||||
|
||||
import _sqlite3
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.utils import six
|
||||
|
||||
import _sqlite3
|
||||
|
||||
|
||||
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@ warnings.warn(
|
||||
"Use django.db.backends.utils instead.", RemovedInDjango19Warning,
|
||||
stacklevel=2)
|
||||
|
||||
from django.db.backends.utils import * # NOQA
|
||||
from django.db.backends.utils import * # NOQA isort:skip
|
||||
|
||||
@@ -10,7 +10,6 @@ from django.conf import settings
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.timezone import utc
|
||||
|
||||
|
||||
logger = logging.getLogger('django.db.backends')
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
import datetime
|
||||
|
||||
import re
|
||||
from itertools import chain
|
||||
|
||||
from django.utils import six
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.db.migrations import operations
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.questioner import MigrationQuestioner
|
||||
from django.db.migrations.optimizer import MigrationOptimizer
|
||||
from django.db.migrations.operations.models import AlterModelOptions
|
||||
from django.db.migrations.optimizer import MigrationOptimizer
|
||||
from django.db.migrations.questioner import MigrationQuestioner
|
||||
from django.utils import six
|
||||
|
||||
from .topological_sort import stable_topological_sort
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.apps.registry import apps as global_apps
|
||||
from django.db import migrations
|
||||
|
||||
from .loader import MigrationLoader
|
||||
from .recorder import MigrationRecorder
|
||||
from .state import ProjectState
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from collections import deque
|
||||
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from importlib import import_module
|
||||
import os
|
||||
import sys
|
||||
from importlib import import_module
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
@@ -10,7 +10,6 @@ from django.db.migrations.graph import MigrationGraph, NodeNotFoundError
|
||||
from django.db.migrations.recorder import MigrationRecorder
|
||||
from django.utils import six
|
||||
|
||||
|
||||
MIGRATIONS_MODULE_NAME = 'migrations'
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db.transaction import atomic
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import router
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
from django.db.models.fields import NOT_PROVIDED
|
||||
from django.utils import six
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
from .base import Operation
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.options import normalize_together
|
||||
from django.db.migrations.state import ModelState
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.migrations.state import ModelState
|
||||
from django.db.models.options import normalize_together
|
||||
from django.utils import six
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
from __future__ import unicode_literals
|
||||
from collections import OrderedDict
|
||||
|
||||
import copy
|
||||
from collections import OrderedDict
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.apps.registry import Apps, apps as global_apps
|
||||
from django.db import models
|
||||
from django.db.models.options import DEFAULT_NAMES, normalize_together
|
||||
from django.db.models.fields.related import do_pending_lookups
|
||||
from django.db.models.fields.proxy import OrderWrt
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.db.models.fields.proxy import OrderWrt
|
||||
from django.db.models.fields.related import do_pending_lookups
|
||||
from django.db.models.options import DEFAULT_NAMES, normalize_together
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_text, smart_text
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
@@ -3,16 +3,16 @@ from __future__ import unicode_literals
|
||||
import collections
|
||||
import datetime
|
||||
import decimal
|
||||
from importlib import import_module
|
||||
import inspect
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import types
|
||||
from importlib import import_module
|
||||
|
||||
from django.apps import apps
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
from django.db.migrations.loader import MigrationLoader
|
||||
from django.utils import datetime_safe, six
|
||||
from django.utils.encoding import force_text
|
||||
@@ -20,7 +20,6 @@ from django.utils.functional import Promise
|
||||
from django.utils.timezone import utc
|
||||
from django.utils.version import get_docs_version
|
||||
|
||||
|
||||
COMPILED_REGEX_TYPE = type(re.compile(''))
|
||||
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from copy import copy
|
||||
import inspect
|
||||
from copy import copy
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.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.sql.constants import CURSOR
|
||||
from django.db import (
|
||||
DJANGO_VERSION_PICKLE_KEY, IntegrityError, connections, router,
|
||||
transaction,
|
||||
)
|
||||
from django.db.models import sql
|
||||
from django.db.models.expressions import Date, DateTime, F
|
||||
from django.db.models.constants import LOOKUP_SEP
|
||||
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.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__
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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']
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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']
|
||||
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.db import (
|
||||
connections, DEFAULT_DB_ALIAS,
|
||||
DatabaseError, Error, ProgrammingError)
|
||||
DEFAULT_DB_ALIAS, DatabaseError, Error, ProgrammingError, connections,
|
||||
)
|
||||
from django.utils.decorators import ContextDecorator
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
from importlib import import_module
|
||||
import os
|
||||
import pkgutil
|
||||
from threading import local
|
||||
import warnings
|
||||
from importlib import import_module
|
||||
from threading import local
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import six
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango19Warning
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils._os import upath
|
||||
from django.utils import six
|
||||
|
||||
|
||||
DEFAULT_DB_ALIAS = 'default'
|
||||
DJANGO_VERSION_PICKLE_KEY = '_django_version'
|
||||
|
||||
Reference in New Issue
Block a user