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

This commit is contained in:
Tim Graham 2013-10-18 07:25:30 -04:00
parent 9f76ea1eaa
commit 36ded01527
116 changed files with 248 additions and 181 deletions

View File

@ -10,6 +10,14 @@ from django.contrib.admin.filters import (ListFilter, SimpleListFilter,
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)

View File

@ -1,5 +1,4 @@
from __future__ import unicode_literals
import re
from django.core.mail import send_mail
from django.core import validators

View File

@ -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

View File

@ -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

View File

@ -21,7 +21,6 @@ from django.contrib.sessions.middleware import SessionMiddleware
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

View File

@ -5,6 +5,10 @@ from django.contrib.formtools.wizard.storage.base import BaseStorage
from django.contrib.formtools.wizard.storage.exceptions import (
MissingStorage, NoFileStorageConfigured)
__all__ = [
"BaseStorage", "MissingStorage", "NoFileStorageConfigured", "get_storage",
]
def get_storage(path, *args, **kwargs):
try:

View File

@ -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

View File

@ -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)

View File

@ -1,5 +1,7 @@
from django.db.models import Aggregate
__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']
class Collect(Aggregate):
name = 'Collect'

View File

@ -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',
]

View File

@ -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

View File

@ -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

View File

@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
# 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

View File

@ -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

View File

@ -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

View File

@ -5,7 +5,7 @@ from ctypes import c_char_p
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)

View File

@ -1,2 +1,4 @@
from django.contrib.gis.geos import (
GEOSGeometry as Geometry, GEOSException as GeometryException)
__all__ = ['Geometry', 'GeometryException']

View File

@ -3,9 +3,12 @@ The GeoDjango GEOS module. Please consult the GeoDjango documentation
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 @@ if HAS_GEOS:
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',
]

View File

@ -6,6 +6,8 @@ reader and writer classes.
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):

View File

@ -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 @@ from django.contrib.gis.geos.prototypes.geom import (from_hex, from_wkb, from_wk
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

View File

@ -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',
]

View File

@ -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']

View File

@ -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

View File

@ -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

View File

@ -14,19 +14,17 @@ class.
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'

View File

@ -1,6 +1,5 @@
"Database cache backend."
import base64
import time
from datetime import datetime
try:

View File

@ -1 +1,3 @@
from django.core.files.base import File
__all__ = ['File']

View File

@ -17,7 +17,7 @@ from django.utils.encoding import force_str, force_text
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')

View File

@ -17,6 +17,14 @@ from django.core.mail.message import (
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.

View File

@ -265,7 +265,7 @@ class BaseCommand(object):
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:

View File

@ -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

View File

@ -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):

View File

@ -14,12 +14,11 @@ import socket
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

View File

@ -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")

View File

@ -1,2 +1,2 @@
from .migration import Migration
from .operations import *
from .migration import Migration # NOQA
from .operations import * # NOQA

View File

@ -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',
]

View File

@ -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):

View File

@ -3,6 +3,10 @@ Classes to represent the definitions of aggregate functions.
"""
from django.db.models.constants import LOOKUP_SEP
__all__ = [
'Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance',
]
def refs_aggregate(lookup_parts, aggregates):
"""

View File

@ -5,7 +5,7 @@ import sys
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.query_utils import DeferredAttribute, deferred_class_facto
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

View File

@ -25,6 +25,18 @@ from django.utils.encoding import smart_text, force_text, force_bytes
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

View File

@ -8,7 +8,7 @@ import sys
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,

View File

@ -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

View File

@ -1,4 +1,3 @@
from functools import wraps
from importlib import import_module
import os
import pkgutil

View File

@ -6,4 +6,4 @@ See license.txt for original license.
Heavily modified for Django's purposes.
"""
from django.dispatch.dispatcher import Signal, receiver
from django.dispatch.dispatcher import Signal, receiver # NOQA

View File

@ -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

View File

@ -1 +1,3 @@
from django.forms.extras.widgets import *
from django.forms.extras.widgets import SelectDateWidget
__all__ = ['SelectDateWidget']

View File

@ -30,7 +30,7 @@ from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit
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__ = (

View File

@ -15,7 +15,7 @@ from django.utils.html import conditional_escape, format_html
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__ = (

View File

@ -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',
]

View File

@ -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

View File

@ -50,7 +50,7 @@ u'<html></html>'
"""
# 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 @@ from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,
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)

View File

@ -6,7 +6,7 @@ from importlib import import_module
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,

View File

@ -8,3 +8,9 @@ from django.test.testcases import (TestCase, TransactionTestCase,
skipUnlessDBFeature
)
from django.test.utils import override_settings
__all__ = [
'Client', 'RequestFactory', 'TestCase', 'TransactionTestCase',
'SimpleTestCase', 'LiveServerTestCase', 'skipIfDBFeature',
'skipUnlessDBFeature', 'override_settings',
]

View File

