-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Subclass's Meta should inherit from parent class's Meta #1118
Comments
Can you give some more info about the type-checker you are using? Unfortunately this isn't really an option as the Meta class must be final to avoid conflicts |
Thanks @sashkent3 from quick look a lot of libraries suffer from that issue microsoft/pyright#6570 I am open to suggestions but inheritance between Meta classes is impossible |
@tefra could you kindly clarify what do you mean by:
Also, if |
The parent class might not have a meta class, but the parent parent might, resolving the imports is very hard in these cases. Maybe the |
Isn't it feasible to generate |
If we create a Meta class for every model and include all the properties in each one, doesn’t that undermine the point of using inheritance, which is to share and build on common attributes efficiently? I am not sure I like adding more code/noise just to satisfy pyright |
Well, that's fair, but I believe this is about more than satisfying Pyright. When you do:
The
and
|
Every time the generated code contains a structure similar to:
I get a static type-checker warning about
B.Meta
being an incorrect override forA.Meta
. To fix this, simply change the above to:The text was updated successfully, but these errors were encountered: