Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

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