Opened 16 years ago

Closed 16 years ago

#6736 closed (invalid)

unused imports

Reported by: Bernd Schlapsi Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

I have good experience with PyFlakes. It helps my to find some "errors" in my code. Today I started pyflakes to check the django source-code. I found a lot of imported but unused messages. I don't really know if every unused import is really unused, because these tools have problems with generic code, but I think some of this imports could be really unused. (I removed the lines with unused imports from any __init__.py)

django/db/models/query.py:4: 'loading' imported but unused
django/db/models/query.py:16: 'set' imported but unused
django/db/models/base.py:2: 'django' imported but unused
django/db/models/fields/related.py:5: 'capfirst' imported but unused
django/db/backends/ado_mssql/base.py:7: 'util' imported but unused
django/template/defaulttags.py:11: 'Context' imported but unused
django/core/handlers/wsgi.py:187: 'settings' imported but unused
django/core/handlers/modpython.py:149: 'settings' imported but unused
django/core/servers/fastcgi.py:94: 'flup' imported but unused
django/core/management/validation.py:51: 'Image' imported but unused
django/core/management/commands/shell.py:58: 'user' imported but unused
django/core/management/commands/testserver.py:20: 'settings' imported but unused
django/core/management/commands/test.py:20: 'get_apps' imported but unused
django/core/management/commands/test.py:20: 'get_app' imported but unused
django/core/management/commands/flush.py:18: 'dispatcher' imported but unused
django/contrib/localflavor/it/forms.py:6: 'EMPTY_VALUES' imported but unused
django/contrib/localflavor/ar/forms.py:8: 'smart_unicode' imported but unused
django/contrib/localflavor/jp/forms.py:5: 'validators' imported but unused
django/contrib/localflavor/jp/forms.py:6: 'ValidationError' imported but unused
django/contrib/localflavor/in_/forms.py:9: 're' imported but unused
django/contrib/auth/decorators.py:4: 'wraps' imported but unused
django/contrib/databrowse/views.py:1: 'DateTimeField' imported but unused
django/contrib/databrowse/views.py:1: 'FieldDoesNotExist' imported but unused
django/contrib/databrowse/views.py:4: 'EasyModel' imported but unused
django/contrib/databrowse/views.py:4: 'EasyChoice' imported but unused
django/contrib/databrowse/sites.py:3: 'EasyChoice' imported but unused
django/contrib/databrowse/plugins/fieldchoices.py:9: 'date_based' imported but unused
django/contrib/databrowse/plugins/calendars.py:7: 'get_date_formats' imported but unused
django/newforms/util.py:3: 'Promise' imported but unused
django/newforms/fields.py:516: 'settings' imported but unused
django/newforms/models.py:11: 'ImproperlyConfigured' imported but unused
django/conf/app_template/models.py:1: 'models' imported but unused
django/dispatch/dispatcher.py:28: 'types' imported but unused
django/dispatch/saferef.py:3: 'curry' imported but unused
django/views/generic/simple.py:1: 'render_to_response' imported but unused
django/utils/text.py:2: 'settings' imported but unused
django/utils/dateformat.py:16: 'string_concat' imported but unused
django/utils/autoreload.py:41: 'threading' imported but unused
django/utils/encoding.py:6: 'SafeData' imported but unused
django/utils/encoding.py:6: 'mark_safe' imported but unused
django/utils/translation/trans_real.py:72: 'settings' imported but unused
django/test/client.py:27: 'settings' imported but unused

~ Bernd

Change History (1)

comment:1 by Malcolm Tredinnick, 16 years ago

Resolution: invalid
Status: newclosed

This isn't really that useful, because each case must be considered carefully. A lot of these imports are intentional in order to get them into the right namespace. Some of them are unused, but ... meh. They're not errors, since they're imported elsewhere in any case.

From time to time we remove these as we come across them, but it's a case-by-case thing, so a dump like this doesn't help (we use the same tools). Let's just let normal code evolution takes it course here.

Note: See TracTickets for help on using tickets.
Back to Top