-
Notifications
You must be signed in to change notification settings - Fork 116
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
Deprecate subclassing dict #707
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f397888
update docs for subclassing Dict
Jasha10 54c1c65
issue deprecation warning on Dict subclass construction
Jasha10 ae6cb72
remove documentation for extending Dict
Jasha10 c6054db
make warns_dict_subclass_deprecated global-scoped
Jasha10 26f35d5
Merge branch 'master' into deprecate_subclassing_dict
Jasha10 61fda90
catch additional warnings
Jasha10 0e5d046
change warning stacklevel 2 -> 1
Jasha10 ea0aa29
make the UserWarning point to issue #663
Jasha10 6eeb616
stacklevel 1 -> 9 (point to the line calling OmegaConf.create)
Jasha10 71ad2b6
clean up control flow and include class name in warning msg
Jasha10 11c210e
test_errors.py:test_dict_subclass_error
Jasha10 b58bcd5
add docstring to test_dict_subclass_error function
Jasha10 192c9db
delete extraneous comment
Jasha10 04f8a6d
add news fragment
Jasha10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
With
stacklevel=2
we get a warning that looks like this:$ python tmp.py /home/jbss/omegaconf.git/omegaconf/_utils.py:373: UserWarning: Subclassing of `Dict` by Structured Config classes is deprecated dict_subclass_data = extract_dict_subclass_data(obj=obj, parent=dummy_parent)
With
stacklevel=1
we get a warning that looks like this:$ python tmp.py /home/jbss/omegaconf.git/omegaconf/_utils.py:240: UserWarning: Subclassing of `Dict` by Structured Config classes is deprecated warnings.warn(
I changed 2 -> 1 because I thought the
dict_subclass_data = extract_dict_subclass_data(...)
was confusing...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.
The exact interesting stack frame is probably not in a fixed depth.
Try to get it to issue the line calling
OmegaConf.create()
in the simple case.Also, add the name of the type subclassing Dict to the warning.
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.
Done in 6eeb616 and 71ad2b6.