-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typing error in combination with pylance for factory=list #810
Comments
Yes, this has been raised in #795 (comment) . I hope the pyright team sees it our way… |
Oh ok, if there is already a ticket for this issue then feel free to close this one. Many thanks for all the hard work you guys do. 🙇 |
Can you work around it with this?
Oh ugg:
Looks like pylance doesn't do the Factory magic that we do in the stubs. |
Sadly not, maybe pylance could do? Seems like that there is some trouble in finding a aggreement which project will handle default_factory/attr.ib(factory=list) (#795 (comment)). Maybe supporting |
Great news, they added |
Hello I'm very excited that attrs now allows to show constructor parameters when used with pylance.
I'm using
attrs-21.2.0
However I have a problem when using a class with factory, the factory appears to be not recognized as default value. For example:
If I try to instantiate this class with
a = A()
I get error from pylance: 'Argument missing for parameter "my_list"'.And for the class definition I get the error "Fields without default values cannot appear after fields with default values".
I noticed it works somehow when I use
my_list: List[str] = attr.Factory(list)
but with this the type is set to Factory and I get problems if I want to use the lista.my_list.append('fu')
will then lead to "Instance of 'Factory' has no 'append' member".The text was updated successfully, but these errors were encountered: