Skip to content

Commit

Permalink
Tell type checkers that the config options are strings. (#208)
Browse files Browse the repository at this point in the history
Co-authored-by: arturo-seijas <[email protected]>
  • Loading branch information
tonyandrewmeyer and arturo-seijas authored Apr 16, 2024
1 parent ef749bf commit f37e046
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,9 @@ def _addon_reconciliation(self, addon_type: str) -> None:
current_installed_addons = set(t["name"] for t in exec_result.result)
logger.debug("Currently installed %s %s", addon_type, current_installed_addons)
addons_in_config = [
t.strip() for t in self.model.config[f"{addon_type}s"].split(",") if t.strip()
t.strip()
for t in cast(str, self.model.config[f"{addon_type}s"]).split(",")
if t.strip()
]
default_addons = (
self._WORDPRESS_DEFAULT_THEMES
Expand Down Expand Up @@ -1156,7 +1158,7 @@ def _plugin_akismet_reconciliation(self) -> None:
Raises:
WordPressBlockedStatusException: if askimet plugin reconciliation process fails.
"""
akismet_key = self.model.config["wp_plugin_akismet_key"].strip()
akismet_key = cast(str, self.model.config["wp_plugin_akismet_key"]).strip()
if not akismet_key:
result = self._deactivate_plugin(
"akismet",
Expand Down Expand Up @@ -1215,7 +1217,7 @@ def _encode_openid_team_map(team_map: str) -> str:

def _plugin_openid_reconciliation(self) -> None:
"""Reconciliation process for the openid plugin."""
openid_team_map = self.model.config["wp_plugin_openid_team_map"].strip()
openid_team_map = cast(str, self.model.config["wp_plugin_openid_team_map"]).strip()
result = None

def check_result():
Expand Down Expand Up @@ -1310,7 +1312,7 @@ def _swift_config(self) -> Dict[str, Any]:
Returns:
Swift configuration in dict.
"""
swift_config_str = self.model.config["wp_plugin_openstack-objectstorage_config"]
swift_config_str = cast(str, self.model.config["wp_plugin_openstack-objectstorage_config"])
required_swift_config_key = [
"auth-url",
"bucket",
Expand Down

0 comments on commit f37e046

Please sign in to comment.