@ -12,7 +12,7 @@ import socket
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

View File

@ -44,7 +44,7 @@ except ImportError:
# 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

View File

@ -1,5 +1,4 @@
import logging
import traceback
from django.conf import settings
from django.core import mail
@ -7,8 +6,8 @@ from django.core.mail import get_connection
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

View File

@ -15,7 +15,7 @@ from django.utils.safestring import mark_safe
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:]

View File

@ -7,6 +7,14 @@ from django.views.generic.edit import FormView, CreateView, UpdateView, DeleteVi
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

View File

@ -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

View File

@ -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")

View File

@ -1,5 +1,4 @@
from __future__ import unicode_literals
import warnings
from django.contrib.admin.utils import quote
from django.core.urlresolvers import reverse

View File

@ -1 +1 @@
from django.db import modelz
from django.db import modelz # NOQA

View File

@ -1,7 +1,5 @@
from django.db import models
from ..admin import foo
class Bar(models.Model):
name = models.CharField(max_length=5)

View File

@ -1 +1,3 @@
from ..complex_app.models.bar import Bar
__all__ = ['Bar']

View File

@ -6,7 +6,7 @@ from django.core.exceptions import ImproperlyConfigured
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):

View File

@ -3419,7 +3419,6 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
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/'))

View File

@ -3,10 +3,8 @@ from __future__ import unicode_literals
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

View File

@ -1,4 +1,4 @@
from django.conf.urls import patterns, url
from django.conf.urls import patterns
from . import views

View File

@ -4,7 +4,7 @@ from django.db import models, IntegrityError, connection
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)

View File

@ -3,7 +3,6 @@ import warnings
from django.test import SimpleTestCase, RequestFactory
from django.utils import six
from django.utils.datastructures import MergeDict
from django.utils.deprecation import RenameMethodsBase

View File

@ -15,7 +15,6 @@ try:
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

View File

@ -4,7 +4,6 @@ from __future__ import unicode_literals
from io import BytesIO
import os
import gzip
import shutil
import tempfile
import unittest
import zlib
@ -15,7 +14,6 @@ from django.core.files.move import file_move_safe
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

View File

@ -1,5 +1,4 @@
from django.conf.urls import patterns, url
from django.views.generic.edit import UpdateView
from .views import ArticleFormView

View File

@ -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 (

View File

@ -16,7 +16,7 @@ from django.test.utils import override_settings, TransRealMixin
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.six import PY3
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)

View File

@ -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

View File

@ -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

View File

@ -2,7 +2,6 @@ from __future__ import unicode_literals
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)

View File

@ -5,7 +5,7 @@ import gzip
from io import BytesIO
import random
import re
from unittest import expectedFailure, skipIf
from unittest import skipIf
import warnings
from django.conf import settings

View File

@ -1 +1 @@
import fake_python_module
import fake_python_module # NOQA

View File

@ -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

View File

@ -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

View File

@ -102,7 +102,7 @@ class TextFile(models.Model):
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

View File

@ -1,3 +1,5 @@
# Import all the models from subpackages
from .article import Article
from .publication import Publication
__all__ = ['Article', 'Publication']

View File

@ -4,7 +4,6 @@ from datetime import date
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

View File

@ -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 @@ from .models import (MyPerson, Person, StatusPerson, LowerStatusPerson,
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):

View File

@ -3,7 +3,6 @@ from __future__ import unicode_literals
import pickle
import datetime
from django.db import models
from django.test import TestCase
from .models import Group, Event, Happening, Container, M2MModel

View File

@ -6,9 +6,8 @@ from io import BytesIO
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

View File

@ -1,6 +1,5 @@
from __future__ import unicode_literals
import sys
import time
import unittest

View File

@ -5,7 +5,7 @@ from django.utils import six
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):

View File

@ -14,7 +14,6 @@ except ImportError:
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

View File

@ -26,7 +26,6 @@ from django.db import connection, models
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,

View File

@ -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

View File

@ -4,7 +4,6 @@ import copy
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

View File

@ -1 +1 @@
from django import Xtemplate
from django import Xtemplate # NOQA

View File

@ -1 +1 @@
import nonexistent.module
import nonexistent.module # NOQA

View File

@ -22,7 +22,6 @@ rather than the HTML rendered to the end-user.
"""
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 @@ class ClientTest(TestCase):
except KeyError:
pass
from django.contrib.sessions.models import Session
self.client.post('/test_client/session_view/')
# Check that the session was modified

View File

@ -1,6 +1,5 @@
from contextlib import contextmanager
import os
import sys
from unittest import expectedFailure, TestSuite, TextTestRunner, defaultTestLoader
from django.test import TestCase

View File

@ -5,7 +5,6 @@ from __future__ import unicode_literals
from importlib import import_module
from optparse import make_option
import sys
import unittest
from django.core.exceptions import ImproperlyConfigured

Some files were not shown because too many files have changed in this diff Show More