] > [Python-projects] False warnings from 0.7.0 to 0.8.0 (Logilab.org)

Email [Python-projects] False warnings from 0.7.0 to 0.8.0

subject
[Python-projects] False warnings from 0.7.0 to 0.8.0
date
2005/10/22 15:39
Updating pylint from 0.7.0 to 0.8.0 generates a lot of false warnings.

Generator expressions
=====================

# E0601 - Using variable 's' before assignment
major, minor = (int(s) for s in value.split("."))

# E0601 - Using variable 'validType' before assignment
typeList = ", ".join(validType.__name__ for validType in validTypes)

Packages split in multiple directories (using __path__)
=======================================================

I also get now a lot of E0611 warnings for "special" modules.
I have a few packages which don't have all their modules inside the
same folder. I modify the __path__ variable of the parent package so
that Python can find them. Unfortunatly pylint doesn't take this into
account right now. See http://www.python.org/doc/essays/packages.html

pylint doesn't recognize the __path__ package magic
===================================================
# package/__init__.py
# E0602 - Undefined variable '__path__'
__path__ += "folder"

# test.py
import package

Other package false errors
==========================

# AudioTime/__init__.py
class AudioTime(object):
    DECIMAL = 3

# AudioTime/AudioTime.py
class AudioTime(object):
    pass

# AudioTime/AudioTimeDecimal.py
from AudioTime.AudioTime import AudioTime
class AudioTimeDecimal(AudioTime):
    pass

# test.py
from AudioTime import AudioTime
# E0611 - No name 'DECIMAL' in module 'AudioTime.AudioTime'
print AudioTime.DECIMAL

As you can see, the AudioTime class from AudioTime/__init__.py should
be given precedence over the AudioTime/AudioTime.py module just as
Python does.

Troubles with variables defined in parent class
===============================================

class Base(object):

    def __init__(self):
        self._var = False

class Derived(Base):

    def Work(self):
        # E0203 - Access to member '_var' before its definition line 13
        if self._var:
            print "True"
        else:
            print "False"
        self._var = True

x = Derived()
x.Work()

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects