Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Adrian Holovaty authored July 22, 2008

Showing 34 changed files with 30 additions and 61 deletions. Show diff stats Hide diff stats

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

0 notes on commit 29f0e81

Please sign in to comment.
Something went wrong with that request. Please try again.