Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #21302 -- Fixed unused imports and import *.

  • Loading branch information...
commit 36ded01527b690b5df0574492af9cfcc2ea3d1dc 1 parent 9f76ea1
Tim Graham authored October 18, 2013

Showing 116 changed files with 248 additions and 181 deletions. Show diff stats Hide diff stats

  1. 8  django/contrib/admin/__init__.py
  2. 1  django/contrib/auth/models.py
  3. 2  django/contrib/auth/tests/test_decorators.py
  4. 1  django/contrib/auth/tests/test_models.py
  5. 1  django/contrib/auth/tests/test_views.py
  6. 4  django/contrib/formtools/wizard/storage/__init__.py
  7. 17  django/contrib/gis/admin/__init__.py
  8. 8  django/contrib/gis/db/models/__init__.py
  9. 2  django/contrib/gis/db/models/aggregates.py
  10. 4  django/contrib/gis/db/models/sql/__init__.py
  11. 2  django/contrib/gis/db/models/sql/aggregates.py
  12. 6  django/contrib/gis/forms/__init__.py
  13. 2  django/contrib/gis/forms/fields.py
  14. 24  django/contrib/gis/gdal/__init__.py
  15. 3  django/contrib/gis/geoip/__init__.py
  16. 2  django/contrib/gis/geoip/base.py
  17. 2  django/contrib/gis/geometry/backend/geos.py
  18. 13  django/contrib/gis/geos/__init__.py
  19. 2  django/contrib/gis/geos/io.py
  20. 10  django/contrib/gis/geos/prototypes/__init__.py
  21. 5  django/contrib/gis/maps/google/__init__.py
  22. 2  django/contrib/gis/sitemaps/__init__.py
  23. 10  django/contrib/gis/utils/__init__.py
  24. 4  django/contrib/messages/__init__.py
  25. 6  django/core/cache/__init__.py
  26. 1  django/core/cache/backends/db.py
  27. 2  django/core/files/__init__.py
  28. 2  django/core/handlers/wsgi.py
  29. 8  django/core/mail/__init__.py
  30. 2  django/core/management/base.py
  31. 6  django/core/management/commands/squashmigrations.py
  32. 2  django/core/management/validation.py
  33. 3  django/core/servers/basehttp.py
  34. 2  django/core/servers/fastcgi.py
  35. 4  django/db/migrations/__init__.py
  36. 10  django/db/migrations/operations/__init__.py
  37. 31  django/db/models/__init__.py
  38. 4  django/db/models/aggregates.py
  39. 4  django/db/models/base.py
  40. 12  django/db/models/fields/__init__.py
  41. 2  django/db/models/query.py
  42. 4  django/db/models/sql/__init__.py
  43. 1  django/db/utils.py
  44. 2  django/dispatch/__init__.py
  45. 10  django/forms/__init__.py
  46. 4  django/forms/extras/__init__.py
  47. 2  django/forms/fields.py
  48. 2  django/forms/widgets.py
  49. 19  django/http/__init__.py
  50. 2  django/middleware/doc.py
  51. 10  django/template/__init__.py
  52. 2  django/template/base.py
  53. 6  django/test/__init__.py
  54. 2  django/test/testcases.py
  55. 2  django/utils/autoreload.py
  56. 5  django/utils/log.py
  57. 2  django/utils/text.py
  58. 8  django/views/generic/__init__.py
  59. 4  setup.cfg
  60. 3  tests/admin_changelist/admin.py
  61. 1  tests/admin_custom_urls/tests.py
  62. 2  tests/admin_scripts/broken_app/models.py
  63. 2  tests/admin_scripts/complex_app/models/bar.py
  64. 2  tests/admin_scripts/simple_app/models.py
  65. 2  tests/admin_validation/tests.py
  66. 1  tests/admin_views/tests.py
  67. 2  tests/app_loading/tests.py
  68. 2  tests/context_processors/urls.py
  69. 2  tests/delete/tests.py
  70. 1  tests/deprecation/tests.py
  71. 1  tests/file_storage/tests.py
  72. 2  tests/files/tests.py
  73. 1  tests/forms_tests/urls.py
  74. 1  tests/generic_inline_admin/tests.py
  75. 10  tests/i18n/tests.py
  76. 3  tests/logging_tests/tests.py
  77. 1  tests/managers_regress/tests.py
  78. 1  tests/many_to_one_regress/tests.py
  79. 2  tests/middleware/tests.py
  80. 2  tests/migrations/faulty_migrations/import_error/__init__.py
  81. 1  tests/migrations/test_executor.py
  82. 1  tests/migrations/test_optimizer.py
  83. 2  tests/model_forms/models.py
  84. 2  tests/model_package/models/__init__.py
  85. 1  tests/modeladmin/tests.py
  86. 3  tests/proxy_models/tests.py
  87. 1  tests/queryset_pickle/tests.py
  88. 3  tests/requests/tests.py
  89. 1  tests/select_for_update/tests.py
  90. 2  tests/select_related_regress/tests.py
  91. 1  tests/serializers/tests.py
  92. 1  tests/serializers_regress/tests.py
  93. 0  tests/settings_tests/models.py
  94. 3  tests/settings_tests/tests.py
  95. 1  tests/tablespaces/tests.py
  96. 2  tests/template_tests/templatetags/broken_tag.py
  97. 2  tests/template_tests/templatetags/subpackage/echo_invalid.py
  98. 2  tests/test_client/tests.py
  99. 1  tests/test_runner/test_discover_runner.py
  100. 1  tests/test_runner/tests.py
  101. 3  tests/test_runner_deprecation_app/models.py
  102. 3  tests/timezones/tests.py
  103. 2  tests/timezones/urls.py
  104. 2  tests/urlpatterns_reverse/erroneous_views_module.py
  105. 1  tests/urlpatterns_reverse/tests.py
  106. 2  tests/urlpatterns_reverse/views.py
  107. 2  tests/utils_tests/test_crypto.py
  108. 2  tests/utils_tests/test_module/bad_module.py
  109. 2  tests/utils_tests/test_module_loading.py
  110. 1  tests/utils_tests/test_safestring.py
  111. 2  tests/utils_tests/test_text.py
  112. 1  tests/utils_tests/test_timezone.py
  113. 1  tests/version/tests.py
  114. 3  tests/view_tests/generic_urls.py
  115. 3  tests/view_tests/tests/test_defaults.py
  116. 1  tests/view_tests/tests/test_shortcuts.py
8  django/contrib/admin/__init__.py
@@ -10,6 +10,14 @@
10 10
     ChoicesFieldListFilter, DateFieldListFilter, AllValuesFieldListFilter)
11 11
 from django.utils.module_loading import autodiscover_modules
12 12
 
  13
