Skip to content

Commit 7583a4e

Browse files
committed
revise docstring
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
1 parent 389ac65 commit 7583a4e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

monai/apps/manifest/config_parser.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ConfigParser:
4444
# in the example $@my_dims + 1 is an expression, which adds 1 to the value of @my_dims
4545
parser = ConfigParser(config)
4646
47-
# get/set configuration content
47+
# get/set configuration content, the set method should happen before calling parse()
4848
print(parser["my_net"]["<args>"]["in_channels"]) # original input channels 1
4949
parser["my_net"]["<args>"]["in_channels"] = 4 # change input channels to 4
5050
print(parser["my_net"]["<args>"]["in_channels"])
@@ -117,7 +117,8 @@ def __getitem__(self, id: Union[str, int]):
117117

118118
def __setitem__(self, id: Union[str, int], config: Any):
119119
"""
120-
Set config by ``id``.
120+
Set config by ``id``. Note that this method should be used before ``parse()`` or ``get_parsed_content()``
121+
to ensure the updates are included in the parsed content.
121122
122123
Args:
123124
id: id of the ``ConfigItem``, ``"#"`` in id are interpreted as special characters to
@@ -164,8 +165,6 @@ def set(self, config: Any, id: str = ""):
164165
def _do_parse(self, config, id: str = ""):
165166
"""
166167
Recursively parse the nested data in config source, add every item as `ConfigItem` to the resolver.
167-
Note that the configuration content of every `ConfigItem` will be decoupled from the config source
168-
of parser during parsing.
169168
170169
Args:
171170
config: config source to parse.
@@ -210,9 +209,6 @@ def get_parsed_content(self, id: str = "", **kwargs):
210209
- If the item is ``ConfigExpression`` and ``eval_expr=True``, the result is the evaluated output.
211210
- Else, the result is the configuration content of `ConfigItem`.
212211
213-
Note that the configuration content of every `ConfigItem` is decoupled from the config source of parser
214-
during parsing.
215-
216212
Args:
217213
id: id of the ``ConfigItem``, ``"#"`` in id are interpreted as special characters to
218214
go one level further into the nested structures.

0 commit comments

Comments
 (0)