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/core | |
| parent | eb406aa686ff1809903366ef6896037af2f1f69b (diff) | |
[1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d155635da9f79d4dd67e4889087d3673c6da from master
Diffstat (limited to 'django/core')
57 files changed, 157 insertions, 149 deletions
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py index 4b7806fc29..7ac1e5bc32 100644 --- a/django/core/cache/backends/base.py +++ b/django/core/cache/backends/base.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import time import warnings -from django.core.exceptions import ImproperlyConfigured, DjangoRuntimeWarning +from django.core.exceptions import DjangoRuntimeWarning, ImproperlyConfigured from django.utils.module_loading import import_string diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py index 99ce96d49e..f016179491 100644 --- a/django/core/cache/backends/db.py +++ b/django/core/cache/backends/db.py @@ -2,18 +2,18 @@ import base64 from datetime import datetime +from django.conf import settings +from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache +from django.db import DatabaseError, connections, router, transaction +from django.db.backends.utils import typecast_timestamp +from django.utils import six, timezone +from django.utils.encoding import force_bytes + try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle -from django.conf import settings -from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT -from django.db import connections, transaction, router, DatabaseError -from django.db.backends.utils import typecast_timestamp -from django.utils import timezone, six -from django.utils.encoding import force_bytes - class Options(object): """A class that will quack like a Django model _meta class. diff --git a/django/core/cache/backends/dummy.py b/django/core/cache/backends/dummy.py index eb21feebdf..d1aea0a325 100644 --- a/django/core/cache/backends/dummy.py +++ b/django/core/cache/backends/dummy.py @@ -1,6 +1,6 @@ "Dummy cache backend" -from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT +from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache class DummyCache(BaseCache): diff --git a/django/core/cache/backends/filebased.py b/django/core/cache/backends/filebased.py index 94fdfa9ed7..c35efce92c 100644 --- a/django/core/cache/backends/filebased.py +++ b/django/core/cache/backends/filebased.py @@ -8,9 +8,11 @@ import random import tempfile import time import zlib -from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT + +from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.core.files.move import file_move_safe from django.utils.encoding import force_bytes + try: from django.utils.six.moves import cPickle as pickle except ImportError: diff --git a/django/core/cache/backends/locmem.py b/django/core/cache/backends/locmem.py index edf0ff22a7..8916ad176c 100644 --- a/django/core/cache/backends/locmem.py +++ b/django/core/cache/backends/locmem.py @@ -1,15 +1,16 @@ "Thread-safe in-memory cache backend." -from contextlib import contextmanager import time +from contextlib import contextmanager + +from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache +from django.utils.synch import RWLock + try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle -from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT -from django.utils.synch import RWLock - # Global in-memory store of cache data. Keyed by name, to provide # multiple named local memory caches. diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py index 87f05f973b..a2af9045dc 100644 --- a/django/core/cache/backends/memcached.py +++ b/django/core/cache/backends/memcached.py @@ -1,11 +1,13 @@ "Memcached cache backend" -import time import pickle +import time -from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT +from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.utils import six -from django.utils.deprecation import RenameMethodsBase, RemovedInDjango19Warning +from django.utils.deprecation import ( + RemovedInDjango19Warning, RenameMethodsBase, +) from django.utils.encoding import force_str from django.utils.functional import cached_property diff --git a/django/core/cache/utils.py b/django/core/cache/utils.py index dd9ad4abd1..c40e4eba0c 100644 --- a/django/core/cache/utils.py +++ b/django/core/cache/utils.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import hashlib + from django.utils.encoding import force_bytes from django.utils.http import urlquote diff --git a/django/core/checks/compatibility/django_1_7_0.py b/django/core/checks/compatibility/django_1_7_0.py index d164241a55..878541d3e5 100644 --- a/django/core/checks/compatibility/django_1_7_0.py +++ b/django/core/checks/compatibility/django_1_7_0.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from .. import Warning, register, Tags +from .. import Tags, Warning, register @register(Tags.compatibility) diff --git a/django/core/checks/messages.py b/django/core/checks/messages.py index 6b5fd319a3..9245842039 100644 --- a/django/core/checks/messages.py +++ b/django/core/checks/messages.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible, force_str - +from django.utils.encoding import force_str, python_2_unicode_compatible # Levels DEBUG = 10 diff --git a/django/core/checks/security/base.py b/django/core/checks/security/base.py index 20fbd189b3..f740b63c7b 100644 --- a/django/core/checks/security/base.py +++ b/django/core/checks/security/base.py @@ -1,7 +1,6 @@ from django.conf import settings -from .. import register, Tags, Warning - +from .. import Tags, Warning, register SECRET_KEY_MIN_LENGTH = 50 SECRET_KEY_MIN_UNIQUE_CHARACTERS = 5 diff --git a/django/core/checks/security/csrf.py b/django/core/checks/security/csrf.py index 79cb6d4fa4..3effbc4498 100644 --- a/django/core/checks/security/csrf.py +++ b/django/core/checks/security/csrf.py @@ -1,7 +1,6 @@ from django.conf import settings -from .. import register, Tags, Warning - +from .. import Tags, Warning, register W003 = Warning( "You don't appear to be using Django's built-in " diff --git a/django/core/checks/security/sessions.py b/django/core/checks/security/sessions.py index b27aa1f9c2..7e857d74d8 100644 --- a/django/core/checks/security/sessions.py +++ b/django/core/checks/security/sessions.py @@ -1,6 +1,6 @@ from django.conf import settings -from .. import register, Tags, Warning +from .. import Tags, Warning, register def add_session_cookie_message(message): diff --git a/django/core/context_processors.py b/django/core/context_processors.py index 19cc8b4def..f2303bec59 100644 --- a/django/core/context_processors.py +++ b/django/core/context_processors.py @@ -1,9 +1,8 @@ import warnings -from django.template.context_processors import * # NOQA +from django.template.context_processors import * # NOQA from django.utils.deprecation import RemovedInDjango20Warning - warnings.warn( "django.core.context_processors is deprecated in favor of " "django.template.context_processors.", diff --git a/django/core/files/move.py b/django/core/files/move.py index 124529d9b9..f3972c5f98 100644 --- a/django/core/files/move.py +++ b/django/core/files/move.py @@ -10,7 +10,6 @@ from shutil import copystat from django.core.files import locks - __all__ = ['file_move_safe'] diff --git a/django/core/files/storage.py b/django/core/files/storage.py index 90ab1be27a..65b6d46463 100644 --- a/django/core/files/storage.py +++ b/django/core/files/storage.py @@ -1,23 +1,22 @@ -from datetime import datetime import errno -from inspect import getargspec import os import warnings +from datetime import datetime +from inspect import getargspec from django.conf import settings from django.core.exceptions import SuspiciousFileOperation -from django.core.files import locks, File +from django.core.files import File, locks from django.core.files.move import file_move_safe +from django.utils._os import abspathu, safe_join from django.utils.crypto import get_random_string -from django.utils.encoding import force_text, filepath_to_uri +from django.utils.deconstruct import deconstructible +from django.utils.deprecation import RemovedInDjango20Warning +from django.utils.encoding import filepath_to_uri, force_text from django.utils.functional import LazyObject from django.utils.module_loading import import_string from django.utils.six.moves.urllib.parse import urljoin from django.utils.text import get_valid_filename -from django.utils._os import safe_join, abspathu -from django.utils.deconstruct import deconstructible -from django.utils.deprecation import RemovedInDjango20Warning - __all__ = ('Storage', 'FileSystemStorage', 'DefaultStorage', 'default_storage') diff --git a/django/core/files/temp.py b/django/core/files/temp.py index 19849a4260..0791b8536e 100644 --- a/django/core/files/temp.py +++ b/django/core/files/temp.py @@ -18,6 +18,7 @@ full range of keyword arguments available in Python 2.6+ and 3.0+. import os import tempfile + from django.core.files.utils import FileProxyMixin __all__ = ('NamedTemporaryFile', 'gettempdir',) diff --git a/django/core/files/uploadedfile.py b/django/core/files/uploadedfile.py index 9a94894424..20eaecea75 100644 --- a/django/core/files/uploadedfile.py +++ b/django/core/files/uploadedfile.py @@ -7,8 +7,8 @@ import os from io import BytesIO from django.conf import settings -from django.core.files.base import File from django.core.files import temp as tempfile +from django.core.files.base import File from django.utils.encoding import force_str __all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile', diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py index c6fddce331..e5a2667342 100644 --- a/django/core/files/uploadhandler.py +++ b/django/core/files/uploadhandler.py @@ -7,7 +7,9 @@ from __future__ import unicode_literals from io import BytesIO from django.conf import settings -from django.core.files.uploadedfile import TemporaryUploadedFile, InMemoryUploadedFile +from django.core.files.uploadedfile import ( + InMemoryUploadedFile, TemporaryUploadedFile, +) from django.utils.encoding import python_2_unicode_compatible from django.utils.module_loading import import_string diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index eba7811529..e40eb2fa59 100644 --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -6,14 +6,15 @@ import types from django import http from django.conf import settings -from django.core import urlresolvers -from django.core import signals -from django.core.exceptions import MiddlewareNotUsed, PermissionDenied, SuspiciousOperation +from django.core import signals, urlresolvers +from django.core.exceptions import ( + MiddlewareNotUsed, PermissionDenied, SuspiciousOperation, +) from django.db import connections, transaction from django.http.multipartparser import MultiPartParserError +from django.utils import six from django.utils.encoding import force_text from django.utils.module_loading import import_string -from django.utils import six from django.views import debug logger = logging.getLogger('django.request') diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py index b4402686c0..5386999790 100644 --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -4,23 +4,21 @@ import cgi import codecs import logging import sys +import warnings from io import BytesIO from threading import Lock -import warnings from django import http from django.conf import settings from django.core import signals from django.core.handlers import base from django.core.urlresolvers import set_script_prefix -from django.utils import datastructures +# For backwards compatibility -- lots of code uses this in the wild! +from django.http.response import REASON_PHRASES as STATUS_CODE_TEXT # NOQA +from django.utils import datastructures, six from django.utils.deprecation import RemovedInDjango19Warning from django.utils.encoding import force_str, force_text from django.utils.functional import cached_property -from django.utils import six - -# For backwards compatibility -- lots of code uses this in the wild! -from django.http.response import REASON_PHRASES as STATUS_CODE_TEXT # NOQA logger = logging.getLogger('django.request') diff --git a/django/core/mail/backends/filebased.py b/django/core/mail/backends/filebased.py index 277d4bc88c..cfe033fb48 100644 --- a/django/core/mail/backends/filebased.py +++ b/django/core/mail/backends/filebased.py @@ -5,7 +5,8 @@ import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend +from django.core.mail.backends.console import \ + EmailBackend as ConsoleEmailBackend from django.utils import six diff --git a/django/core/mail/backends/smtp.py b/django/core/mail/backends/smtp.py index 620168eab2..432f3a64c4 100644 --- a/django/core/mail/backends/smtp.py +++ b/django/core/mail/backends/smtp.py @@ -5,8 +5,8 @@ import threading from django.conf import settings from django.core.mail.backends.base import BaseEmailBackend -from django.core.mail.utils import DNS_NAME from django.core.mail.message import sanitize_address +from django.core.mail.utils import DNS_NAME class EmailBackend(BaseEmailBackend): diff --git a/django/core/mail/message.py b/django/core/mail/message.py index 8d2dc0b72d..43aae4743c 100644 --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -5,21 +5,21 @@ import os import random import sys import time -from email import (charset as Charset, encoders as Encoders, - message_from_string, generator) +from email import ( + charset as Charset, encoders as Encoders, generator, message_from_string, +) +from email.header import Header from email.message import Message -from email.mime.text import MIMEText -from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.mime.message import MIMEMessage -from email.header import Header -from email.utils import formatdate, getaddresses, formataddr, parseaddr +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.utils import formataddr, formatdate, getaddresses, parseaddr from django.conf import settings from django.core.mail.utils import DNS_NAME -from django.utils.encoding import force_text from django.utils import six - +from django.utils.encoding import force_text # Don't BASE64-encode UTF-8 messages so that we avoid unwanted attention from # some spam filters. diff --git a/django/core/management/base.py b/django/core/management/base.py index b907015d08..0a4a1ee2f3 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -1,16 +1,14 @@ # -*- coding: utf-8 -*- - -from __future__ import unicode_literals - """ Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ +from __future__ import unicode_literals + import os import sys import warnings - from argparse import ArgumentParser from optparse import OptionParser @@ -19,7 +17,9 @@ from django.core import checks from django.core.exceptions import ImproperlyConfigured from django.core.management.color import color_style, no_style from django.db import connections -from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning +from django.utils.deprecation import ( + RemovedInDjango19Warning, RemovedInDjango20Warning, +) from django.utils.encoding import force_str diff --git a/django/core/management/color.py b/django/core/management/color.py index ce47f318ff..96dd557556 100644 --- a/django/core/management/color.py +++ b/django/core/management/color.py @@ -5,8 +5,7 @@ Sets up the terminal color scheme. import os import sys -from django.utils import lru_cache -from django.utils import termcolors +from django.utils import lru_cache, termcolors def supports_color(): diff --git a/django/core/management/commands/createcachetable.py b/django/core/management/commands/createcachetable.py index da39e9ad1e..750e787200 100644 --- a/django/core/management/commands/createcachetable.py +++ b/django/core/management/commands/createcachetable.py @@ -2,7 +2,9 @@ from django.conf import settings from django.core.cache import caches from django.core.cache.backends.db import BaseDatabaseCache from django.core.management.base import BaseCommand, CommandError -from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS +from django.db import ( + DEFAULT_DB_ALIAS, connections, models, router, transaction, +) from django.db.utils import DatabaseError from django.utils.encoding import force_text diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py index b771585bef..9d6097eb47 100644 --- a/django/core/management/commands/dbshell.py +++ b/django/core/management/commands/dbshell.py @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand, CommandError -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(BaseCommand): diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py index 9d506d1611..5d13022b42 100644 --- a/django/core/management/commands/dumpdata.py +++ b/django/core/management/commands/dumpdata.py @@ -1,11 +1,10 @@ import warnings - from collections import OrderedDict from django.apps import apps -from django.core.management.base import BaseCommand, CommandError from django.core import serializers -from django.db import router, DEFAULT_DB_ALIAS +from django.core.management.base import BaseCommand, CommandError +from django.db import DEFAULT_DB_ALIAS, router from django.utils.deprecation import RemovedInDjango19Warning diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index 53e5e389f0..53d5346923 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -4,13 +4,13 @@ import sys from importlib import import_module from django.apps import apps -from django.db import connections, router, transaction, DEFAULT_DB_ALIAS from django.core.management import call_command from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style -from django.core.management.sql import sql_flush, emit_post_migrate_signal -from django.utils.six.moves import input +from django.core.management.sql import emit_post_migrate_signal, sql_flush +from django.db import DEFAULT_DB_ALIAS, connections, router, transaction from django.utils import six +from django.utils.six.moves import input class Command(BaseCommand): diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index abe62c4c1f..60800df314 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -1,11 +1,11 @@ from __future__ import unicode_literals -from collections import OrderedDict import keyword import re +from collections import OrderedDict from django.core.management.base import BaseCommand, CommandError -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(BaseCommand): diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index aae69afc9b..218f78238d 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -5,6 +5,7 @@ import gzip import os import warnings import zipfile +from itertools import product from django.apps import apps from django.conf import settings @@ -12,14 +13,15 @@ from django.core import serializers from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style -from django.db import (connections, router, transaction, DEFAULT_DB_ALIAS, - IntegrityError, DatabaseError) +from django.db import ( + DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connections, router, + transaction, +) from django.utils import lru_cache -from django.utils.encoding import force_text -from django.utils.functional import cached_property from django.utils._os import upath from django.utils.deprecation import RemovedInDjango19Warning -from itertools import product +from django.utils.encoding import force_text +from django.utils.functional import cached_property try: import bz2 diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index af31402f66..48608feb9b 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -11,14 +11,15 @@ from itertools import dropwhile import django from django.conf import settings -from django.core.management.base import CommandError, BaseCommand -from django.core.management.utils import (handle_extensions, find_command, - popen_wrapper) +from django.core.management.base import BaseCommand, CommandError +from django.core.management.utils import ( + find_command, handle_extensions, popen_wrapper, +) +from django.utils import six from django.utils.encoding import force_str from django.utils.functional import cached_property, total_ordering -from django.utils import six -from django.utils.text import get_text_list from django.utils.jslex import prepare_js_for_gettext +from django.utils.text import get_text_list plural_forms_re = re.compile(r'^(?P<value>"Plural-Forms.+?\\n")\s*$', re.MULTILINE | re.DOTALL) STATUS_OK = 0 diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index 8cce2fae76..cb78107d33 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -1,13 +1,15 @@ -from itertools import takewhile -import sys import os +import sys +from itertools import takewhile from django.apps import apps from django.core.management.base import BaseCommand, CommandError from django.db.migrations import Migration -from django.db.migrations.loader import MigrationLoader from django.db.migrations.autodetector import MigrationAutodetector -from django.db.migrations.questioner import MigrationQuestioner, InteractiveMigrationQuestioner +from django.db.migrations.loader import MigrationLoader +from django.db.migrations.questioner import ( + InteractiveMigrationQuestioner, MigrationQuestioner, +) from django.db.migrations.state import ProjectState from django.db.migrations.writer import MigrationWriter from django.utils.six import iteritems diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index 30286b7aeb..89f32bdc3d 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -1,23 +1,25 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from collections import OrderedDict -from importlib import import_module import itertools import time import traceback import warnings +from collections import OrderedDict +from importlib import import_module from django.apps import apps from django.core.management import call_command from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style -from django.core.management.sql import custom_sql_for_model, emit_post_migrate_signal, emit_pre_migrate_signal -from django.db import connections, router, transaction, DEFAULT_DB_ALIAS +from django.core.management.sql import ( + custom_sql_for_model, emit_post_migrate_signal, emit_pre_migrate_signal, +) +from django.db import DEFAULT_DB_ALIAS, connections, router, transaction +from django.db.migrations.autodetector import MigrationAutodetector from django.db.migrations.executor import MigrationExecutor from django.db.migrations.loader import AmbiguityError from django.db.migrations.state import ProjectState -from django.db.migrations.autodetector import MigrationAutodetector from django.utils.deprecation import RemovedInDjango20Warning from django.utils.module_loading import module_has_submodule diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py index f171456f97..af81393c13 100644 --- a/django/core/management/commands/runserver.py +++ b/django/core/management/commands/runserver.py @@ -1,20 +1,19 @@ from __future__ import unicode_literals -from datetime import datetime import errno import os import re -import sys import socket +import sys +from datetime import datetime +from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError -from django.core.servers.basehttp import run, get_internal_wsgi_application -from django.db import connections, DEFAULT_DB_ALIAS +from django.core.servers.basehttp import get_internal_wsgi_application, run +from django.db import DEFAULT_DB_ALIAS, connections from django.db.migrations.executor import MigrationExecutor -from django.utils import autoreload +from django.utils import autoreload, six from django.utils.encoding import force_text, get_system_encoding -from django.utils import six -from django.core.exceptions import ImproperlyConfigured naiveip_re = re.compile(r"""^(?: (?P<addr> diff --git a/django/core/management/commands/showmigrations.py b/django/core/management/commands/showmigrations.py index b6ef6a2ece..246bea588f 100644 --- a/django/core/management/commands/showmigrations.py +++ b/django/core/management/commands/showmigrations.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import BaseCommand, CommandError -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections from django.db.migrations.loader import MigrationLoader diff --git a/django/core/management/commands/sql.py b/django/core/management/commands/sql.py index 4308c04adc..1b3b1afb9d 100644 --- a/django/core/management/commands/sql.py +++ b/django/core/management/commands/sql.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand from django.core.management.sql import sql_create -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/sqlall.py b/django/core/management/commands/sqlall.py index e7d7d0564d..0a2b9c3997 100644 --- a/django/core/management/commands/sqlall.py +++ b/django/core/management/commands/sqlall.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand from django.core.management.sql import sql_all -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/sqlclear.py b/django/core/management/commands/sqlclear.py index e2d32e9618..279dfcf1b6 100644 --- a/django/core/management/commands/sqlclear.py +++ b/django/core/management/commands/sqlclear.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand from django.core.management.sql import sql_delete -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/sqlcustom.py b/django/core/management/commands/sqlcustom.py index 84f213ca60..050fa19fc1 100644 --- a/django/core/management/commands/sqlcustom.py +++ b/django/core/management/commands/sqlcustom.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand from django.core.management.sql import sql_custom -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/sqldropindexes.py b/django/core/management/commands/sqldropindexes.py index f4789377d4..b9da18e96d 100644 --- a/django/core/management/commands/sqldropindexes.py +++ b/django/core/management/commands/sqldropindexes.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand from django.core.management.sql import sql_destroy_indexes -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/sqlflush.py b/django/core/management/commands/sqlflush.py index 530bdfd7e1..eba9197be7 100644 --- a/django/core/management/commands/sqlflush.py +++ b/django/core/management/commands/sqlflush.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import BaseCommand from django.core.management.sql import sql_flush -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(BaseCommand): diff --git a/django/core/management/commands/sqlindexes.py b/django/core/management/commands/sqlindexes.py index 0fbbb0cdb9..ee1f395731 100644 --- a/django/core/management/commands/sqlindexes.py +++ b/django/core/management/commands/sqlindexes.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand from django.core.management.sql import sql_indexes -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.py index 2358cd5259..14c2742c07 100644 --- a/django/core/management/commands/sqlmigrate.py +++ b/django/core/management/commands/sqlmigrate.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.core.management.base import BaseCommand, CommandError -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections from django.db.migrations.executor import MigrationExecutor from django.db.migrations.loader import AmbiguityError diff --git a/django/core/management/commands/sqlsequencereset.py b/django/core/management/commands/sqlsequencereset.py index 690ea902a4..ea7286c6ac 100644 --- a/django/core/management/commands/sqlsequencereset.py +++ b/django/core/management/commands/sqlsequencereset.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from django.core.management.base import AppCommand -from django.db import connections, DEFAULT_DB_ALIAS +from django.db import DEFAULT_DB_ALIAS, connections class Command(AppCommand): diff --git a/django/core/management/commands/squashmigrations.py b/django/core/management/commands/squashmigrations.py index 13dcb6da67..0087a96007 100644 --- a/django/core/management/commands/squashmigrations.py +++ b/django/core/management/commands/squashmigrations.py @@ -1,11 +1,11 @@ -from django.core.management.base import BaseCommand, CommandError from django.conf import settings -from django.db import connections, DEFAULT_DB_ALIAS, migrations -from django.db.migrations.loader import AmbiguityError +from django.core.management.base import BaseCommand, CommandError +from django.db import DEFAULT_DB_ALIAS, connections, migrations from django.db.migrations.executor import MigrationExecutor -from django.db.migrations.writer import MigrationWriter -from django.db.migrations.optimizer import MigrationOptimizer +from django.db.migrations.loader import AmbiguityError from django.db.migrations.migration import SwappableTuple +from django.db.migrations.optimizer import MigrationOptimizer +from django.db.migrations.writer import MigrationWriter from django.utils import six from django.utils.version import get_docs_version diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py index b89ad62c3e..56f5bd1477 100644 --- a/django/core/management/commands/syncdb.py +++ b/django/core/management/commands/syncdb.py @@ -2,9 +2,9 @@ import warnings from django.apps import apps from django.contrib.auth import get_user_model -from django.db import DEFAULT_DB_ALIAS from django.core.management import call_command from django.core.management.base import BaseCommand +from django.db import DEFAULT_DB_ALIAS from django.utils.deprecation import RemovedInDjango19Warning from django.utils.six.moves import input diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py index 8dbff62653..127ed5c846 100644 --- a/django/core/management/commands/test.py +++ b/django/core/management/commands/test.py @@ -1,6 +1,6 @@ import logging -import sys import os +import sys from django.conf import settings from django.core.management.base import BaseCommand diff --git a/django/core/management/templates.py b/django/core/management/templates.py index b0bd7a7117..6648fafde9 100644 --- a/django/core/management/templates.py +++ b/django/core/management/templates.py @@ -8,18 +8,16 @@ import shutil import stat import sys import tempfile - from os import path import django -from django.template import Template, Context +from django.core.management.base import BaseCommand, CommandError +from django.core.management.utils import handle_extensions +from django.template import Context, Template from django.utils import archive -from django.utils.six.moves.urllib.request import urlretrieve from django.utils._os import rmtree_errorhandler +from django.utils.six.moves.urllib.request import urlretrieve from django.utils.version import get_docs_version -from django.core.management.base import BaseCommand, CommandError -from django.core.management.utils import handle_extensions - _drive_re = re.compile('^([a-z]):', re.I) _url_drive_re = re.compile('^([a-z])[:|]', re.I) diff --git a/django/core/management/utils.py b/django/core/management/utils.py index 7a823424a6..06ed04e377 100644 --- a/django/core/management/utils.py +++ b/django/core/management/utils.py @@ -1,11 +1,11 @@ from __future__ import unicode_literals import os -from subprocess import PIPE, Popen import sys +from subprocess import PIPE, Popen -from django.utils.encoding import force_text, DEFAULT_LOCALE_ENCODING from django.utils import six +from django.utils.encoding import DEFAULT_LOCALE_ENCODING, force_text from .base import CommandError diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py index 614427f9a7..f67295edf9 100644 --- a/django/core/serializers/json.py +++ b/django/core/serializers/json.py @@ -3,8 +3,7 @@ Serialize data to/from JSON """ # Avoid shadowing the standard library json module -from __future__ import absolute_import -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals import datetime import decimal @@ -12,8 +11,9 @@ import json import sys from django.core.serializers.base import DeserializationError -from django.core.serializers.python import Serializer as PythonSerializer -from django.core.serializers.python import Deserializer as PythonDeserializer +from django.core.serializers.python import ( + Deserializer as PythonDeserializer, Serializer as PythonSerializer, +) from django.utils import six from django.utils.timezone import is_aware diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py index f8dd7aebac..137dfc134e 100644 --- a/django/core/serializers/python.py +++ b/django/core/serializers/python.py @@ -9,8 +9,8 @@ from django.apps import apps from django.conf import settings from django.core.serializers import base from django.db import DEFAULT_DB_ALIAS, models -from django.utils.encoding import force_text, is_protected_type from django.utils import six +from django.utils.encoding import force_text, is_protected_type class Serializer(base.Serializer): diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py index 2d8bb187c1..105072b54e 100644 --- a/django/core/serializers/pyyaml.py +++ b/django/core/serializers/pyyaml.py @@ -5,14 +5,16 @@ Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__. """ import decimal -import yaml import sys from io import StringIO -from django.db import models +import yaml + from django.core.serializers.base import DeserializationError -from django.core.serializers.python import Serializer as PythonSerializer -from django.core.serializers.python import Deserializer as PythonDeserializer +from django.core.serializers.python import ( + Deserializer as PythonDeserializer, Serializer as PythonSerializer, +) +from django.db import models from django.utils import six # Use the C (faster) implementation if possible diff --git a/django/core/serializers/xml_serializer.py b/django/core/serializers/xml_serializer.py index 0b759799d2..73bed113b9 100644 --- a/django/core/serializers/xml_serializer.py +++ b/django/core/serializers/xml_serializer.py @@ -4,15 +4,16 @@ XML serializer. from __future__ import unicode_literals +from xml.dom import pulldom +from xml.sax import handler +from xml.sax.expatreader import ExpatParser as _ExpatParser + from django.apps import apps from django.conf import settings from django.core.serializers import base -from django.db import models, DEFAULT_DB_ALIAS -from django.utils.xmlutils import SimplerXMLGenerator +from django.db import DEFAULT_DB_ALIAS, models from django.utils.encoding import smart_text -from xml.dom import pulldom -from xml.sax import handler -from xml.sax.expatreader import ExpatParser as _ExpatParser +from django.utils.xmlutils import SimplerXMLGenerator class Serializer(base.Serializer): diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py index a6dd4d2d0e..38acc987ed 100644 --- a/django/core/servers/basehttp.py +++ b/django/core/servers/basehttp.py @@ -12,7 +12,7 @@ from __future__ import unicode_literals import socket import sys from wsgiref import simple_server -from wsgiref.util import FileWrapper # NOQA: for backwards compatibility +from wsgiref.util import FileWrapper # NOQA: for backwards compatibility from django.core.exceptions import ImproperlyConfigured from django.core.handlers.wsgi import ISO_8859_1, UTF_8 diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index d7383a0422..f7cb13291e 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -9,13 +9,14 @@ a string) and returns a tuple in this format: from __future__ import unicode_literals import functools -from importlib import import_module import re -from threading import local import warnings +from importlib import import_module +from threading import local -from django.http import Http404 from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist +from django.http import Http404 +from django.utils import lru_cache, six from django.utils.datastructures import MultiValueDict from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_str, force_text, iri_to_uri @@ -23,10 +24,8 @@ from django.utils.functional import lazy from django.utils.http import RFC3986_SUBDELIMS, urlquote from django.utils.module_loading import module_has_submodule from django.utils.regex_helper import normalize -from django.utils import six, lru_cache from django.utils.translation import get_language - # SCRIPT_NAME prefixes for each thread are stored here. If there's no entry for # the current thread (which is the only one we ever access), it is assumed to # be empty. diff --git a/django/core/validators.py b/django/core/validators.py index 8d87cef412..bb8224f728 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -3,13 +3,12 @@ from __future__ import unicode_literals import re from django.core.exceptions import ValidationError +from django.utils import six from django.utils.deconstruct import deconstructible -from django.utils.translation import ugettext_lazy as _, ungettext_lazy from django.utils.encoding import force_text from django.utils.ipv6 import is_valid_ipv6_address -from django.utils import six from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit - +from django.utils.translation import ugettext_lazy as _, ungettext_lazy # These values, if given to validate(), will trigger the self.required check. EMPTY_VALUES = (None, '', [], (), {}) |
