-
Notifications
You must be signed in to change notification settings - Fork 672
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
DOC Fix sphinx warnings and turn warnings into errors #1247
DOC Fix sphinx warnings and turn warnings into errors #1247
Conversation
torchaudio/_internal/module_utils.py
Outdated
# get __init__ if obj is a class, else get the function itself | ||
# FIXME: remove when SignalInfo and EncodingInfo are properly removed | ||
func = getattr(obj, '__init__', obj) |
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.
For ref, this is needed to avoid a similar error as in astropy/astropy#2051.
The main issue is that decorator
doesn't work on classes; it only works on functions but it's currently used for the SignalInfo
and EncodingInfo
classes which led to the warning / error.
I'm not sure the current changes properly makes the decorator work on classes - but it does successfully suppress the warning, and as the offending classes are deprecated and will be removed, I assumed it was good enough.
If needed, I'm happy to propose a proper fix and let the decorator work on classes, but that will be a bit more work
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 for the clarification. SignalInfo
and EncodingInfo
classes are expected to be removed after the next release (if things go smoothly) so I think this workaround is good enough.
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.
I couldn't make it work properly after all, so I removed the changes to the decorator and removed its us in the corresponding classes, and instead warned inside __init__
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.
Sounds good.
Looks like |
Similar to what was done in
torchvision
pytorch/vision#3290This PR fixes sphinx warnings and sets the
for sphinx to issue warnings when the wrong parameter syntax is used.
The warnings are now turned into errors. Note: sphinx will now stop compilation at the first warning/error it sees; if we relied on sphinx>=8, we could use the
--keep-going
option to let it finish.