Skip to content

Commit

Permalink
fix(config: deprecate, warning): handle [partially] empty config (fixes
Browse files Browse the repository at this point in the history
…: #752)
  • Loading branch information
actionless committed Jan 3, 2025
1 parent 3c24237 commit 05fce8d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pikaur/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,10 @@ def _migrate_deprecated_config_value(
option_name: str,
) -> None:
old_default = option_schema["old_default"]
current_value = cls._config[section_name][option_name]
try:
current_value = cls._config[section_name][option_name]
except (KeyError, configparser.NoSectionError):
return
if current_value == old_default:
new_default_value = option_schema["default"]
cls._config[section_name][option_name] = new_default_value
Expand Down Expand Up @@ -815,7 +818,10 @@ def _handle_warning(
section_name: str,
option_name: str,
) -> None:
current_value = cls._config[section_name][option_name]
try:
current_value = cls._config[section_name][option_name]
except (KeyError, configparser.NoSectionError):
return
if current_value in option_schema["warning"]["when_value"]:
_err_write("\n".join([
"",
Expand Down

0 comments on commit 05fce8d

Please sign in to comment.