-
-
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
This is a prototype for #854 #855
Conversation
When a restriction is set, the ideal situation for the datamodel would be that only the properties that fall under the restriction are available. From https://www.reddit.com/r/learnpython/comments/12qhzi6/dataclasses_with_inheritance/ I found that kw_only was used to resolve the issue with non-default argument 'class name' follows default argument.
This approach I am afraid will work when we reach the EOL for python 3.9 and we can make the In order to resolve some of these cases, we either remove the extension completely or mark the fields as prohibited. Let' me take a look |
I can absolutely live with this functionality only to be applied when kwonly is used as argument. Are you saying that prohibited would already give a better way? Hence my issue with suffixes "_attribute" vs "" would already been covered? |
It seems that my interpretation which inhertitance to select is invalid. Hence... I have to do some more work. |
@tefra I need a hint where to add |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
See the filters here, the alias might be tricky |
@tefra is this one something you also want to do 'correct' in "Tefra" style? |
It has to pass mypy :) |
Closing in favor of #908 |
📒 Description
When a restriction is set, the ideal situation for the datamodel would be that only the properties that fall under the restriction are available. In the current situation, due to inheritance all attributes are available, while only some are valid.
Prototype for #854
🔗 What I've Done
I have added some code that creates 'null' fields when the inherited attributes are restricted. They are at rendering replaced with None.
💬 Comments
From https://www.reddit.com/r/learnpython/comments/12qhzi6/dataclasses_with_inheritance/ I found that kw_only was used to resolve the issue with non-default argument 'class name' follows default argument.
What seems to fail in this approach is that some inherited attributes somewhere get _attribute suffixed to the name. I am yet to find out why this happens.
🛫 Checklist