[Python-Dev] cpython (3.2): remove unused import (original) (raw)
Mark Lawrence breamoreboy at yahoo.co.uk
Thu Feb 16 01:28:54 CET 2012
- Previous message: [Python-Dev] cpython (3.2): remove unused import
- Next message: [Python-Dev] Fixing the XML batteries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 06/02/2012 17:57, Brett Cannon wrote:
On Sun, Feb 5, 2012 at 19:53, Christian Heimes<lists at cheimes.de> wrote:
Am 06.02.2012 01:39, schrieb Brett Cannon: I'm going to assume pylint or pyflakes would throw too many warnings on the stdlib, but would it be worth someone's time to write a simple unused import checker to run over the stdlib on occasion? I bet even one that did nothing more than a regex search for matched import statements would be good enough.
Zope 3 has an import checker that uses the compiler package and AST tree to check for unused imports. It seems like a better approach than a simple regex search.
http://svn.zope.org/Zope3/trunk/utilities/importchecker.py?rev=25177&view=auto The importorder tool uses the tokenizer module to order import statements. http://svn.zope.org/Zope3/trunk/utilities/importorder.py?rev=25177&view=auto Both are written by Jim Fulton. Ah, but does it run against Python 3? If so then this is something to suggest on python-mentor for someone to get their feet wet for contributing.
A possible alternative is the sfood-checker tool given here http://furius.ca/snakefood/ which I stumbled across whilst looking for something completely different.
-- Cheers.
Mark Lawrence.
- Previous message: [Python-Dev] cpython (3.2): remove unused import
- Next message: [Python-Dev] Fixing the XML batteries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]