+__all__ = [
  14
+    "register", "ACTION_CHECKBOX_NAME", "ModelAdmin", "HORIZONTAL", "VERTICAL",
  15
+    "StackedInline", "TabularInline", "AdminSite", "site", "ListFilter",
  16
+    "SimpleListFilter", "FieldListFilter", "BooleanFieldListFilter",
  17
+    "RelatedFieldListFilter", "ChoicesFieldListFilter", "DateFieldListFilter",
  18
+    "AllValuesFieldListFilter", "autodiscover",
  19
+]
  20
+
13 21
 
14 22
 def autodiscover():
15 23
     autodiscover_modules('admin', register_to=site)
1  django/contrib/auth/models.py
... ...
@@ -1,5 +1,4 @@
1 1
 from __future__ import unicode_literals
2  
-import re
3 2
 
4 3
 from django.core.mail import send_mail
5 4
 from django.core import validators
2  django/contrib/auth/tests/test_decorators.py
... ...
@@ -1,8 +1,6 @@
1 1
 from django.conf import settings
2 2
 from django.contrib.auth import models
3 3
 from django.contrib.auth.decorators import login_required, permission_required
4  
-# Trigger CustomUser perm creation:
5  
-from django.contrib.auth.tests.custom_user import CustomUser
6 4
 from django.contrib.auth.tests.test_views import AuthViewsTestCase
7 5
 from django.contrib.auth.tests.utils import skipIfCustomUser
8 6
 from django.core.exceptions import PermissionDenied
1  django/contrib/auth/tests/test_models.py
... ...
@@ -1,6 +1,5 @@
1 1
 from django.contrib.auth import get_user_model
2 2
 from django.contrib.auth.models import AbstractUser, Group, User, UserManager
3  
-from django.contrib.auth.tests.custom_user import IsActiveTestUser1
4 3
 from django.contrib.auth.tests.utils import skipIfCustomUser
5 4
 from django.core import mail
6 5
 from django.db.models.signals import post_save
1  django/contrib/auth/tests/test_views.py
@@ -21,7 +21,6 @@
21 21
 from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
22 22
 from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm,
23 23
                 SetPasswordForm)
24  
-from django.contrib.auth.tests.custom_user import CustomUser
25 24
 from django.contrib.auth.tests.utils import skipIfCustomUser
26 25
 from django.contrib.auth.views import login as login_view
27 26
 
4  django/contrib/formtools/wizard/storage/__init__.py
@@ -5,6 +5,10 @@
5 5
 from django.contrib.formtools.wizard.storage.exceptions import (
6 6
     MissingStorage, NoFileStorageConfigured)
7 7
 
  8
+__all__ = [
  9
+    "BaseStorage", "MissingStorage", "NoFileStorageConfigured", "get_storage",
  10
+]
  11
+
8 12
 
9 13
 def get_storage(path, *args, **kwargs):
10 14
     try:
17  django/contrib/gis/admin/__init__.py
... ...
@@ -1,12 +1,21 @@
1 1
 # Getting the normal admin routines, classes, and `site` instance.
2  
-from django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL
3  
-
  2
+from django.contrib.admin import (  # NOQA: flake8 detects only the last __all__
  3
+    autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline,
  4
+    HORIZONTAL, VERTICAL,
  5
+)
4 6
 # Geographic admin options classes and widgets.
5  
-from django.contrib.gis.admin.options import GeoModelAdmin
6  
-from django.contrib.gis.admin.widgets import OpenLayersWidget
  7
+from django.contrib.gis.admin.options import GeoModelAdmin      # NOQA
  8
+from django.contrib.gis.admin.widgets import OpenLayersWidget   # NOQA
  9
+
  10
+__all__ = [
  11
+    "autodiscover", "site", "AdminSite", "ModelAdmin", "StackedInline",
  12
+    "TabularInline", "HORIZONTAL", "VERTICAL",
  13
+    "GeoModelAdmin", "OpenLayersWidget", "HAS_OSM",
  14
+]
7 15
 
8 16
 try:
9 17
     from django.contrib.gis.admin.options import OSMGeoAdmin
10 18
     HAS_OSM = True
  19
+    __all__ += ['OSMGeoAdmin']
11 20
 except ImportError:
12 21
     HAS_OSM = False
8  django/contrib/gis/db/models/__init__.py
... ...
@@ -1,14 +1,14 @@
1 1
 # Want to get everything from the 'normal' models package.
2  
-from django.db.models import *
  2
+from django.db.models import *  # NOQA
3 3
 
4 4
 # Geographic aggregate functions
5  
-from django.contrib.gis.db.models.aggregates import *
  5
+from django.contrib.gis.db.models.aggregates import *  # NOQA
6 6
 
7 7
 # The GeoManager
8  
-from django.contrib.gis.db.models.manager import GeoManager
  8
+from django.contrib.gis.db.models.manager import GeoManager  # NOQA
9 9
 
10 10
 # The geographic-enabled fields.
