pylint icon indicating copy to clipboard operation
pylint copied to clipboard

False positive on arguments of constructor created by "attrs"

Open mthuurne opened this issue 5 years ago • 2 comments

Steps to reproduce

import attr

class Base:
    def __init__(self):
        pass

@attr.s(auto_attribs=True)
class Sub(Base):
    value: int

print(Sub(123))

Current behavior

PyLint reports about the last line:

E1121: Too many positional arguments for constructor call (too-many-function-args)

Expected behavior

No error should be printed, as the generated constructor takes two arguments (self and value).

pylint --version output

pylint 2.4.4
astroid 2.3.3
Python 3.8.2 (default, Mar 05 2020, 18:58:42) [GCC]

Maybe related

Other issues about support for the attrs library are #1698 and #2983. Superficially this issue doesn't seem to be the same thing, but perhaps there is overlap when digging deeper.

mthuurne avatar Apr 20 '20 15:04 mthuurne