diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-12-16 16:34:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 16:34:14 +0100 |
commit | c285fae493a7a272639a969d6ea914db8c9e1d18 (patch) | |
tree | 1843118a59f818b7717447f75142c14665801e48 /pylint/checkers/classes.py | |
parent | 9909daec8e3089e350decf8c1a837a2f6fe95cb9 (diff) | |
download | pylint-git-c285fae493a7a272639a969d6ea914db8c9e1d18.tar.gz |
Add ``future=True`` to all ``NodeNG.statement()`` calls (#5310)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 478197b0f..da9bf074f 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -1052,7 +1052,9 @@ a metaclass class method.", nodes_lst = [ n for n in nodes_lst - if not isinstance(n.statement(), (nodes.Delete, nodes.AugAssign)) + if not isinstance( + n.statement(future=True), (nodes.Delete, nodes.AugAssign) + ) and n.root() is current_module ] if not nodes_lst: @@ -1651,7 +1653,7 @@ a metaclass class method.", # class A: # b = property(lambda: self._b) - stmt = node.parent.statement() + stmt = node.parent.statement(future=True) if ( isinstance(stmt, nodes.Assign) and len(stmt.targets) == 1 @@ -1796,7 +1798,7 @@ a metaclass class method.", _node.frame() is frame and _node.fromlineno < lno and not astroid.are_exclusive( - _node.statement(), defstmt, excs + _node.statement(future=True), defstmt, excs ) ): self.add_message( |