diff --git a/django/apps/__init__.py b/django/apps/__init__.py index de0f303846..79091dc535 100644 --- a/django/apps/__init__.py +++ b/django/apps/__init__.py @@ -1,2 +1,4 @@ -from .config import AppConfig # NOQA -from .registry import apps # NOQA +from .config import AppConfig +from .registry import apps + +__all__ = ['AppConfig', 'apps'] diff --git a/django/conf/__init__.py b/django/conf/__init__.py index bbc0fb92cd..76f1e9f9a2 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -8,7 +8,7 @@ a list of all possible variables. import importlib import os -import time # Needed for Windows +import time import warnings from django.conf import global_settings diff --git a/django/conf/urls/__init__.py b/django/conf/urls/__init__.py index 4a7fef9f78..ab67fd30a5 100644 --- a/django/conf/urls/__init__.py +++ b/django/conf/urls/__init__.py @@ -1,9 +1,10 @@ -from importlib import import_module import warnings +from importlib import import_module -from django.core.urlresolvers import (RegexURLPattern, - RegexURLResolver, LocaleRegexURLResolver) from django.core.exceptions import ImproperlyConfigured +from django.core.urlresolvers import ( + LocaleRegexURLResolver, RegexURLPattern, RegexURLResolver, +) from django.utils import six from django.utils.deprecation import ( RemovedInDjango20Warning, RemovedInDjango110Warning, diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py index cf110ed97c..23f51fabdd 100644 --- a/django/contrib/admin/__init__.py +++ b/django/contrib/admin/__init__.py @@ -1,13 +1,15 @@ # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here # has been referenced in documentation. from django.contrib.admin.decorators import register +from django.contrib.admin.filters import ( + AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter, + DateFieldListFilter, FieldListFilter, ListFilter, RelatedFieldListFilter, + RelatedOnlyFieldListFilter, SimpleListFilter, +) from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME -from django.contrib.admin.options import (HORIZONTAL, VERTICAL, - ModelAdmin, StackedInline, TabularInline) -from django.contrib.admin.filters import (ListFilter, SimpleListFilter, - FieldListFilter, BooleanFieldListFilter, RelatedFieldListFilter, - ChoicesFieldListFilter, DateFieldListFilter, AllValuesFieldListFilter, - RelatedOnlyFieldListFilter) +from django.contrib.admin.options import ( + HORIZONTAL, VERTICAL, ModelAdmin, StackedInline, TabularInline, +) from django.contrib.admin.sites import AdminSite, site from django.utils.module_loading import autodiscover_modules diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py index a8b69f66d5..6380d2f0c3 100644 --- a/django/contrib/auth/management/__init__.py +++ b/django/contrib/auth/management/__init__.py @@ -11,8 +11,8 @@ from django.contrib.auth import get_permission_codename from django.core import exceptions from django.core.management.base import CommandError from django.db import DEFAULT_DB_ALIAS, router -from django.utils.encoding import DEFAULT_LOCALE_ENCODING from django.utils import six +from django.utils.encoding import DEFAULT_LOCALE_ENCODING def _get_all_permissions(opts, ctype): diff --git a/django/contrib/gis/admin/__init__.py b/django/contrib/gis/admin/__init__.py index 79e51e4303..32d7bf9ab4 100644 --- a/django/contrib/gis/admin/__init__.py +++ b/django/contrib/gis/admin/__init__.py @@ -1,9 +1,7 @@ -# Getting the normal admin routines, classes, and `site` instance. from django.contrib.admin import ( - autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, - HORIZONTAL, VERTICAL, + HORIZONTAL, VERTICAL, AdminSite, ModelAdmin, StackedInline, TabularInline, + autodiscover, site, ) -# Geographic admin options classes and widgets. from django.contrib.gis.admin.options import GeoModelAdmin, OSMGeoAdmin from django.contrib.gis.admin.widgets import OpenLayersWidget diff --git a/django/contrib/gis/db/models/__init__.py b/django/contrib/gis/db/models/__init__.py index bbba20dca8..c2025b05a1 100644 --- a/django/contrib/gis/db/models/__init__.py +++ b/django/contrib/gis/db/models/__init__.py @@ -1,14 +1,8 @@ -# Want to get everything from the 'normal' models package. -from django.db.models import * # NOQA - -# Geographic aggregate functions +from django.db.models import * # NOQA isort:skip from django.contrib.gis.db.models.aggregates import * # NOQA - -# The GeoManager -from django.contrib.gis.db.models.manager import GeoManager # NOQA - -# The geographic-enabled fields. from django.contrib.gis.db.models.fields import ( # NOQA - GeometryField, PointField, LineStringField, PolygonField, - MultiPointField, MultiLineStringField, MultiPolygonField, - GeometryCollectionField, RasterField) + GeometryCollectionField, GeometryField, LineStringField, + MultiLineStringField, MultiPointField, MultiPolygonField, PointField, + PolygonField, RasterField, +) +from django.contrib.gis.db.models.manager import GeoManager # NOQA diff --git a/django/contrib/gis/db/models/sql/__init__.py b/django/contrib/gis/db/models/sql/__init__.py index a00e6ba38e..d2a4f703e8 100644 --- a/django/contrib/gis/db/models/sql/__init__.py +++ b/django/contrib/gis/db/models/sql/__init__.py @@ -1,4 +1,6 @@ -from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField, GMLField +from django.contrib.gis.db.models.sql.conversion import ( + AreaField, DistanceField, GeomField, GMLField, +) __all__ = [ 'AreaField', 'DistanceField', 'GeomField', 'GMLField' diff --git a/django/contrib/gis/forms/__init__.py b/django/contrib/gis/forms/__init__.py index b689d6076c..237cbace8d 100644 --- a/django/contrib/gis/forms/__init__.py +++ b/django/contrib/gis/forms/__init__.py @@ -1,5 +1,8 @@ from django.forms import * # NOQA -from .fields import (GeometryField, GeometryCollectionField, PointField, # NOQA - MultiPointField, LineStringField, MultiLineStringField, PolygonField, - MultiPolygonField) + +from .fields import ( # NOQA + GeometryCollectionField, GeometryField, LineStringField, + MultiLineStringField, MultiPointField, MultiPolygonField, PointField, + PolygonField, +) from .widgets import BaseGeometryWidget, OpenLayersWidget, OSMWidget # NOQA diff --git a/django/contrib/gis/gdal/__init__.py b/django/contrib/gis/gdal/__init__.py index d356a17f09..1dad9aa9ab 100644 --- a/django/contrib/gis/gdal/__init__.py +++ b/django/contrib/gis/gdal/__init__.py @@ -31,8 +31,9 @@ to a non-existent file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`; setting to None/False/'' will not work as a string must be given). """ -from django.contrib.gis.gdal.error import (check_err, GDALException, - OGRException, OGRIndexError, SRSException) # NOQA +from django.contrib.gis.gdal.error import ( # NOQA + GDALException, OGRException, OGRIndexError, SRSException, check_err, +) from django.contrib.gis.gdal.geomtype import OGRGeomType # NOQA __all__ = [ diff --git a/django/contrib/gis/geos/__init__.py b/django/contrib/gis/geos/__init__.py index 3eed86f7b9..e8d70d07ad 100644 --- a/django/contrib/gis/geos/__init__.py +++ b/django/contrib/gis/geos/__init__.py @@ -2,13 +2,15 @@ The GeoDjango GEOS module. Please consult the GeoDjango documentation for more details: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/ """ -from .collections import GeometryCollection, MultiPoint, MultiLineString, MultiPolygon # NOQA +from .collections import ( # NOQA + GeometryCollection, MultiLineString, MultiPoint, MultiPolygon, +) from .error import GEOSException, GEOSIndexError # NOQA from .factory import fromfile, fromstr # NOQA -from .geometry import GEOSGeometry, wkt_regex, hex_regex # NOQA -from .io import WKTReader, WKTWriter, WKBReader, WKBWriter # NOQA +from .geometry import GEOSGeometry, hex_regex, wkt_regex # NOQA +from .io import WKBReader, WKBWriter, WKTReader, WKTWriter # NOQA from .libgeos import geos_version, geos_version_info # NOQA -from .linestring import LineString, LinearRing # NOQA +from .linestring import LinearRing, LineString # NOQA from .point import Point # NOQA from .polygon import Polygon # NOQA diff --git a/django/contrib/gis/geos/prototypes/__init__.py b/django/contrib/gis/geos/prototypes/__init__.py index 72c9d7a0c1..d2950d0d97 100644 --- a/django/contrib/gis/geos/prototypes/__init__.py +++ b/django/contrib/gis/geos/prototypes/__init__.py @@ -4,27 +4,21 @@ via ctypes. """ -# Coordinate sequence routines. -from django.contrib.gis.geos.prototypes.coordseq import (create_cs, get_cs, # NOQA - cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz, - cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims) - -# Geometry routines. -from django.contrib.gis.geos.prototypes.geom import (from_hex, from_wkb, from_wkt, # NOQA - create_point, create_linestring, create_linearring, create_polygon, create_collection, - destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone, - geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid, - get_dims, get_num_coords, get_num_geoms, - to_hex, to_wkb, to_wkt) - -# Miscellaneous routines. +from django.contrib.gis.geos.prototypes.coordseq import ( # NOQA + create_cs, cs_clone, cs_getdims, cs_getordinate, cs_getsize, cs_getx, + cs_gety, cs_getz, cs_setordinate, cs_setx, cs_sety, cs_setz, get_cs, +) +from django.contrib.gis.geos.prototypes.geom import ( # NOQA + create_collection, create_linearring, create_linestring, create_point, + create_polygon, destroy_geom, from_hex, from_wkb, from_wkt, geom_clone, + geos_get_srid, geos_normalize, geos_set_srid, geos_type, geos_typeid, + get_dims, get_extring, get_geomn, get_intring, get_nrings, get_num_coords, + get_num_geoms, to_hex, to_wkb, to_wkt, +) from django.contrib.gis.geos.prototypes.misc import * # NOQA - -# Predicates -from django.contrib.gis.geos.prototypes.predicates import (geos_hasz, geos_isempty, # NOQA - geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses, - geos_disjoint, geos_equals, geos_equalsexact, geos_intersects, - geos_overlaps, geos_relatepattern, geos_touches, geos_within) - -# Topology routines +from django.contrib.gis.geos.prototypes.predicates import ( # NOQA + geos_contains, geos_crosses, geos_disjoint, geos_equals, geos_equalsexact, + geos_hasz, geos_intersects, geos_isempty, geos_isring, geos_issimple, + geos_isvalid, geos_overlaps, geos_relatepattern, geos_touches, geos_within, +) from django.contrib.gis.geos.prototypes.topology import * # NOQA diff --git a/django/contrib/gis/maps/google/__init__.py b/django/contrib/gis/maps/google/__init__.py index 3254892cb5..3de7366eff 100644 --- a/django/contrib/gis/maps/google/__init__.py +++ b/django/contrib/gis/maps/google/__init__.py @@ -58,7 +58,9 @@ version. """ from django.contrib.gis.maps.google.gmap import GoogleMap, GoogleMapSet -from django.contrib.gis.maps.google.overlays import GEvent, GIcon, GMarker, GPolygon, GPolyline +from django.contrib.gis.maps.google.overlays import ( + GEvent, GIcon, GMarker, GPolygon, GPolyline, +) from django.contrib.gis.maps.google.zoom import GoogleZoom __all__ = [ diff --git a/django/contrib/gis/utils/__init__.py b/django/contrib/gis/utils/__init__.py index f6050e6b95..137cd08f92 100644 --- a/django/contrib/gis/utils/__init__.py +++ b/django/contrib/gis/utils/__init__.py @@ -1,8 +1,9 @@ """ This module contains useful utilities for GeoDjango. """ -# Importing the utilities that depend on GDAL, if available. from django.contrib.gis.gdal import HAS_GDAL +from django.contrib.gis.utils.wkt import precision_wkt # NOQA + if HAS_GDAL: from django.contrib.gis.utils.ogrinfo import ogrinfo, sample # NOQA from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect # NOQA @@ -14,5 +15,3 @@ if HAS_GDAL: from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError # NOQA except ImproperlyConfigured: pass - -from django.contrib.gis.utils.wkt import precision_wkt # NOQA diff --git a/django/contrib/sitemaps/__init__.py b/django/contrib/sitemaps/__init__.py index 0fc646d36a..1b626cd984 100644 --- a/django/contrib/sitemaps/__init__.py +++ b/django/contrib/sitemaps/__init__.py @@ -1,12 +1,11 @@ from django.apps import apps as django_apps from django.conf import settings -from django.core import urlresolvers, paginator +from django.core import paginator, urlresolvers from django.core.exceptions import ImproperlyConfigured from django.utils import translation from django.utils.six.moves.urllib.parse import urlencode from django.utils.six.moves.urllib.request import urlopen - PING_URL = "http://www.google.com/webmasters/tools/ping" diff --git a/django/contrib/webdesign/__init__.py b/django/contrib/webdesign/__init__.py index eacf09612c..b8e6ba1e2a 100644 --- a/django/contrib/webdesign/__init__.py +++ b/django/contrib/webdesign/__init__.py @@ -2,6 +2,7 @@ import warnings from django.utils.deprecation import RemovedInDjango110Warning + default_app_config = 'django.contrib.webdesign.apps.WebDesignConfig' warnings.warn( diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index e5296814a3..93a887a058 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -17,11 +17,11 @@ from threading import local from django.conf import settings from django.core import signals from django.core.cache.backends.base import ( - InvalidCacheBackendError, CacheKeyWarning, BaseCache) + BaseCache, CacheKeyWarning, InvalidCacheBackendError, +) from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string - __all__ = [ 'cache', 'DEFAULT_CACHE_ALIAS', 'InvalidCacheBackendError', 'CacheKeyWarning', 'BaseCache', diff --git a/django/core/checks/__init__.py b/django/core/checks/__init__.py index b96b5ba4e4..0ad4682d49 100644 --- a/django/core/checks/__init__.py +++ b/django/core/checks/__init__.py @@ -1,17 +1,18 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from .messages import (CheckMessage, - Debug, Info, Warning, Error, Critical, - DEBUG, INFO, WARNING, ERROR, CRITICAL) -from .registry import register, run_checks, tag_exists, Tags +from .messages import ( + CRITICAL, DEBUG, ERROR, INFO, WARNING, CheckMessage, Critical, Debug, + Error, Info, Warning, +) +from .registry import Tags, register, run_checks, tag_exists # Import these to force registration of checks -import django.core.checks.model_checks # NOQA -import django.core.checks.security.base # NOQA -import django.core.checks.security.csrf # NOQA -import django.core.checks.security.sessions # NOQA -import django.core.checks.templates # NOQA +import django.core.checks.model_checks # NOQA isort:skip +import django.core.checks.security.base # NOQA isort:skip +import django.core.checks.security.csrf # NOQA isort:skip +import django.core.checks.security.sessions # NOQA isort:skip +import django.core.checks.templates # NOQA isort:skip __all__ = [ 'CheckMessage', diff --git a/django/core/mail/__init__.py b/django/core/mail/__init__.py index cef9d1b87b..9fb3bdb42b 100644 --- a/django/core/mail/__init__.py +++ b/django/core/mail/__init__.py @@ -4,18 +4,17 @@ Tools for sending email. from __future__ import unicode_literals from django.conf import settings -from django.utils.module_loading import import_string - -# Imported for backwards compatibility, and for the sake +# Imported for backwards compatibility and for the sake # of a cleaner namespace. These symbols used to be in # django/core/mail.py before the introduction of email # backends and the subsequent reorganization (See #10355) -from django.core.mail.utils import CachedDnsName, DNS_NAME from django.core.mail.message import ( - EmailMessage, EmailMultiAlternatives, - SafeMIMEText, SafeMIMEMultipart, - DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid, - BadHeaderError, forbid_multi_line_headers) + DEFAULT_ATTACHMENT_MIME_TYPE, BadHeaderError, EmailMessage, + EmailMultiAlternatives, SafeMIMEMultipart, SafeMIMEText, + forbid_multi_line_headers, make_msgid, +) +from django.core.mail.utils import DNS_NAME, CachedDnsName +from django.utils.module_loading import import_string __all__ = [ 'CachedDnsName', 'DNS_NAME', 'EmailMessage', 'EmailMultiAlternatives', diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index e0333eb2e9..aa43a8a9ca 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -1,17 +1,18 @@ from __future__ import unicode_literals import collections -from importlib import import_module import os import pkgutil import sys +from importlib import import_module import django from django.apps import apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.core.management.base import (BaseCommand, CommandError, - CommandParser, handle_default_options) +from django.core.management.base import ( + BaseCommand, CommandError, CommandParser, handle_default_options, +) from django.core.management.color import color_style from django.utils import lru_cache, six from django.utils._os import npath, upath diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py index 19216bdfa7..b3f23b223a 100644 --- a/django/core/serializers/__init__.py +++ b/django/core/serializers/__init__.py @@ -20,8 +20,8 @@ import importlib from django.apps import apps from django.conf import settings -from django.utils import six from django.core.serializers.base import SerializerDoesNotExist +from django.utils import six # Built-in serializers BUILTIN_SERIALIZERS = { diff --git a/django/db/__init__.py b/django/db/__init__.py index a98121b4f9..7b45dafdd0 100644 --- a/django/db/__init__.py +++ b/django/db/__init__.py @@ -1,9 +1,10 @@ from django.core import signals -from django.db.utils import (DEFAULT_DB_ALIAS, DJANGO_VERSION_PICKLE_KEY, - DataError, OperationalError, IntegrityError, InternalError, ProgrammingError, - NotSupportedError, DatabaseError, InterfaceError, Error, ConnectionHandler, - ConnectionRouter) - +from django.db.utils import ( + DEFAULT_DB_ALIAS, DJANGO_VERSION_PICKLE_KEY, ConnectionHandler, + ConnectionRouter, DatabaseError, DataError, Error, IntegrityError, + InterfaceError, InternalError, NotSupportedError, OperationalError, + ProgrammingError, +) __all__ = [ 'backend', 'connection', 'connections', 'router', 'DatabaseError', diff --git a/django/db/migrations/operations/__init__.py b/django/db/migrations/operations/__init__.py index 5e069ffb59..472b482eff 100644 --- a/django/db/migrations/operations/__init__.py +++ b/django/db/migrations/operations/__init__.py @@ -1,8 +1,10 @@ -from .models import (CreateModel, DeleteModel, AlterModelTable, - AlterUniqueTogether, AlterIndexTogether, RenameModel, AlterModelOptions, - AlterOrderWithRespectTo, AlterModelManagers) -from .fields import AddField, RemoveField, AlterField, RenameField -from .special import SeparateDatabaseAndState, RunSQL, RunPython +from .fields import AddField, AlterField, RemoveField, RenameField +from .models import ( + AlterIndexTogether, AlterModelManagers, AlterModelOptions, AlterModelTable, + AlterOrderWithRespectTo, AlterUniqueTogether, CreateModel, DeleteModel, + RenameModel, +) +from .special import RunPython, RunSQL, SeparateDatabaseAndState __all__ = [ 'CreateModel', 'DeleteModel', 'AlterModelTable', 'AlterUniqueTogether', diff --git a/django/db/models/__init__.py b/django/db/models/__init__.py index 4d8ea38898..5d9e14ab46 100644 --- a/django/db/models/__init__.py +++ b/django/db/models/__init__.py @@ -1,24 +1,28 @@ from functools import wraps -from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured # NOQA -from django.db.models.query import Q, QuerySet, Prefetch # NOQA -from django.db.models.expressions import ( # NOQA - Expression, ExpressionWrapper, F, Value, Func, Case, When, -) -from django.db.models.manager import Manager # NOQA -from django.db.models.base import Model # NOQA -from django.db.models.aggregates import * # NOQA -from django.db.models.fields import * # NOQA -from django.db.models.fields.subclassing import SubfieldBase # NOQA -from django.db.models.fields.files import FileField, ImageField # NOQA -from django.db.models.fields.related import ( # NOQA - ForeignKey, ForeignObject, OneToOneField, ManyToManyField, - ManyToOneRel, ManyToManyRel, OneToOneRel) -from django.db.models.fields.proxy import OrderWrt # NOQA -from django.db.models.deletion import ( # NOQA - CASCADE, PROTECT, SET, SET_NULL, SET_DEFAULT, DO_NOTHING, ProtectedError) -from django.db.models.lookups import Lookup, Transform # NOQA +from django.core.exceptions import ObjectDoesNotExist # NOQA from django.db.models import signals # NOQA +from django.db.models.aggregates import * # NOQA +from django.db.models.deletion import ( # NOQA + CASCADE, DO_NOTHING, PROTECT, SET, SET_DEFAULT, SET_NULL, ProtectedError, +) +from django.db.models.expressions import ( # NOQA + F, Case, Expression, ExpressionWrapper, Func, Value, When, +) +from django.db.models.fields import * # NOQA +from django.db.models.fields.files import FileField, ImageField # NOQA +from django.db.models.fields.proxy import OrderWrt # NOQA +from django.db.models.fields.subclassing import SubfieldBase # NOQA +from django.db.models.lookups import Lookup, Transform # NOQA +from django.db.models.manager import Manager # NOQA +from django.db.models.query import Q, Prefetch, QuerySet # NOQA + +# Imports that would create circular imports if sorted +from django.db.models.base import Model # NOQA isort:skip +from django.db.models.fields.related import ( # NOQA isort:skip + ForeignKey, ForeignObject, OneToOneField, ManyToManyField, + ManyToOneRel, ManyToManyRel, OneToOneRel, +) def permalink(func): diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index abea9258ad..5ae1aa3dc7 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -11,31 +11,34 @@ import warnings from base64 import b64decode, b64encode from functools import total_ordering -from django.apps import apps -from django.db import connection -from django.db.models.lookups import default_lookups, RegisterLookupMixin, Transform, Lookup -from django.db.models.query_utils import QueryWrapper -from django.conf import settings from django import forms -from django.core import exceptions, validators, checks -from django.utils.datastructures import DictWrapper -from django.utils.dateparse import parse_date, parse_datetime, parse_time, parse_duration -from django.utils.duration import duration_string -from django.utils.functional import cached_property, curry, Promise -from django.utils.text import capfirst -from django.utils import timezone -from django.utils.deprecation import RemovedInDjango20Warning -from django.utils.translation import ugettext_lazy as _ -from django.utils.encoding import (smart_text, force_text, force_bytes, - python_2_unicode_compatible) -from django.utils.ipv6 import clean_ipv6_address -from django.utils import six -from django.utils.itercompat import is_iterable - +from django.apps import apps +from django.conf import settings +from django.core import checks, exceptions, validators # When the _meta object was formalized, this exception was moved to # django.core.exceptions. It is retained here for backwards compatibility # purposes. from django.core.exceptions import FieldDoesNotExist # NOQA +from django.db import connection +from django.db.models.lookups import ( + Lookup, RegisterLookupMixin, Transform, default_lookups, +) +from django.db.models.query_utils import QueryWrapper +from django.utils import six, timezone +from django.utils.datastructures import DictWrapper +from django.utils.dateparse import ( + parse_date, parse_datetime, parse_duration, parse_time, +) +from django.utils.deprecation import RemovedInDjango20Warning +from django.utils.duration import duration_string +from django.utils.encoding import ( + force_bytes, force_text, python_2_unicode_compatible, smart_text, +) +from django.utils.functional import Promise, cached_property, curry +from django.utils.ipv6 import clean_ipv6_address +from django.utils.itercompat import is_iterable +from django.utils.text import capfirst +from django.utils.translation import ugettext_lazy as _ # Avoid "TypeError: Item in ``from list'' not a string" -- unicode_literals # makes these strings unicode diff --git a/django/db/models/sql/__init__.py b/django/db/models/sql/__init__.py index d1898bab6e..80c12584fd 100644 --- a/django/db/models/sql/__init__.py +++ b/django/db/models/sql/__init__.py @@ -1,7 +1,6 @@ from django.db.models.sql.datastructures import EmptyResultSet -from django.db.models.sql.subqueries import * # NOQA from django.db.models.sql.query import * # NOQA +from django.db.models.sql.subqueries import * # NOQA from django.db.models.sql.where import AND, OR - __all__ = ['Query', 'AND', 'OR', 'EmptyResultSet'] diff --git a/django/http/__init__.py b/django/http/__init__.py index 6f433b39b8..254446ce99 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -1,12 +1,14 @@ from django.http.cookie import SimpleCookie, parse_cookie -from django.http.request import (HttpRequest, QueryDict, - RawPostDataException, UnreadablePostError, build_request_repr) +from django.http.request import ( + HttpRequest, QueryDict, RawPostDataException, UnreadablePostError, + build_request_repr, +) from django.http.response import ( - HttpResponse, StreamingHttpResponse, FileResponse, - HttpResponseRedirect, HttpResponsePermanentRedirect, - HttpResponseNotModified, HttpResponseBadRequest, HttpResponseForbidden, - HttpResponseNotFound, HttpResponseNotAllowed, HttpResponseGone, - HttpResponseServerError, Http404, BadHeaderError, JsonResponse, + BadHeaderError, FileResponse, Http404, HttpResponse, + HttpResponseBadRequest, HttpResponseForbidden, HttpResponseGone, + HttpResponseNotAllowed, HttpResponseNotFound, HttpResponseNotModified, + HttpResponsePermanentRedirect, HttpResponseRedirect, + HttpResponseServerError, JsonResponse, StreamingHttpResponse, ) from django.http.utils import conditional_content_removal diff --git a/django/template/__init__.py b/django/template/__init__.py index 7ca21a188f..63b3d7ba4d 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -42,10 +42,8 @@ Shared: # Multiple Template Engines from .engine import Engine - from .utils import EngineHandler - engines = EngineHandler() __all__ = ('Engine', 'engines') @@ -54,19 +52,20 @@ __all__ = ('Engine', 'engines') # Django Template Language # Public exceptions -from .base import VariableDoesNotExist # NOQA -from .context import ContextPopException # NOQA -from .exceptions import TemplateDoesNotExist, TemplateSyntaxError # NOQA +from .base import VariableDoesNotExist # NOQA isort:skip +from .context import ContextPopException # NOQA isort:skip +from .exceptions import TemplateDoesNotExist, TemplateSyntaxError # NOQA isort:skip # Template parts -from .base import (Context, Node, NodeList, Origin, RequestContext, # NOQA - Template, Variable) +from .base import ( # NOQA isort:skip + Context, Node, NodeList, Origin, RequestContext, Template, Variable, +) # Deprecated in Django 1.8, will be removed in Django 1.10. -from .base import resolve_variable # NOQA +from .base import resolve_variable # NOQA isort:skip # Library management -from .library import Library # NOQA +from .library import Library # NOQA isort:skip __all__ += ('Template', 'Context', 'RequestContext') diff --git a/django/test/__init__.py b/django/test/__init__.py index 884b1c5ee3..7ba1e7f282 100644 --- a/django/test/__init__.py +++ b/django/test/__init__.py @@ -4,12 +4,13 @@ Django Unit Test and Doctest framework. from django.test.client import Client, RequestFactory from django.test.testcases import ( - TestCase, TransactionTestCase, - SimpleTestCase, LiveServerTestCase, skipIfDBFeature, - skipUnlessAnyDBFeature, skipUnlessDBFeature + LiveServerTestCase, SimpleTestCase, TestCase, TransactionTestCase, + skipIfDBFeature, skipUnlessAnyDBFeature, skipUnlessDBFeature, +) +from django.test.utils import ( + ignore_warnings, modify_settings, override_settings, + override_system_checks, ) -from django.test.utils import (ignore_warnings, modify_settings, - override_settings, override_system_checks) __all__ = [ 'Client', 'RequestFactory', 'TestCase', 'TransactionTestCase', diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py index 506fcce7dd..246936e403 100644 --- a/django/utils/translation/__init__.py +++ b/django/utils/translation/__init__.py @@ -2,12 +2,13 @@ Internationalization support. """ from __future__ import unicode_literals + import re + +from django.utils import six from django.utils.decorators import ContextDecorator from django.utils.encoding import force_text from django.utils.functional import lazy -from django.utils import six - __all__ = [ 'activate', 'deactivate', 'override', 'deactivate_all', diff --git a/django/views/generic/__init__.py b/django/views/generic/__init__.py index d0dbd53256..bc32403fc7 100644 --- a/django/views/generic/__init__.py +++ b/django/views/generic/__init__.py @@ -1,12 +1,14 @@ -from django.views.generic.base import View, TemplateView, RedirectView -from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView, - WeekArchiveView, DayArchiveView, TodayArchiveView, - DateDetailView) +from django.views.generic.base import RedirectView, TemplateView, View +from django.views.generic.dates import ( + ArchiveIndexView, DateDetailView, DayArchiveView, MonthArchiveView, + TodayArchiveView, WeekArchiveView, YearArchiveView, +) from django.views.generic.detail import DetailView -from django.views.generic.edit import FormView, CreateView, UpdateView, DeleteView +from django.views.generic.edit import ( + CreateView, DeleteView, FormView, UpdateView, +) from django.views.generic.list import ListView - __all__ = [ 'View', 'TemplateView', 'RedirectView', 'ArchiveIndexView', 'YearArchiveView', 'MonthArchiveView', 'WeekArchiveView', 'DayArchiveView', diff --git a/setup.cfg b/setup.cfg index 365dc627b9..64b31f97d5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,6 +13,7 @@ default_section = THIRDPARTY include_trailing_comma = true known_first_party = django multi_line_output = 5 +not_skip = __init__.py [metadata] license-file = LICENSE diff --git a/tests/auth_tests/models/__init__.py b/tests/auth_tests/models/__init__.py index 72afdf2358..ec6b6099db 100644 --- a/tests/auth_tests/models/__init__.py +++ b/tests/auth_tests/models/__init__.py @@ -1,11 +1,11 @@ from .custom_permissions import CustomPermissionsUser -from .is_active import IsActiveTestUser1 from .invalid_models import ( - CustomUserNonUniqueUsername, CustomUserNonListRequiredFields, - CustomUserBadRequiredFields, + CustomUserBadRequiredFields, CustomUserNonListRequiredFields, + CustomUserNonUniqueUsername, ) -from .with_foreign_key import CustomUserWithFK, Email +from .is_active import IsActiveTestUser1 from .uuid_pk import UUIDUser +from .with_foreign_key import CustomUserWithFK, Email __all__ = ( 'CustomPermissionsUser', 'CustomUserNonUniqueUsername',