Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7847 -- Removed a whole bunch of unused imports from throughou…

…t the codebase. Thanks, julien

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 29f0e8182f49e2927ae46e748d09d0672d4fc127 1 parent cf2a059
@adrianholovaty adrianholovaty authored
Showing with 30 additions and 61 deletions.
  1. +1 −2  django/contrib/admin/options.py
  2. +0 −1  django/contrib/admin/views/main.py
  3. +1 −2  django/contrib/admin/widgets.py
  4. +1 −1  django/contrib/admindocs/views.py
  5. +1 −1  django/contrib/auth/admin.py
  6. +2 −2 django/contrib/auth/decorators.py
  7. +0 −1  django/contrib/auth/forms.py
  8. +1 −1  django/contrib/auth/management/commands/createsuperuser.py
  9. +0 −1  django/contrib/databrowse/plugins/calendars.py
  10. +0 −1  django/contrib/databrowse/plugins/fieldchoices.py
  11. +1 −1  django/contrib/databrowse/sites.py
  12. +0 −2  django/contrib/databrowse/views.py
  13. +0 −1  django/contrib/formtools/tests.py
  14. +0 −2  django/contrib/sessions/backends/cache.py
  15. +0 −3  django/contrib/sessions/backends/db.py
  16. +1 −1  django/contrib/syndication/feeds.py
  17. +1 −2  django/core/files/uploadhandler.py
  18. +0 −1  django/core/management/commands/compilemessages.py
  19. +0 −1  django/core/management/commands/test.py
  20. +0 −1  django/core/management/commands/testserver.py
  21. +0 −1  django/db/backends/oracle/base.py
  22. +0 −2  django/db/models/__init__.py
  23. +1 −2  django/db/models/base.py
  24. +0 −2  django/db/models/fields/related.py
  25. +0 −1  django/db/models/sql/query.py
  26. +16 −16 django/dispatch/dispatcher.py
  27. +0 −1  django/dispatch/saferef.py
  28. +1 −1  django/forms/fields.py
  29. +1 −1  django/forms/formsets.py
  30. +0 −1  django/forms/models.py
  31. +0 −1  django/forms/util.py
  32. +1 −1  django/utils/dateformat.py
  33. +0 −2  django/utils/encoding.py
  34. +0 −1  django/views/generic/simple.py
