diff --git a/hbd/server/http.py b/hbd/server/http.py index ad805f7..ca3d0cf 100644 --- a/hbd/server/http.py +++ b/hbd/server/http.py @@ -40,7 +40,7 @@ def _build_threshold_configs_from_form(form_data: dict) -> dict: metrics = cfg.get("metrics") if not isinstance(metrics, dict): continue - thresholds = {} + thresholds: dict = {} for metric_path, values in metrics.items(): _insert_threshold_metric(thresholds, metric_path, values) entry = {"thresholds": thresholds} diff --git a/hbd/server/settings.py b/hbd/server/settings.py index 1e2541a..1286646 100644 --- a/hbd/server/settings.py +++ b/hbd/server/settings.py @@ -170,7 +170,7 @@ def get_settings_sections(config: dict, threshold_checker=None, user=None) -> li } """ is_admin = user is None or getattr(user, "admin", False) - username = getattr(user, "username", None) + username: str = getattr(user, "username", "") or "" def field(key, label, ftype, description="", editable=False, sensitive=False): raw = config.get(key) @@ -338,7 +338,7 @@ def get_settings_sections(config: dict, threshold_checker=None, user=None) -> li "logo": pattrs.get("logo", ""), }) - sections = [ + sections: list = [ { "id": "network", "title": "Network", @@ -523,7 +523,7 @@ def get_settings_data(config: dict, threshold_checker=None, user=None) -> dict: """Return sections list + auxiliary data for the settings template.""" sections = get_settings_sections(config, threshold_checker=threshold_checker, user=user) is_admin = user is None or getattr(user, "admin", False) - username = getattr(user, "username", None) + username: str = getattr(user, "username", "") or "" channels = config.get("notification_channels") or {} threshold_cfgs = config.get("threshold_configs") or {} if not is_admin: