diff options
author | Bryce Guinta <bryce.paul.guinta@gmail.com> | 2018-02-20 20:27:50 -0700 |
---|---|---|
committer | Bryce Guinta <bryce.paul.guinta@gmail.com> | 2018-02-20 20:47:56 -0700 |
commit | e686b736eb00c695d55709c612bfd64ed696388e (patch) | |
tree | f380459fb9ef014cea349dd7846137bdd06b6619 /astroid/brain/brain_attrs.py | |
parent | 3fae32f99c7f432a1281b151ea17e163a2e8dc47 (diff) | |
download | astroid-git-e686b736eb00c695d55709c612bfd64ed696388e.tar.gz |
Add attrs special attribute to prevent false positve in pylint
Astroid cannot infer this attribute because of the way
attr builds its classes
Close PyCQA/pylint#1884
Diffstat (limited to 'astroid/brain/brain_attrs.py')
-rw-r--r-- | astroid/brain/brain_attrs.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/astroid/brain/brain_attrs.py b/astroid/brain/brain_attrs.py index 2ad32987..a7f0d9f8 100644 --- a/astroid/brain/brain_attrs.py +++ b/astroid/brain/brain_attrs.py @@ -32,6 +32,10 @@ def attr_attributes_transform(node): """Given that the ClassNode has an attr decorator, rewrite class attributes as instance attributes """ + # Astroid can't infer this attribute properly + # Prevents https://github.com/PyCQA/pylint/issues/1884 + node.locals["__attrs_attrs__"] = [astroid.Unknown(parent=node.body)] + for cdefbodynode in node.body: if not isinstance(cdefbodynode, astroid.Assign): continue |