[Python-projects] pylint and scipy/numpy
Sylvain Thénault
sylvain.thenault at logilab.fr
Fri Feb 22 11:03:43 CET 2008
On Fri, Feb 22, 2008 at 10:48:41AM +0100, christophe grimault wrote:
> Hi there,
>
> My python files import scipy. And if i use any function of scipy (fft,
> arange, zeros, ...), pylint complains with :
>
> ...
> E0602:440:Interceptor.apply_channel: Undefined variable 'zeros'
> ...
>
> Of course, the program works. But my pylint score is bad. And the change
> to:
> import scipy
> and use of:
> scipy.zeros
>
> gains the bad 'wildcard import' but does not solve the previous problem.
>
> Any help ?
hum, it sounds like pylint doesn't manage to follow numpy imports :
syt at crater:~$ cat pylint_zeros.py
import scipy
print scipy.zeros
import numpy
print numpy.zeros
import numpy.core.multiarray as ncm
print ncm.zeros
syt at crater:~$ pylint -rn pylint_zeros.py
No config file found, using default configuration
************* Module pylint_zeros
C: 1: Missing docstring
E: 2: Module 'scipy' has no 'zeros' member
E: 4: Module 'numpy' has no 'zeros' member
importing zeros from its actual definition module avoid the false
positive. That's not perfect but it does the trick until I found the
time to find why it can't find it from the numpy package (and so from
the scipy package).
--
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