Skip to content

Commit

Permalink
Sorted imports in __init__.py files.
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Jun 27, 2015
1 parent 4a66a69 commit 7da3923
Show file tree
Hide file tree
Showing 33 changed files with 182 additions and 166 deletions.
6 changes: 4 additions & 2 deletions django/apps/__init__.py
Original file line number Diff line number Diff line change
@@ -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']
2 changes: 1 addition & 1 deletion django/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import importlib
import os
import time # Needed for Windows
import time
import warnings

from django.conf import global_settings
Expand Down
7 changes: 4 additions & 3 deletions django/conf/urls/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
14 changes: 8 additions & 6 deletions django/contrib/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion django/contrib/auth/management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
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):
Expand Down
6 changes: 2 additions & 4 deletions django/contrib/gis/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
18 changes: 6 additions & 12 deletions django/contrib/gis/db/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion django/contrib/gis/db/models/sql/__init__.py
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
9 changes: 6 additions & 3 deletions django/contrib/gis/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions django/contrib/gis/gdal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand Down
10 changes: 6 additions & 4 deletions django/contrib/gis/geos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
38 changes: 16 additions & 22 deletions django/contrib/gis/geos/prototypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion django/contrib/gis/maps/google/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand Down
5 changes: 2 additions & 3 deletions django/contrib/gis/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,5 +15,3 @@
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError # NOQA
except ImproperlyConfigured:
pass

from django.contrib.gis.utils.wkt import precision_wkt # NOQA
3 changes: 1 addition & 2 deletions django/contrib/sitemaps/__init__.py
Original file line number Diff line number Diff line change
@@ -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"


Expand Down
1 change: 1 addition & 0 deletions django/contrib/webdesign/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django.utils.deprecation import RemovedInDjango110Warning


default_app_config = 'django.contrib.webdesign.apps.WebDesignConfig'

warnings.warn(
Expand Down
4 changes: 2 additions & 2 deletions django/core/cache/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
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',
Expand Down
19 changes: 10 additions & 9 deletions django/core/checks/__init__.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
15 changes: 7 additions & 8 deletions django/core/mail/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
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',
Expand Down
7 changes: 4 additions & 3 deletions django/core/management/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion django/core/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

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 = {
Expand Down
11 changes: 6 additions & 5 deletions django/db/__init__.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
12 changes: 7 additions & 5 deletions django/db/migrations/operations/__init__.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Loading

0 comments on commit 7da3923

Please sign in to comment.