Skip to content

Commit

Permalink
update log message in merge_default_config
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiyuan Chen <[email protected]>
  • Loading branch information
ZhiyuanChen committed Sep 12, 2024
1 parent 7c52f5a commit 83b0a5e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chanfig/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,14 @@ def add_config_argument(self, key, value: Any | None = None, dtype: type | None
return self.add_argument(name, type=dtype, help=help, dest=key)

def merge_default_config(self, parsed, default_config: str, no_default_config_action: str = "raise") -> NestedDict:
message = f"default_config is set to {default_config}, but not found in args."
if default_config in parsed:
path = parsed[default_config]
warn(f"Config has 'default_config={path}' specified, its values will override values in Config")
warn(
f"{self.__class__.__name__} has 'default_config={path}' specified, "
"its values will override values in Config"
)
return NestedDict.load(path).merge(parsed)
message = f"{self.__class__.__name__} has default_config set to {default_config}, but it is not found in args."
if no_default_config_action == "ignore":
pass
elif no_default_config_action == "warn":
Expand Down

0 comments on commit 83b0a5e

Please sign in to comment.