-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Closed
Copy link
Labels
Bug πͺ²False Positive π¦A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds astroid Brain π§ Needs a brain tip in astroid (then an astroid upgrade)Needs a brain tip in astroid (then an astroid upgrade)
Milestone
Description
Steps to reproduce
attrs allows this form for factory, but pylint doesn't understand it:
import attr
from functools import partial
import numpy as np
@attr.attrs(auto_attribs=True)
class Foo:
position: np.ndarray = attr.Factory(partial(np.zeros, 3))
# position: np.ndarray = attr.attrib(default=attr.Factory(partial(np.zeros, 3))) # this works
def bar(self):
return -self.position
Current behavior
E1130: bad operand type for unary -: Factory (invalid-unary-operand-type)
Expected behavior
no error
pylint --version output
Result of pylint --version
output:
pylint 2.7.2
astroid 2.5.1
Python 3.7.7 (default, Oct 5 2020, 09:18:33)
[Clang 9.0.0 (clang-900.0.39.2)]
Additional dependencies:
attrs=20.2.0
linjiX and AChenQ
Metadata
Metadata
Assignees
Labels
Bug πͺ²False Positive π¦A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds astroid Brain π§ Needs a brain tip in astroid (then an astroid upgrade)Needs a brain tip in astroid (then an astroid upgrade)