File tree 2 files changed +12
-2
lines changed 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ def is_decorated_with_attrs(
21
21
if not node .decorators :
22
22
return False
23
23
for decorator_attribute in node .decorators .nodes :
24
+ if isinstance (decorator_attribute , astroid .Call ): # decorator with arguments
25
+ decorator_attribute = decorator_attribute .func
24
26
if decorator_attribute .as_string () in decorator_names :
25
27
return True
26
28
return False
Original file line number Diff line number Diff line change @@ -819,10 +819,18 @@ class Foo:
819
819
820
820
f = Foo()
821
821
f.d['answer'] = 42
822
+
823
+ @attr.s(slots=True)
824
+ class Bar:
825
+ d = attr.ib(attr.Factory(dict))
826
+
827
+ g = Bar()
828
+ g.d['answer'] = 42
822
829
""" )
823
830
824
- should_be_attribute = next (module .getattr ('f' )[0 ].infer ()).getattr ('d' )[0 ]
825
- self .assertIsInstance (should_be_attribute , astroid .Unknown )
831
+ for name in ('f' , 'g' ):
832
+ should_be_unknown = next (module .getattr (name )[0 ].infer ()).getattr ('d' )[0 ]
833
+ self .assertIsInstance (should_be_unknown , astroid .Unknown )
826
834
827
835
828
836
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments