Closed
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