Open
Description
Steps to reproduce
- Save the attached file as ntuple.py and run pylint on it. ntuple.txt
"""A test case for a possible pylint bug."""
from typing import List, NamedTuple
class Lines(NamedTuple):
"""A class for storing things."""
lines: List[str]
def add_line(self, line: str) -> "Lines":
"""Return an object with the line added."""
return self._replace(lines=self.lines + [line])
if __name__ == "__main__":
lines = Lines(lines=[])
print(repr(lines.add_line("Live long and prosper!")))
Current behavior
************* Module ntuple
ntuple.py:13:15: E1101: Instance of 'Lines' has no '_replace' member (no-member)
(on Python 3.9 it also complains about inheriting from the non-class NamedTuple, but that's a separate, probably already known, issue)
Expected behavior
No diagnostic messages at all.
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.8.6 (default, Sep 29 2020, 13:19:50)
[GCC 10.2.0]