[Python-projects] When diagnosing wildcard import problems
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Nov 24 08:23:04 CET 2008
On Sat, Nov 22, 2008 at 10:15:53PM -0600, skip at pobox.com wrote:
>
> If I do something like this:
>
> from time import *
>
> pylint rightfully complains about the wildcard import. Later on it
> complains about all the elements of the time module which I failed to use,
> e.g.:
>
> spambayes/oe_mailbox.py:40: [W] Unused import tzset from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import strptime from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import daylight from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import sleep from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import timezone from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import accept2dyear from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import clock from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import altzone from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import asctime from wildcard import
> spambayes/oe_mailbox.py:53: [W] Unused import mboxutils
> spambayes/oe_mailbox.py:40: [W] Unused import localtime from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import mktime from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import time from wildcard import
> spambayes/oe_mailbox.py:33: [W] Unused import mailbox
> spambayes/oe_mailbox.py:40: [W] Unused import ctime from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import struct_time from wildcard import
> spambayes/oe_mailbox.py:40: [W] Unused import tzname from wildcard import
>
> It seems like it would be better to identify those attributes of the time
> module which I *did* use so it's easier to correct the import statement. In
> fact, it might go so far as to suggest a replacement import statement:
>
> spambayes/oe_mailbox.py:40: [W] Suggest "from time import time, strftime"
>
> or something similar.
http://www.logilab.org/ticket/6696
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list