diff --git a/chanfig/parser.py b/chanfig/parser.py index 7217ebd3..bbd37ee2 100644 --- a/chanfig/parser.py +++ b/chanfig/parser.py @@ -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":