diff options
author | Anthony Sottile <asottile@umich.edu> | 2022-02-12 09:52:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 06:52:33 -0800 |
commit | 1fae3dea5108a006d35da9e9ab785ca1ed1bc998 (patch) | |
tree | bcfc0c46ae69366dbd8f9a59073209c928808f48 /pyflakes/checker.py | |
parent | dbb18432165bdc567e015511b3f3284f0f14cf05 (diff) | |
download | pyflakes-1fae3dea5108a006d35da9e9ab785ca1ed1bc998.tar.gz |
ignore `__all__` when not directly assigned (#675)
Diffstat (limited to 'pyflakes/checker.py')
-rw-r--r-- | pyflakes/checker.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py index 45c7a4a..45f2a42 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -1291,7 +1291,14 @@ class Checker(object): parent_stmt != node._pyflakes_parent and not self.isLiteralTupleUnpacking(parent_stmt)): binding = Binding(name, node) - elif name == '__all__' and isinstance(self.scope, ModuleScope): + elif ( + name == '__all__' and + isinstance(self.scope, ModuleScope) and + isinstance( + node._pyflakes_parent, + (ast.Assign, ast.AugAssign, ast.AnnAssign) + ) + ): binding = ExportBinding(name, node._pyflakes_parent, self.scope) elif PY2 and isinstance(getattr(node, 'ctx', None), ast.Param): binding = Argument(name, self.getScopeNode(node)) |