Re: [Python-Dev] [Python-checkins] cpython (3.2): remove unused import
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. On Fri, Feb 3, 2012 at 19:09, benjamin.peterson <python-checkins@python.org>wrote:
http://hg.python.org/cpython/rev/9eb5fec8674b changeset: 74749:9eb5fec8674b branch: 3.2 parent: 74746:5eb47e1732a0 user: Benjamin Peterson <benjamin@python.org> date: Fri Feb 03 19:07:30 2012 -0500 summary: remove unused import
files: Lib/threading.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -5,7 +5,6 @@
from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc -from collections import deque from _weakrefset import WeakSet
# Note regarding PEP 8 compliant names
-- Repository URL: http://hg.python.org/cpython
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
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. Christian
On Sun, Feb 5, 2012 at 19:53, Christian Heimes <lists@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.
Am 06.02.2012 18:57, schrieb Brett Cannon:
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.
Probably not, the code was last modified seven years ago. The compiler package has been removed from Python 3, too. A similar approach should yield better results than a simple regexp search. The 2to3 / 3to2 infrastructure could be reused to parse the AST and search for imports and used names.
On Mon, Feb 6, 2012 at 13:07, Christian Heimes <lists@cheimes.de> wrote:
Am 06.02.2012 18:57, schrieb Brett Cannon:
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.
Probably not, the code was last modified seven years ago. The compiler package has been removed from Python 3, too.
A similar approach should yield better results than a simple regexp search. The 2to3 / 3to2 infrastructure could be reused to parse the AST and search for imports and used names.
If that's the case I might as well add it as part of my mnfy project's verification run I do over the stdlib if someone doesn't beat me to it.
On Tue, Feb 7, 2012 at 4:52 AM, francis <francismb@email.de> wrote:
Hi Brett,
If that's the case I might as well add it as part of my mnfy project's verification run I do over the stdlib if someone doesn't beat me to it.
Is that devinabox ?
No, it's Brett's Python minifier: http://pypi.python.org/pypi/mnfy devinabox is the "everything you need to get started with contributing to CPython and Python standard library development" Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On 06/02/2012 17:57, Brett Cannon wrote:
On Sun, Feb 5, 2012 at 19:53, Christian Heimes<lists@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.
participants (5)
-
Brett Cannon -
Christian Heimes -
francis -
Mark Lawrence -
Nick Coghlan