-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Generate: can_generate()
recursive check
#33718
Conversation
can_generate()
recursivecan_generate()
recursive check
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! @regisss can you comment whether this fixes the issue you encountered?
Yep it's all good on my side, the warning doesn't appear anymore with this fix. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, wil have the same issue for great grand pa check no?
for base in cls.__bases__: | ||
if not hasattr(base, "can_generate"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this only grandfather check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's recursive! (it calls can_generate
of the parent, which in turn may call the granparent's, and so on :D )
24b5a46
to
9029753
Compare
* add recursive check and test warnings * missing space * models without can_generate
* add recursive check and test warnings * missing space * models without can_generate
* add recursive check and test warnings * missing space * models without can_generate
* add recursive check and test warnings * missing space * models without can_generate
* add recursive check and test warnings * missing space * models without can_generate
What does this PR do?
The deprecation warning added in #33203 was incomplete: classes inheriting from classes that have received the update were throwing the warning. This PR adds a recursive check to
can_generate()
and tests the warnings thrown by the function.Example of script that is throwing a warning, but shouldn't (and is fixed in this PR):
Thank you @regisss for warning me about this one and providing a reproducer 🙏