pylint #9332 Same W0201 reported multiple times [open]

func.py:

from ClassA import ClassA
from ClassB import ClassB

def func(flag):
    if flag:
        obj = ClassA()
    else:
         obj = ClassB()
    obj.attr = 123

ClassA.py:

class ClassA(object):
    pass

ClassB.py:

class ClassB(object):
    pass

Output of "pylint -rn func.py ClassA.py ClassB.py":

************* Module func
W0201:  9:func: Attribute 'attr' defined outside __init__
W0201:  9:func: Attribute 'attr' defined outside __init__

The message itself is correct, but it does not have to be issued twice.

Note that the order of the source files matters: only if ClassA and ClassB after after func, the messages are issued. It seems like the messages are issued when checking ClassA and ClassB, not when checking func.

prioritynormal
typebug
done in<not specified>
load0.200
load left0.200
closed by<not specified>