-
Notifications
You must be signed in to change notification settings - Fork 767
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
Expected class type but received "DeclarativeMeta" #360
Comments
Thank you for reporting this problem. Pylance was not correctly handling the case where a class was created by directly instantiating a metaclass. Most libraries use the "metaclass hook" to statically declare new classes based on a metaclass, but sqlalchemy is doing something more dynamic here. I've added code to Pyright (the type checker used by Pylance) to handle this case, and the fix will be in the next release of Pylance. |
This issue has been fixed in version 2020.9.5, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202095-16-september-2020 |
@Distortedlogic, can you please file a new issue and provide more context — preferably a short snippet of self-contained code that repros the problem? Thanks! |
Sorry for my awful english.
Environment data
Expected behaviour
No type errors, because in that case i am use DelcarativeBase metaclass for create sqlalchemy model
Actual behaviour
Pylance threat a class created from a metaclass as not a class
![2020-09-11_14-34](https://user-images.githubusercontent.com/30727708/92921099-1d98f500-f43c-11ea-8e8f-b7f3b63dac8b.png)
![2020-09-11_14-34_1](https://user-images.githubusercontent.com/30727708/92921137-343f4c00-f43c-11ea-9af5-561a6ab5630b.png)
The text was updated successfully, but these errors were encountered: