-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5804 Simplify the configparser usage to get parsed attributes easily (#…
…5813) part of #5804. ### Description This adds a simple attribute access for ConfigParser so ```python from monai.bundle import ConfigParser parser = ConfigParser({"a":"b"}) a = parser.get_parsed_content("a") ``` can be rewritten to ```python from monai.bundle import ConfigParser parser = ConfigParser({"a":"b"}) a = parser.a ``` This only works for variables/methods that are not included in ConfigParser so e.g. `parser.config` would still get the whole config. This PR only supports shallow attribute accesses, since the returned value will be a `dict` where you need to use `["key"]` to get the content. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [x] New tests added to cover the changes. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
- Loading branch information
1 parent
2c2de9e
commit 9efd54d
Showing
4 changed files
with
31 additions
and
1 deletion.
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
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
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
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