View
3  django/contrib/admin/options.py
@@ -1,5 +1,4 @@
-from django import oldforms, template
-from django import forms
+from django import forms, template
from django.forms.formsets import all_valid
from django.forms.models import modelform_factory, inlineformset_factory
from django.forms.models import BaseInlineFormset
View
1  django/contrib/admin/views/main.py
@@ -6,7 +6,6 @@
from django.db.models.query import QuerySet
from django.utils.encoding import force_unicode, smart_str
from django.utils.translation import ugettext
-from django.utils.safestring import mark_safe
from django.utils.http import urlencode
import operator
View
3  django/contrib/admin/widgets.py
@@ -7,8 +7,7 @@
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
-from django.utils.datastructures import MultiValueDict
-from django.utils.text import capfirst, truncate_words
+from django.utils.text import truncate_words
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
View
2  django/contrib/admindocs/views.py
@@ -5,7 +5,7 @@
from django.db import models
from django.shortcuts import render_to_response
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
-from django.http import Http404, get_host
+from django.http import Http404
from django.core import urlresolvers
from django.contrib.admindocs import utils
from django.contrib.sites.models import Site
View
2  django/contrib/auth/admin.py
@@ -1,6 +1,6 @@
from django.contrib.auth.models import User, Group
from django.core.exceptions import PermissionDenied
-from django import oldforms, template
+from django import template
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext, ugettext_lazy as _
View
4 django/contrib/auth/decorators.py
@@ -1,7 +1,7 @@
try:
- from functools import wraps, update_wrapper
+ from functools import update_wrapper
except ImportError:
- from django.utils.functional import wraps, update_wrapper # Python 2.3, 2.4 fallback.
+ from django.utils.functional import update_wrapper # Python 2.3, 2.4 fallback.
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
View
1  django/contrib/auth/forms.py
@@ -2,7 +2,6 @@
from django.contrib.auth import authenticate
from django.contrib.sites.models import Site
from django.template import Context, loader
-from django.core import validators
from django import forms
from django.utils.translation import ugettext_lazy as _
View
2  django/contrib/auth/management/commands/createsuperuser.py
@@ -7,7 +7,7 @@
import re
import sys
from optparse import make_option
-from django.contrib.auth.models import User, UNUSABLE_PASSWORD
+from django.contrib.auth.models import User
from django.core import validators
from django.core.management.base import BaseCommand, CommandError
View
1  django/contrib/databrowse/plugins/calendars.py
@@ -4,7 +4,6 @@
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
-from django.utils.translation import get_date_formats
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
from django.views.generic import date_based
View
1  django/contrib/databrowse/plugins/fieldchoices.py
@@ -6,7 +6,6 @@
from django.utils.text import capfirst
from django.utils.encoding import smart_str, force_unicode
from django.utils.safestring import mark_safe
-from django.views.generic import date_based
import urllib
class FieldChoicePlugin(DatabrowsePlugin):
View
2  django/contrib/databrowse/sites.py
@@ -1,6 +1,6 @@
from django import http
from django.db import models
-from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
+from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
View
2  django/contrib/databrowse/views.py
@@ -1,7 +1,5 @@
-from django.db.models import FieldDoesNotExist, DateTimeField
from django.http import Http404
from django.shortcuts import render_to_response
-from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
###########
# CHOICES #
View
1  django/contrib/formtools/tests.py
@@ -1,7 +1,6 @@
from django import forms
from django.contrib.formtools import preview
from django import http
-from django.conf import settings
from django.test import TestCase
success_string = "Done was called!"
View
2  django/contrib/sessions/backends/cache.py
@@ -1,8 +1,6 @@
-from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
from django.core.cache import cache
-
class SessionStore(SessionBase):
"""
A cache-based session store.
View
3  django/contrib/sessions/backends/db.py
@@ -1,11 +1,8 @@
import datetime
-
-from django.conf import settings
from django.contrib.sessions.models import Session
from django.contrib.sessions.backends.base import SessionBase
from django.core.exceptions import SuspiciousOperation
-
class SessionStore(SessionBase):
"""
Implements database session store.
View
2  django/contrib/syndication/feeds.py
@@ -1,5 +1,5 @@
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
-from django.template import Context, loader, Template, TemplateDoesNotExist
+from django.template import loader, Template, TemplateDoesNotExist
from django.contrib.sites.models import Site, RequestSite
from django.utils import feedgenerator
from django.utils.encoding import smart_unicode, iri_to_uri
View
3  django/core/files/uploadhandler.py
@@ -1,8 +1,7 @@
"""
Base file upload handler classes, and the built-in concrete subclasses
"""
-import os
-import tempfile
+
try:
from cStringIO import StringIO
except ImportError:
View
1  django/core/management/commands/compilemessages.py
@@ -2,7 +2,6 @@
import sys
from optparse import make_option
from django.core.management.base import BaseCommand
-from django.core.management.color import no_style
try:
set
View
1  django/core/management/commands/test.py
@@ -17,7 +17,6 @@ class Command(BaseCommand):
def handle(self, *test_labels, **options):
from django.conf import settings
- from django.db.models import get_app, get_apps
verbosity = int(options.get('verbosity', 1))
interactive = options.get('interactive', True)
View
1  django/core/management/commands/testserver.py
@@ -17,7 +17,6 @@ class Command(BaseCommand):
requires_model_validation = False
def handle(self, *fixture_labels, **options):
- from django.conf import settings
from django.core.management import call_command
from django.test.utils import create_test_db
View
1  django/db/backends/oracle/base.py
@@ -8,7 +8,6 @@
from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, BaseDatabaseOperations, util
from django.db.backends.oracle import query
-from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_str, force_unicode
# Oracle takes client-side character set encoding from the environment.
View
2  django/db/models/__init__.py
@@ -10,8 +10,6 @@
from django.db.models.fields.subclassing import SubfieldBase
from django.db.models.fields.related import ForeignKey, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel, TABULAR, STACKED
from django.db.models import signals
-from django.utils.functional import curry
-from django.utils.text import capfirst
# Admin stages.
ADD, CHANGE, BOTH = 1, 2, 3
View
3  django/db/models/base.py
@@ -12,7 +12,7 @@
import django.db.models.manager # Ditto.
from django.core import validators
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError
-from django.db.models.fields import AutoField, ImageField, FieldDoesNotExist
+from django.db.models.fields import AutoField, ImageField
from django.db.models.fields.related import OneToOneRel, ManyToOneRel, OneToOneField
from django.db.models.query import delete_objects, Q, CollectedObjects
from django.db.models.options import Options
@@ -20,7 +20,6 @@
from django.db.models import signals
from django.db.models.loading import register_models, get_model
from django.dispatch import dispatcher
-from django.utils.datastructures import SortedDict
from django.utils.functional import curry
from django.utils.encoding import smart_str, force_unicode, smart_unicode
from django.core.files.move import file_move_safe
View
2  django/db/models/fields/related.py
@@ -4,10 +4,8 @@
from django.db.models.related import RelatedObject
from django.db.models.query import QuerySet
from django.db.models.query_utils import QueryWrapper
-from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy, string_concat, ungettext, ugettext as _
from django.utils.functional import curry
-from django.utils.encoding import smart_unicode
from django.core import validators
from django import oldforms
from django import forms
View
1  django/db/models/sql/query.py
@@ -7,7 +7,6 @@
all about the internals of models in order to get the information it needs.
"""
-import datetime
from copy import deepcopy
from django.utils.tree import Node
View
32 django/dispatch/dispatcher.py
@@ -25,7 +25,7 @@
deletion, (considerably speeds up the cleanup process
vs. the original code.)
"""
-import types, weakref
+import weakref
from django.dispatch import saferef, robustapply, errors
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
@@ -129,7 +129,7 @@ def connect(receiver, signal=Any, sender=Any, weak=True):
"""
if signal is None:
raise errors.DispatcherTypeError(
- 'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
+ 'Signal cannot be None (receiver=%r sender=%r)' % (receiver, sender)
)
if weak:
receiver = saferef.safeRef(receiver, onDelete=_removeReceiver)
@@ -159,7 +159,7 @@ def remove(object, senderkey=senderkey):
else:
receivers = signals[signal] = []
try:
- current = sendersBack.get( receiverID )
+ current = sendersBack.get(receiverID)
if current is None:
sendersBack[ receiverID ] = current = []
if senderkey not in current:
@@ -199,7 +199,7 @@ def disconnect(receiver, signal=Any, sender=Any, weak=True):
"""
if signal is None:
raise errors.DispatcherTypeError(
- 'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
+ 'Signal cannot be None (receiver=%r sender=%r)' % (receiver, sender)
)
if weak: receiver = saferef.safeRef(receiver)
senderkey = id(sender)
@@ -226,7 +226,7 @@ def disconnect(receiver, signal=Any, sender=Any, weak=True):
)
_cleanupConnections(senderkey, signal)
-def getReceivers( sender = Any, signal = Any ):
+def getReceivers(sender=Any, signal=Any):
"""Get list of receivers from global tables
This utility function allows you to retrieve the
@@ -240,7 +240,7 @@ def getReceivers( sender = Any, signal = Any ):
rather than, for instance a list to which you
might append new records.
- Normally you would use liveReceivers( getReceivers( ...))
+ Normally you would use liveReceivers(getReceivers(...))
to retrieve the actual receiver objects as an iterable
object.
"""
@@ -258,7 +258,7 @@ def liveReceivers(receivers):
receivers.
"""
for receiver in receivers:
- if isinstance( receiver, WEAKREF_TYPES):
+ if isinstance(receiver, WEAKREF_TYPES):
# Dereference the weak reference.
receiver = receiver()
if receiver is not None:
@@ -268,7 +268,7 @@ def liveReceivers(receivers):
-def getAllReceivers( sender = Any, signal = Any ):
+def getAllReceivers(sender=Any, signal=Any):
"""Get list of all receivers from global tables
This gets all dereferenced receivers which should receive
@@ -363,7 +363,7 @@ def send(signal=Any, sender=Anonymous, *arguments, **named):
return responses
-def sendExact( signal=Any, sender=Anonymous, *arguments, **named ):
+def sendExact(signal=Any, sender=Anonymous, *arguments, **named ):
"""Send signal only to those receivers registered for exact message
sendExact allows for avoiding Any/Anonymous registered
@@ -403,7 +403,7 @@ def _removeReceiver(receiver):
pass
else:
try:
- receivers.remove( receiver )
+ receivers.remove(receiver)
except Exception, err:
pass
_cleanupConnections(senderkey, signal)
@@ -439,11 +439,11 @@ def _removeSender(senderkey):
senders.pop(senderkey, None)
-def _removeBackrefs( senderkey):
+def _removeBackrefs(senderkey):
"""Remove all back-references to this senderkey"""
for receiver_list in connections.pop(senderkey, {}).values():
for receiver in receiver_list:
- _killBackref( receiver, senderkey )
+ _killBackref(receiver, senderkey)
def _removeOldBackRefs(senderkey, signal, receiver, receivers):
@@ -473,18 +473,18 @@ def _removeOldBackRefs(senderkey, signal, receiver, receivers):
found = 1
break
if not found:
- _killBackref( oldReceiver, senderkey )
+ _killBackref(oldReceiver, senderkey)
return True
return False
-def _killBackref( receiver, senderkey ):
+def _killBackref(receiver, senderkey):
"""Do the actual removal of back reference from receiver to senderkey"""
receiverkey = id(receiver)
- receivers_list = sendersBack.get( receiverkey, () )
+ receivers_list = sendersBack.get(receiverkey, ())
while senderkey in receivers_list:
try:
- receivers_list.remove( senderkey )
+ receivers_list.remove(senderkey)
except:
break
if not receivers_list:
View
1  django/dispatch/saferef.py
@@ -1,6 +1,5 @@
"""Refactored "safe reference" from dispatcher.py"""
import weakref, traceback
-from django.utils.functional import curry
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
View
2  django/forms/fields.py
@@ -23,7 +23,7 @@
from sets import Set as set
from django.utils.translation import ugettext_lazy as _
-from django.utils.encoding import StrAndUnicode, smart_unicode, smart_str
+from django.utils.encoding import smart_unicode, smart_str
from util import ErrorList, ValidationError
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput
View
2  django/forms/formsets.py
@@ -2,7 +2,7 @@
from django.utils.encoding import StrAndUnicode
from django.utils.safestring import mark_safe
from fields import IntegerField, BooleanField
-from widgets import Media, HiddenInput, TextInput
+from widgets import Media, HiddenInput
from util import ErrorList, ValidationError
__all__ = ('BaseFormSet', 'all_valid')
View
1  django/forms/models.py
@@ -8,7 +8,6 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.datastructures import SortedDict
-from django.core.exceptions import ImproperlyConfigured
from util import ValidationError, ErrorList
from forms import BaseForm, get_declared_fields
View
1  django/forms/util.py
@@ -1,6 +1,5 @@
from django.utils.html import escape
from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode
-from django.utils.functional import Promise
from django.utils.safestring import mark_safe
def flatatt(attrs):
View
2  django/utils/dateformat.py
@@ -13,7 +13,7 @@
from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR
from django.utils.tzinfo import LocalTimezone
-from django.utils.translation import string_concat, ugettext as _
+from django.utils.translation import ugettext as _
from django.utils.encoding import force_unicode
from calendar import isleap, monthrange
import re, time
View
2  django/utils/encoding.py
@@ -1,9 +1,7 @@
import types
import urllib
import datetime
-
from django.utils.functional import Promise
-from django.utils.safestring import SafeData, mark_safe
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
View
1  django/views/generic/simple.py
@@ -1,4 +1,3 @@
-from django.shortcuts import render_to_response
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
Please sign in to comment.
Something went wrong with that request. Please try again.