11  
-from django.contrib.gis.db.models.fields import (
  11
+from django.contrib.gis.db.models.fields import (  # NOQA
12 12
     GeometryField, PointField, LineStringField, PolygonField,
13 13
     MultiPointField, MultiLineStringField, MultiPolygonField,
14 14
     GeometryCollectionField)
2  django/contrib/gis/db/models/aggregates.py
... ...
@@ -1,5 +1,7 @@
1 1
 from django.db.models import Aggregate
2 2
 
  3
+__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']
  4
+
3 5
 
4 6
 class Collect(Aggregate):
5 7
     name = 'Collect'
4  django/contrib/gis/db/models/sql/__init__.py
... ...
@@ -1,3 +1,7 @@
1 1
 from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
2 2
 from django.contrib.gis.db.models.sql.query import GeoQuery
3 3
 from django.contrib.gis.db.models.sql.where import GeoWhereNode
  4
+
  5
+__all__ = [
  6
+    'AreaField', 'DistanceField', 'GeomField', 'GeoQuery', 'GeoWhereNode',
  7
+]
2  django/contrib/gis/db/models/sql/aggregates.py
... ...
@@ -1,4 +1,4 @@
1  
-from django.db.models.sql.aggregates import *
  1
+from django.db.models.sql.aggregates import Aggregate
2 2
 from django.contrib.gis.db.models.fields import GeometryField
3 3
 
4 4
 
6  django/contrib/gis/forms/__init__.py
... ...
@@ -1,5 +1,5 @@
1  
-from django.forms import *
2  
-from .fields import (GeometryField, GeometryCollectionField, PointField,
  1
+from django.forms import *  # NOQA
  2
+from .fields import (GeometryField, GeometryCollectionField, PointField,  # NOQA
3 3
     MultiPointField, LineStringField, MultiLineStringField, PolygonField,
4 4
     MultiPolygonField)
5  
-from .widgets import BaseGeometryWidget, OpenLayersWidget, OSMWidget
  5
+from .widgets import BaseGeometryWidget, OpenLayersWidget, OSMWidget  # NOQA
2  django/contrib/gis/forms/fields.py
@@ -5,7 +5,7 @@
5 5
 
6 6
 # While this couples the geographic forms to the GEOS library,
7 7
 # it decouples from database (by not importing SpatialBackend).
8  
-from django.contrib.gis.geos import GEOSException, GEOSGeometry, fromstr
  8
+from django.contrib.gis.geos import GEOSException, GEOSGeometry
9 9
 from .widgets import OpenLayersWidget
10 10
 
11 11
 
24  django/contrib/gis/gdal/__init__.py
@@ -31,24 +31,34 @@
31 31
  to a non-existant file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`;
32 32
  setting to None/False/'' will not work as a string must be given).
33 33
 """
34  
-from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException
35  
-from django.contrib.gis.gdal.geomtype import OGRGeomType
  34
+from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException  # NOQA
  35
+from django.contrib.gis.gdal.geomtype import OGRGeomType  # NOQA
  36
+
  37
+__all__ = [
  38
+    'check_err', 'OGRException', 'OGRIndexError', 'SRSException', 'OGRGeomType',
  39
+    'HAS_GDAL',
  40
+]
36 41
 
37 42
 # Attempting to import objects that depend on the GDAL library.  The
38 43
 # HAS_GDAL flag will be set to True if the library is present on
39 44
 # the system.
40 45
 try:
41  
-    from django.contrib.gis.gdal.driver import Driver
42  
-    from django.contrib.gis.gdal.datasource import DataSource
43  
-    from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, GDAL_VERSION
44  
-    from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform
45  
-    from django.contrib.gis.gdal.geometries import OGRGeometry
  46
+    from django.contrib.gis.gdal.driver import Driver  # NOQA
  47
+    from django.contrib.gis.gdal.datasource import DataSource  # NOQA
  48
+    from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, GDAL_VERSION  # NOQA
  49
+    from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform  # NOQA
  50
+    from django.contrib.gis.gdal.geometries import OGRGeometry  # NOQA
46 51
     HAS_GDAL = True
  52
+    __all__ += [
  53
+        'Driver', 'DataSource', 'gdal_version', 'gdal_full_version',
  54
+        'GDAL_VERSION', 'SpatialReference', 'CoordTransform', 'OGRGeometry',
  55
+    ]
47 56
 except OGRException:
48 57
     HAS_GDAL = False
49 58
 
50 59
 try:
51 60
     from django.contrib.gis.gdal.envelope import Envelope
  61
+    __all__ += ['Envelope']
52 62
 except ImportError:
53 63
     # No ctypes, but don't raise an exception.
54 64
     pass
3  django/contrib/gis/geoip/__init__.py
@@ -11,8 +11,11 @@
11 11
  Grab GeoIP.dat.gz and GeoLiteCity.dat.gz, and unzip them in the directory
12 12
  corresponding to settings.GEOIP_PATH.
13 13
 """
  14
+__all__ = ['HAS_GEOIP']
  15
+
14 16
 try:
15 17
     from .base import GeoIP, GeoIPException
16 18
     HAS_GEOIP = True
  19
+    __all__ += ['GeoIP', 'GeoIPException']
17 20
 except RuntimeError:  # libgeoip.py raises a RuntimeError if no GeoIP library is found
18 21
     HAS_GEOIP = False
2  django/contrib/gis/geoip/base.py
@@ -5,7 +5,7 @@
5 5
 from django.core.validators import ipv4_re
6 6
 from django.contrib.gis.geoip.libgeoip import GEOIP_SETTINGS
7 7
 from django.contrib.gis.geoip.prototypes import (
8  
-    GeoIPRecord, GeoIPTag, GeoIP_open, GeoIP_delete, GeoIP_database_info,
  8
+    GeoIP_open, GeoIP_delete, GeoIP_database_info,
9 9
     GeoIP_lib_version, GeoIP_record_by_addr, GeoIP_record_by_name,
10 10
     GeoIP_country_code_by_addr, GeoIP_country_code_by_name,
11 11
     GeoIP_country_name_by_addr, GeoIP_country_name_by_name)
2  django/contrib/gis/geometry/backend/geos.py
... ...
@@ -1,2 +1,4 @@
1 1
 from django.contrib.gis.geos import (
2 2
     GEOSGeometry as Geometry, GEOSException as GeometryException)
  3
+
  4
+__all__ = ['Geometry', 'GeometryException']
13  django/contrib/gis/geos/__init__.py
@@ -3,9 +3,12 @@
3 3
 for more details:
4 4
   http://geodjango.org/docs/geos.html
5 5
 """
  6
+__all__ = ['HAS_GEOS']
  7
+
6 8
 try:
7  
-    from .libgeos import geos_version, geos_version_info, GEOS_PREPARE
  9
+    from .libgeos import geos_version, geos_version_info, GEOS_PREPARE  # NOQA: flake8 detects only the last __all__
8 10
     HAS_GEOS = True
  11
+    __all__ += ['geos_version', 'geos_version_info', 'GEOS_PREPARE']
9 12
 except ImportError:
10 13
     HAS_GEOS = False
11 14
 
@@ -18,3 +21,11 @@
18 21
     from .error import GEOSException, GEOSIndexError
19 22
     from .io import WKTReader, WKTWriter, WKBReader, WKBWriter
20 23
     from .factory import fromfile, fromstr
  24
+
  25
+    __all__ += [
  26
+        'GEOSGeometry', 'wkt_regex', 'hex_regex', 'Point', 'LineString',
  27
+        'LinearRing', 'Polygon', 'GeometryCollection', 'MultiPoint',
  28
+        'MultiLineString', 'MultiPolygon', 'GEOSException', 'GEOSIndexError',
  29
+        'WKTReader', 'WKTWriter', 'WKBReader', 'WKBWriter', 'fromfile',
  30
+        'fromstr',
  31
+    ]
2  django/contrib/gis/geos/io.py
@@ -6,6 +6,8 @@
6 6
 from django.contrib.gis.geos.geometry import GEOSGeometry
7 7
 from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter, WKTWriter
8 8
 
  9
+__all__ = ['WKBWriter', 'WKTWriter', 'WKBReader', 'WKTReader']
  10
+
9 11
 
10 12
 # Public classes for (WKB|WKT)Reader, which return GEOSGeometry
11 13
 class WKBReader(_WKBReader):
10  django/contrib/gis/geos/prototypes/__init__.py
@@ -5,12 +5,12 @@
5 5
 """
6 6
 
7 7
 # Coordinate sequence routines.
8  
-from django.contrib.gis.geos.prototypes.coordseq import (create_cs, get_cs,
  8
+from django.contrib.gis.geos.prototypes.coordseq import (create_cs, get_cs,  # NOQA
9 9
     cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz,
10 10
     cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims)
11 11
 
12 12
 # Geometry routines.
13  
-from django.contrib.gis.geos.prototypes.geom import (from_hex, from_wkb, from_wkt,
  13
+from django.contrib.gis.geos.prototypes.geom import (from_hex, from_wkb, from_wkt,  # NOQA
14 14
     create_point, create_linestring, create_linearring, create_polygon, create_collection,
15 15
     destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone,
16 16
     geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid,
@@ -18,13 +18,13 @@
18 18
     to_hex, to_wkb, to_wkt)
19 19
 
20 20
 # Miscellaneous routines.
21  
-from django.contrib.gis.geos.prototypes.misc import *
  21
+from django.contrib.gis.geos.prototypes.misc import *  # NOQA
22 22
 
23 23
 # Predicates
24  
-from django.contrib.gis.geos.prototypes.predicates import (geos_hasz, geos_isempty,
  24
+from django.contrib.gis.geos.prototypes.predicates import (geos_hasz, geos_isempty,  # NOQA
25 25
     geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses,
26 26
     geos_disjoint, geos_equals, geos_equalsexact, geos_intersects,
27 27
     geos_overlaps, geos_relatepattern, geos_touches, geos_within)
28 28
 
29 29
 # Topology routines
30  
-from django.contrib.gis.geos.prototypes.topology import *
  30
+from django.contrib.gis.geos.prototypes.topology import *  # NOQA
5  django/contrib/gis/maps/google/__init__.py
@@ -59,3 +59,8 @@
59 59
 from django.contrib.gis.maps.google.gmap import GoogleMap, GoogleMapSet
60 60
 from django.contrib.gis.maps.google.overlays import GEvent, GIcon, GMarker, GPolygon, GPolyline
61 61
 from django.contrib.gis.maps.google.zoom import GoogleZoom
  62
+
  63
+__all__ = [
  64
+    'GoogleMap', 'GoogleMapSet', 'GEvent', 'GIcon', 'GMarker', 'GPolygon',
  65
+    'GPolyline', 'GoogleZoom',
  66
+]
2  django/contrib/gis/sitemaps/__init__.py
... ...
@@ -1,3 +1,5 @@
1 1
 # Geo-enabled Sitemap classes.
2 2
 from django.contrib.gis.sitemaps.georss import GeoRSSSitemap
3 3
 from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap
  4
+
  5
+__all__ = ['GeoRSSSitemap', 'KMLSitemap', 'KMZSitemap']
10  django/contrib/gis/utils/__init__.py
@@ -4,15 +4,15 @@
4 4
 # Importing the utilities that depend on GDAL, if available.
5 5
 from django.contrib.gis.gdal import HAS_GDAL
6 6
 if HAS_GDAL:
7  
-    from django.contrib.gis.utils.ogrinfo import ogrinfo, sample
8  
-    from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect
9  
-    from django.contrib.gis.utils.srs import add_postgis_srs, add_srs_entry
  7
+    from django.contrib.gis.utils.ogrinfo import ogrinfo, sample  # NOQA
  8
+    from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect  # NOQA
  9
+    from django.contrib.gis.utils.srs import add_postgis_srs, add_srs_entry  # NOQA
10 10
     from django.core.exceptions import ImproperlyConfigured
11 11
     try:
12 12
         # LayerMapping requires DJANGO_SETTINGS_MODULE to be set,
13 13
         # so this needs to be in try/except.
14  
-        from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError
  14
+        from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError  # NOQA
15 15
     except ImproperlyConfigured:
16 16
         pass
17 17
 
18  
-from django.contrib.gis.utils.wkt import precision_wkt
  18
+from django.contrib.gis.utils.wkt import precision_wkt  # NOQA
4  django/contrib/messages/__init__.py
... ...
@@ -1,2 +1,2 @@
1  
-from django.contrib.messages.api import *
2  
-from django.contrib.messages.constants import *
  1
+from django.contrib.messages.api import *  # NOQA
  2
+from django.contrib.messages.constants import *  # NOQA
6  django/core/cache/__init__.py
@@ -14,19 +14,17 @@
14 14
 
15 15
 See docs/topics/cache.txt for information on the public API.
16 16
 """
17  
-import importlib
18  
-
19 17
 from django.conf import settings
20 18
 from django.core import signals
21 19
 from django.core.cache.backends.base import (
22 20
     InvalidCacheBackendError, CacheKeyWarning, BaseCache)
23 21
 from django.core.exceptions import ImproperlyConfigured
24 22
 from django.utils.module_loading import import_by_path
25  
-from django.utils.six.moves.urllib.parse import parse_qsl
26 23
 
27 24
 
28 25
 __all__ = [
29  
-    'get_cache', 'cache', 'DEFAULT_CACHE_ALIAS'
  26
+    'get_cache', 'cache', 'DEFAULT_CACHE_ALIAS', 'InvalidCacheBackendError',
  27
+    'CacheKeyWarning', 'BaseCache',
30 28
 ]
31 29
 
32 30
 DEFAULT_CACHE_ALIAS = 'default'
1  django/core/cache/backends/db.py
... ...
@@ -1,6 +1,5 @@
1 1
 "Database cache backend."
2 2
 import base64
3  
-import time
4 3
 from datetime import datetime
5 4
 
6 5
 try:
2  django/core/files/__init__.py
... ...
@@ -1 +1,3 @@
1 1
 from django.core.files.base import File
  2
+
  3
+__all__ = ['File']
2  django/core/handlers/wsgi.py
@@ -17,7 +17,7 @@
17 17
 from django.utils import six
18 18
 
19 19
 # For backwards compatibility -- lots of code uses this in the wild!
20  
-from django.http.response import REASON_PHRASES as STATUS_CODE_TEXT
  20
+from django.http.response import REASON_PHRASES as STATUS_CODE_TEXT  # NOQA
21 21
 
22 22
 logger = logging.getLogger('django.request')
23 23
 
8  django/core/mail/__init__.py
@@ -17,6 +17,14 @@
17 17
     DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid,
18 18
     BadHeaderError, forbid_multi_line_headers)
19 19
 
  20
+__all__ = [
  21
+    'CachedDnsName', 'DNS_NAME', 'EmailMessage', 'EmailMultiAlternatives',
  22
+    'SafeMIMEText', 'SafeMIMEMultipart', 'DEFAULT_ATTACHMENT_MIME_TYPE',
  23
+    'make_msgid', 'BadHeaderError', 'forbid_multi_line_headers',
  24
+    'get_connection', 'send_mail', 'send_mass_mail', 'mail_admins',
  25
+    'mail_managers',
  26
+]
  27
+
20 28
 
21 29
 def get_connection(backend=None, fail_silently=False, **kwds):
22 30
     """Load an email backend and return an instance of it.
2  django/core/management/base.py
@@ -265,7 +265,7 @@ def execute(self, *args, **options):
265 265
             self.stderr = OutputWrapper(options.get('stderr', sys.stderr), self.style.ERROR)
266 266
 
267 267
         if self.can_import_settings:
268  
-            from django.conf import settings
  268
+            from django.conf import settings  # NOQA
269 269
 
270 270
         saved_locale = None
271 271
         if not self.leave_locale_alone:
6  django/core/management/commands/squashmigrations.py
... ...
@@ -1,16 +1,12 @@
1 1
 import sys
2  
-import os
3 2
 from optparse import make_option
4 3
 
5 4
 from django.core.management.base import BaseCommand, CommandError
6  
-from django.core.exceptions import ImproperlyConfigured
7 5
 from django.utils import six
8 6
 from django.db import connections, DEFAULT_DB_ALIAS, migrations
9  
-from django.db.migrations.loader import MigrationLoader, AmbiguityError
10  
-from django.db.migrations.autodetector import MigrationAutodetector, InteractiveMigrationQuestioner
  7
+from django.db.migrations.loader import AmbiguityError
11 8
 from django.db.migrations.executor import MigrationExecutor
12 9
 from django.db.migrations.writer import MigrationWriter
13  
-from django.db.models.loading import cache
14 10
 from django.db.migrations.optimizer import MigrationOptimizer
15 11
 
16 12
 
2  django/core/management/validation.py
@@ -122,7 +122,7 @@ def get_validation_errors(outfile, app=None):
122 122
                         e.add(opts, invalid_values_msg % f.name)
123 123
             if isinstance(f, models.ImageField):
124 124
                 try:
125  
-                    from django.utils.image import Image
  125
+                    from django.utils.image import Image  # NOQA
126 126
                 except ImportError:
127 127
                     e.add(opts, '"%s": To use ImageFields, you need to install Pillow. Get it at https://pypi.python.org/pypi/Pillow.' % f.name)
128 128
             if isinstance(f, models.BooleanField) and getattr(f, 'null', False):
3  django/core/servers/basehttp.py
@@ -14,12 +14,11 @@
14 14
 import sys
15 15
 import traceback
16 16
 from wsgiref import simple_server
17  
-from wsgiref.util import FileWrapper   # for backwards compatibility
  17
+from wsgiref.util import FileWrapper   # NOQA: for backwards compatibility
18 18
 
19 19
 from django.core.management.color import color_style
20 20
 from django.core.wsgi import get_wsgi_application
21 21
 from django.utils.module_loading import import_by_path
22  
-from django.utils import six
23 22
 from django.utils.six.moves.urllib.parse import urljoin
24 23
 from django.utils.six.moves import socketserver
25 24
 
2  django/core/servers/fastcgi.py
@@ -101,7 +101,7 @@ def runfastcgi(argset=[], **kwargs):
101 101
         return fastcgi_help()
102 102
 
103 103
     try:
104  
-        import flup
  104
+        import flup  # NOQA
105 105
     except ImportError as e:
106 106
         sys.stderr.write("ERROR: %s\n" % e)
107 107
         sys.stderr.write("  Unable to load the flup package.  In order to run django\n")
4  django/db/migrations/__init__.py
... ...
@@ -1,2 +1,2 @@
1  
-from .migration import Migration
2  
-from .operations import *
  1
+from .migration import Migration  # NOQA
  2
+from .operations import *  # NOQA
10  django/db/migrations/operations/__init__.py
... ...
@@ -1,3 +1,11 @@
1  
-from .models import CreateModel, DeleteModel, AlterModelTable, AlterUniqueTogether, AlterIndexTogether
  1
+from .models import (CreateModel, DeleteModel, AlterModelTable,
  2
+    AlterUniqueTogether, AlterIndexTogether)
2 3
 from .fields import AddField, RemoveField, AlterField, RenameField
3 4
 from .special import SeparateDatabaseAndState, RunSQL, RunPython
  5
+
  6
+__all__ = [
  7
+    'CreateModel', 'DeleteModel', 'AlterModelTable', 'AlterUniqueTogether',
  8
+    'AlterIndexTogether',
  9
+    'AddField', 'RemoveField', 'AlterField', 'RenameField',
  10
+    'SeparateDatabaseAndState', 'RunSQL', 'RunPython',
  11
+]
31  django/db/models/__init__.py
... ...
@@ -1,18 +1,23 @@
1 1
 from functools import wraps
2 2
 
3  
-from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
4  
-from django.db.models.loading import get_apps, get_app_path, get_app_paths, get_app, get_models, get_model, register_models, UnavailableApp
5  
-from django.db.models.query import Q, QuerySet
6  
-from django.db.models.expressions import F
7  
-from django.db.models.manager import Manager
8  
-from django.db.models.base import Model
9  
-from django.db.models.aggregates import *
10  
-from django.db.models.fields import *
11  
-from django.db.models.fields.subclassing import SubfieldBase
12  
-from django.db.models.fields.files import FileField, ImageField
13  
-from django.db.models.fields.related import ForeignKey, ForeignObject, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel
14  
-from django.db.models.deletion import CASCADE, PROTECT, SET, SET_NULL, SET_DEFAULT, DO_NOTHING, ProtectedError
15  
-from django.db.models import signals
  3
+from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured  # NOQA
  4
+from django.db.models.loading import (  # NOQA
  5
+    get_apps, get_app_path, get_app_paths, get_app, get_models, get_model,
  6
+    register_models, UnavailableApp)
  7
+from django.db.models.query import Q, QuerySet  # NOQA
  8
+from django.db.models.expressions import F  # NOQA
  9
+from django.db.models.manager import Manager  # NOQA
  10
+from django.db.models.base import Model  # NOQA
  11
+from django.db.models.aggregates import *  # NOQA
  12
+from django.db.models.fields import *  # NOQA
  13
+from django.db.models.fields.subclassing import SubfieldBase        # NOQA
  14
+from django.db.models.fields.files import FileField, ImageField # NOQA
  15
+from django.db.models.fields.related import (  # NOQA
  16
+    ForeignKey, ForeignObject, OneToOneField, ManyToManyField,
  17
+    ManyToOneRel, ManyToManyRel, OneToOneRel)
  18
+from django.db.models.deletion import (  # NOQA
  19
+    CASCADE, PROTECT, SET, SET_NULL, SET_DEFAULT, DO_NOTHING, ProtectedError)
  20
+from django.db.models import signals  # NOQA
16 21
 
17 22
 
18 23
 def permalink(func):
4  django/db/models/aggregates.py
@@ -3,6 +3,10 @@
3 3
 """
4 4
 from django.db.models.constants import LOOKUP_SEP
5 5
 
  6
+__all__ = [
  7
+    'Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance',
  8
+]
  9
+
6 10
 
7 11
 def refs_aggregate(lookup_parts, aggregates):
8 12
     """
4  django/db/models/base.py
@@ -5,7 +5,7 @@
5 5
 from functools import update_wrapper
6 6
 from django.utils.six.moves import zip
7 7
 
8  
-import django.db.models.manager  # Imported to register signal handler.
  8
+import django.db.models.manager  # NOQA: Imported to register signal handler.
9 9
 from django.conf import settings
10 10
 from django.core.exceptions import (ObjectDoesNotExist,
11 11
     MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS)
@@ -19,7 +19,7 @@
19 19
 from django.db.models.deletion import Collector
20 20
 from django.db.models.options import Options
21 21
 from django.db.models import signals
22  
-from django.db.models.loading import register_models, get_model, MODELS_MODULE_NAME
  22
+from django.db.models.loading import get_model, MODELS_MODULE_NAME
23 23
 from django.utils.translation import ugettext_lazy as _
24 24
 from django.utils.functional import curry
25 25
 from django.utils.encoding import force_str, force_text
12  django/db/models/fields/__init__.py
@@ -25,6 +25,18 @@
25 25
 from django.utils.ipv6 import clean_ipv6_address
26 26
 from django.utils import six
27 27
 
  28
+# Avoid "TypeError: Item in ``from list'' not a string" -- unicode_literals
  29
+# makes these strings unicode
  30
+__all__ = [str(x) for x in (
  31
+    'AutoField', 'BLANK_CHOICE_DASH', 'BigIntegerField', 'BinaryField',
  32
+    'BooleanField', 'CharField', 'CommaSeparatedIntegerField', 'DateField',
  33
+    'DateTimeField', 'DecimalField', 'EmailField', 'Empty', 'Field',
  34
+    'FieldDoesNotExist', 'FilePathField', 'FloatField',
  35
+    'GenericIPAddressField', 'IPAddressField', 'IntegerField', 'NOT_PROVIDED',
  36
+    'NullBooleanField', 'PositiveIntegerField', 'PositiveSmallIntegerField',
  37
+    'SlugField', 'SmallIntegerField', 'TextField', 'TimeField', 'URLField',
  38
+)]
  39
+
28 40
 
29 41
 class Empty(object):
30 42
     pass
2  django/db/models/query.py
@@ -8,7 +8,7 @@
8 8
 
9 9
 from django.conf import settings
10 10
 from django.core import exceptions
11  
-from django.db import connections, router, transaction, DatabaseError, IntegrityError
  11
+from django.db import connections, router, transaction, IntegrityError
12 12
 from django.db.models.constants import LOOKUP_SEP
13 13
 from django.db.models.fields import AutoField, Empty
14 14
 from django.db.models.query_utils import (Q, select_related_descend,
4  django/db/models/sql/__init__.py
... ...
@@ -1,6 +1,6 @@
1 1
 from django.db.models.sql.datastructures import EmptyResultSet
2  
-from django.db.models.sql.subqueries import *
3  
-from django.db.models.sql.query import *
  2
+from django.db.models.sql.subqueries import *  # NOQA
  3
+from django.db.models.sql.query import *  # NOQA
4 4
 from django.db.models.sql.where import AND, OR
5 5
 
6 6
 
1  django/db/utils.py
... ...
@@ -1,4 +1,3 @@
1  
-from functools import wraps
2 1
 from importlib import import_module
3 2
 import os
4 3
 import pkgutil
2  django/dispatch/__init__.py
@@ -6,4 +6,4 @@
6 6
 Heavily modified for Django's purposes.
7 7
 """
8 8
 
9  
-from django.dispatch.dispatcher import Signal, receiver
  9
+from django.dispatch.dispatcher import Signal, receiver  # NOQA
10  django/forms/__init__.py
@@ -2,8 +2,8 @@
2 2
 Django validation and HTML form handling.
3 3
 """
4 4
 
5  
-from django.core.exceptions import ValidationError
6  
-from django.forms.fields import *
7  
-from django.forms.forms import *
8  
-from django.forms.models import *
9  
-from django.forms.widgets import *
  5
+from django.core.exceptions import ValidationError  # NOQA
  6
+from django.forms.fields import *  # NOQA
  7
+from django.forms.forms import *  # NOQA
  8
+from django.forms.models import *  # NOQA
  9
+from django.forms.widgets import *  # NOQA
4  django/forms/extras/__init__.py
... ...
@@ -1 +1,3 @@
1  
-from django.forms.extras.widgets import *
  1
+from django.forms.extras.widgets import SelectDateWidget
  2
+
  3
+__all__ = ['SelectDateWidget']
2  django/forms/fields.py
@@ -30,7 +30,7 @@
30 30
 from django.utils.translation import ugettext_lazy as _, ungettext_lazy
31 31
 
32 32
 # Provide this import for backwards compatibility.
33  
-from django.core.validators import EMPTY_VALUES
  33
+from django.core.validators import EMPTY_VALUES  # NOQA
34 34
 
35 35
 
36 36
 __all__ = (
2  django/forms/widgets.py
@@ -15,7 +15,7 @@
15 15
 from django.utils.translation import ugettext_lazy
16 16
 from django.utils.encoding import force_text, python_2_unicode_compatible
17 17
 from django.utils.safestring import mark_safe
18  
-from django.utils import datetime_safe, formats, six
  18
+from django.utils import formats, six
19 19
 from django.utils.six.moves.urllib.parse import urljoin
20 20
 
21 21
 __all__ = (
19  django/http/__init__.py
... ...
@@ -1,10 +1,21 @@
1 1
 from django.http.cookie import SimpleCookie, parse_cookie
2  
-from django.http.request import (HttpRequest, QueryDict, RawPostDataException,
3  
-    UnreadablePostError, build_request_repr)
  2
+from django.http.request import (HttpRequest, QueryDict,
  3
+    RawPostDataException, UnreadablePostError, build_request_repr)
4 4
 from django.http.response import (HttpResponse, StreamingHttpResponse,
5 5
     HttpResponseRedirect, HttpResponsePermanentRedirect,
6 6
     HttpResponseNotModified, HttpResponseBadRequest, HttpResponseForbidden,
7 7
     HttpResponseNotFound, HttpResponseNotAllowed, HttpResponseGone,
8 8
     HttpResponseServerError, Http404, BadHeaderError)
9  
-from django.http.utils import (fix_location_header, conditional_content_removal,
10  
-    fix_IE_for_attach, fix_IE_for_vary)
  9
+from django.http.utils import (fix_location_header,
  10
+    conditional_content_removal, fix_IE_for_attach, fix_IE_for_vary)
  11
+
  12
+__all__ = [
  13
+    'SimpleCookie', 'parse_cookie', 'HttpRequest', 'QueryDict',
  14
+    'RawPostDataException', 'UnreadablePostError', 'build_request_repr',
  15
+    'HttpResponse', 'StreamingHttpResponse', 'HttpResponseRedirect',
  16
+    'HttpResponsePermanentRedirect', 'HttpResponseNotModified',
  17
+    'HttpResponseBadRequest', 'HttpResponseForbidden', 'HttpResponseNotFound',
  18
+    'HttpResponseNotAllowed', 'HttpResponseGone', 'HttpResponseServerError',
  19
+    'Http404', 'BadHeaderError', 'fix_location_header',
  20
+    'conditional_content_removal', 'fix_IE_for_attach', 'fix_IE_for_vary',
  21
+]
2  django/middleware/doc.py
@@ -3,4 +3,4 @@
3 3
 import warnings
4 4
 warnings.warn(__doc__, DeprecationWarning, stacklevel=2)
5 5
 
6  
-from django.contrib.admindocs.middleware import XViewMiddleware
  6
+from django.contrib.admindocs.middleware import XViewMiddleware  # NOQA
10  django/template/__init__.py
@@ -50,7 +50,7 @@
50 50
 """
51 51
 
52 52
 # Template lexing symbols
53  
-from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,
  53
+from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,  # NOQA
54 54
     BLOCK_TAG_START, COMMENT_TAG_END, COMMENT_TAG_START,
55 55
     FILTER_ARGUMENT_SEPARATOR, FILTER_SEPARATOR, SINGLE_BRACE_END,
56 56
     SINGLE_BRACE_START, TOKEN_BLOCK, TOKEN_COMMENT, TOKEN_TEXT, TOKEN_VAR,
@@ -58,22 +58,22 @@
58 58
     VARIABLE_TAG_END, VARIABLE_TAG_START, filter_re, tag_re)
59 59
 
60 60
 # Exceptions
61  
-from django.template.base import (ContextPopException, InvalidTemplateLibrary,
  61
+from django.template.base import (ContextPopException, InvalidTemplateLibrary,  # NOQA
62 62
     TemplateDoesNotExist, TemplateEncodingError, TemplateSyntaxError,
63 63
     VariableDoesNotExist)
64 64
 
65 65
 # Template parts
66  
-from django.template.base import (Context, FilterExpression, Lexer, Node,
  66
+from django.template.base import (Context, FilterExpression, Lexer, Node,  # NOQA
67 67
     NodeList, Parser, RequestContext, Origin, StringOrigin, Template,
68 68
     TextNode, Token, TokenParser, Variable, VariableNode, constant_string,
69 69
     filter_raw_string)
70 70
 
71 71
 # Compiling templates
72  
-from django.template.base import (compile_string, resolve_variable,
  72
+from django.template.base import (compile_string, resolve_variable,  # NOQA
73 73
     unescape_string_literal, generic_tag_compiler)
74 74
 
75 75
 # Library management
76  
-from django.template.base import (Library, add_to_builtins, builtins,
  76
+from django.template.base import (Library, add_to_builtins, builtins,  # NOQA
77 77
     get_library, get_templatetags_modules, get_text_list, import_library,
78 78
     libraries)
79 79
 
2  django/template/base.py
@@ -6,7 +6,7 @@
6 6
 from inspect import getargspec, getcallargs
7 7
 
8 8
 from django.conf import settings
9  
-from django.template.context import (BaseContext, Context, RequestContext,
  9
+from django.template.context import (BaseContext, Context, RequestContext,  # NOQA: imported for backwards compatability
10 10
     ContextPopException)
11 11
 from django.utils.itercompat import is_iterable
12 12
 from django.utils.text import (smart_split, unescape_string_literal,
6  django/test/__init__.py
@@ -8,3 +8,9 @@
8 8
     skipUnlessDBFeature
9 9
 )
10 10
 from django.test.utils import override_settings
  11
+
  12
+__all__ = [
  13
+    'Client', 'RequestFactory', 'TestCase', 'TransactionTestCase',
  14
+    'SimpleTestCase', 'LiveServerTestCase', 'skipIfDBFeature',
  15
+    'skipUnlessDBFeature', 'override_settings',
  16
+]
2  django/test/testcases.py
@@ -12,7 +12,7 @@
12 12
 import sys
13 13
 import threading
14 14
 import unittest
15  
-from unittest import skipIf         # Imported here for backward compatibility
  15
+from unittest import skipIf         # NOQA: Imported here for backward compatibility
16 16
 from unittest.util import safe_repr
17 17
 
18 18
 from django.conf import settings
2  django/utils/autoreload.py
@@ -44,7 +44,7 @@
44 44
 # This import does nothing, but it's necessary to avoid some race conditions
45 45
 # in the threading module. See http://code.djangoproject.com/ticket/2330 .
46 46
 try:
47  
-    import threading
  47
+    import threading  # NOQA
48 48
 except ImportError:
49 49
     pass
50 50
 
5  django/utils/log.py
... ...
@@ -1,5 +1,4 @@
1 1
 import logging
2  
-import traceback
3 2
 
4 3
 from django.conf import settings
5 4
 from django.core import mail
@@ -7,8 +6,8 @@
7 6
 from django.views.debug import ExceptionReporter, get_exception_reporter_filter
8 7
 
9 8
 # Imports kept for backwards-compatibility in Django 1.7.
10  
-from logging import NullHandler
11  
-from logging.config import dictConfig
  9
+from logging import NullHandler  # NOQA
  10
+from logging.config import dictConfig  # NOQA
12 11
 
13 12
 getLogger = logging.getLogger
14 13
 
2  django/utils/text.py
@@ -15,7 +15,7 @@
15 15
 if six.PY2:
16 16
     # Import force_unicode even though this module doesn't use it, because some
17 17
     # people rely on it being here.
18  
-    from django.utils.encoding import force_unicode
  18
+    from django.utils.encoding import force_unicode  # NOQA
19 19
 
20 20
 # Capitalizes the first letter of a string.
21 21
 capfirst = lambda x: x and force_text(x)[0].upper() + force_text(x)[1:]
8  django/views/generic/__init__.py
@@ -7,6 +7,14 @@
7 7
 from django.views.generic.list import ListView
8 8
 
9 9
 
  10
+__all__ = [
  11
+    'View', 'TemplateView', 'RedirectView', 'ArchiveIndexView',
  12
+    'YearArchiveView', 'MonthArchiveView', 'WeekArchiveView', 'DayArchiveView',
  13
+    'TodayArchiveView', 'DateDetailView', 'DetailView', 'FormView',
  14
+    'CreateView', 'UpdateView', 'DeleteView', 'ListView', 'GenericViewError',
  15
+]
  16
+
  17
+
10 18
 class GenericViewError(Exception):
11 19
     """A problem in a generic view."""
12 20
     pass
4  setup.cfg
@@ -3,8 +3,8 @@ doc_files = docs extras AUTHORS INSTALL LICENSE README.rst
3 3
 install-script = scripts/rpm-install.sh
4 4
 
5 5
 [flake8]
6  
-exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py
7  
-ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E261,F401,F403,W601
  6
+exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py,./django/conf/app_template/*
  7
+ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E261,W601
8 8
 
9 9
 [metadata]
10 10
 license-file = LICENSE
3  tests/admin_changelist/admin.py
... ...
@@ -1,8 +1,7 @@
1 1
 from django.contrib import admin
2 2
 from django.core.paginator import Paginator
3 3
 
4  
-from .models import (Event, Child, Parent, Genre, Band, Musician, Group,
5  
-    Quartet, Membership, ChordsMusician, ChordsBand, Invitation, Swallow)
  4
+from .models import Event, Child, Parent, Swallow
6 5
 
7 6
 
8 7
 site = admin.AdminSite(name="admin")
1  tests/admin_custom_urls/tests.py
... ...
@@ -1,5 +1,4 @@
1 1
 from __future__ import unicode_literals
2  
-import warnings
3 2
 
4 3
 from django.contrib.admin.utils import quote
5 4
 from django.core.urlresolvers import reverse
2  tests/admin_scripts/broken_app/models.py
... ...
@@ -1 +1 @@
1  
-from django.db import modelz
  1
+from django.db import modelz  # NOQA
2  tests/admin_scripts/complex_app/models/bar.py
... ...
@@ -1,7 +1,5 @@
1 1
 from django.db import models
2 2
 
3  
-from ..admin import foo
4  
-
5 3
 
6 4
 class Bar(models.Model):
7 5
     name = models.CharField(max_length=5)
2  tests/admin_scripts/simple_app/models.py
... ...
@@ -1 +1,3 @@
1 1
 from ..complex_app.models.bar import Bar
  2
+
  3
+__all__ = ['Bar']
2  tests/admin_validation/tests.py
@@ -6,7 +6,7 @@
6 6
 from django.test import TestCase
7 7
 from django.test.utils import str_prefix
8 8
 
9  
-from .models import Song, Book, Album, TwoAlbumFKAndAnE, State, City
  9
+from .models import Song, Book, Album, TwoAlbumFKAndAnE, City
10 10
 
11 11
 
12 12
 class SongForm(forms.ModelForm):
1  tests/admin_views/tests.py
@@ -3419,7 +3419,6 @@ def test_prepopulated_fields(self):
3419 3419
         main form and with stacked and tabular inlines.
3420 3420
         Refs #13068, #9264, #9983, #9784.
3421 3421
         """
3422  
-        from selenium.common.exceptions import TimeoutException
3423 3422
         self.admin_login(username='super', password='secret', login_url='/test_admin/admin/')
3424 3423
         self.selenium.get('%s%s' % (self.live_server_url,
3425 3424
             '/test_admin/admin/admin_views/mainprepopulated/add/'))
2  tests/app_loading/tests.py
@@ -3,10 +3,8 @@
3 3
 import copy
4 4
 import os
5 5
 import sys
6  
-import time
7 6
 from unittest import TestCase
8 7
 
9  
-from django.conf import Settings
10 8
 from django.db.models.loading import cache, load_app, get_model, get_models, AppCache
11 9
 from django.test.utils import override_settings
12 10
 from django.utils._os import upath
2  tests/context_processors/urls.py
... ...
@@ -1,4 +1,4 @@
1  
-from django.conf.urls import patterns, url
  1
+from django.conf.urls import patterns
2 2
 
3 3
 from . import views
4 4
 
2  tests/delete/tests.py
@@ -4,7 +4,7 @@
4 4
 from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
5 5
 from django.utils.six.moves import xrange
6 6
 
7  
-from .models import (R, RChild, S, T, U, A, M, MR, MRNull,
  7
+from .models import (R, RChild, S, T, A, M, MR, MRNull,
8 8
     create_a, get_default_r, User, Avatar, HiddenUser, HiddenUserProfile,
9 9
     M2MTo, M2MFrom, Parent, Child, Base)
10 10
 
1  tests/deprecation/tests.py
@@ -3,7 +3,6 @@
3 3
 
4 4
 from django.test import SimpleTestCase, RequestFactory
5 5
 from django.utils import six
6  
-from django.utils.datastructures import MergeDict
7 6
 from django.utils.deprecation import RenameMethodsBase
8 7
 
9 8
 
1  tests/file_storage/tests.py
@@ -15,7 +15,6 @@
15 15
 except ImportError:
16 16
     import dummy_threading as threading
17 17
 
18  
-from django.conf import settings
19 18
 from django.core.cache import cache
20 19
 from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
21 20
 from django.core.files.base import File, ContentFile
2  tests/files/tests.py
@@ -4,7 +4,6 @@
4 4
 from io import BytesIO
5 5
 import os
6 6
 import gzip
7  
-import shutil
8 7
 import tempfile
9 8
 import unittest
10 9
 import zlib
@@ -15,7 +14,6 @@
15 14
 from django.core.files.base import ContentFile
16 15
 from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile
17 16
 from django.core.files.temp import NamedTemporaryFile
18  
-from django.test import TestCase
19 17
 from django.utils._os import upath
20 18
 from django.utils import six
21 19
 
1  tests/forms_tests/urls.py
... ...
@@ -1,5 +1,4 @@
1 1
 from django.conf.urls import patterns, url
2  
-from django.views.generic.edit import UpdateView
3 2
 
4 3
 from .views import ArticleFormView
5 4
 
1  tests/generic_inline_admin/tests.py
@@ -2,7 +2,6 @@
2 2
 from __future__ import unicode_literals
3 3
 import warnings
4 4
 
5  
-from django.conf import settings
6 5
 from django.contrib import admin
7 6
 from django.contrib.admin.sites import AdminSite
8 7
 from django.contrib.contenttypes.generic import (
10  tests/i18n/tests.py
@@ -16,7 +16,7 @@
16 16
 from django.utils import translation
17 17
 from django.utils.formats import (get_format, date_format, time_format,
18 18
     localize, localize_input, iter_format_modules, get_format_modules,
19  
-    number_format, reset_format_cache, sanitize_separators)
  19
+    reset_format_cache, sanitize_separators)
20 20
 from django.utils.numberformat import format as nformat
21 21
 from django.utils._os import upath
22 22
 from django.utils.safestring import mark_safe, SafeBytes, SafeString, SafeText
@@ -25,11 +25,11 @@
25 25
 from django.utils.translation import (activate, deactivate,
26 26
     get_language,  get_language_from_request, get_language_info,
27 27
     to_locale, trans_real,
28  
-    gettext, gettext_lazy,
  28
+    gettext_lazy,
29 29
     ugettext, ugettext_lazy,
30  
-    ngettext, ngettext_lazy,
31  
-    ungettext, ungettext_lazy,
32  
-    pgettext, pgettext_lazy,
  30
+    ngettext_lazy,
  31
+    ungettext_lazy,
  32
+    pgettext,
33 33
     npgettext, npgettext_lazy,
34 34
     check_for_language)
35 35
 
3  tests/logging_tests/tests.py
... ...
@@ -1,9 +1,6 @@
1 1
 from __future__ import unicode_literals
2 2
 
3  
-import copy
4 3
 import logging
5  
-import sys
6  
-from unittest import skipUnless
7 4
 import warnings
8 5
 
9 6
 from django.conf import LazySettings
1  tests/managers_regress/tests.py
... ...
@@ -1,7 +1,6 @@
1 1
 from __future__ import unicode_literals
2 2
 import copy
3 3
 
4  
-from django.conf import settings
5 4
 from django.db import models
6 5
 from django.db.models.loading import cache
7 6
 from django.template import Context, Template
1  tests/many_to_one_regress/tests.py
@@ -2,7 +2,6 @@
2 2
 
3 3
 from django.db import models
4 4
 from django.test import TestCase
5  
-from django.utils import six
6 5
 
7 6
 from .models import (
8 7
     First, Third, Parent, Child, Category, Record, Relation, Car, Driver)
2  tests/middleware/tests.py