From e4c207ecff6cf48d8afb3f245f8e7a0be08d7729 Mon Sep 17 00:00:00 2001 From: Fringg Date: Sun, 15 Feb 2026 23:18:44 +0300 Subject: [PATCH] chore: format files with ruff --- app/cabinet/routes/admin_button_styles.py | 10 +++++++--- app/utils/button_styles_cache.py | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/cabinet/routes/admin_button_styles.py b/app/cabinet/routes/admin_button_styles.py index 250947e7..9b039431 100644 --- a/app/cabinet/routes/admin_button_styles.py +++ b/app/cabinet/routes/admin_button_styles.py @@ -132,7 +132,8 @@ async def get_button_styles( merged[section]['enabled'] = overrides['enabled'] if isinstance(overrides.get('labels'), dict): merged[section]['labels'] = { - k: v for k, v in overrides['labels'].items() + k: v + for k, v in overrides['labels'].items() if isinstance(k, str) and isinstance(v, str) and k in BOT_LOCALES } except (json.JSONDecodeError, TypeError): @@ -150,7 +151,9 @@ async def update_button_styles( """Partially update per-section button styles. Admin only.""" # Load current state raw = await _get_setting_value(db, BUTTON_STYLES_KEY) - current: dict[str, dict] = {section: {**cfg, 'labels': dict(cfg.get('labels', {}))} for section, cfg in DEFAULT_BUTTON_STYLES.items()} + current: dict[str, dict] = { + section: {**cfg, 'labels': dict(cfg.get('labels', {}))} for section, cfg in DEFAULT_BUTTON_STYLES.items() + } if raw: try: @@ -165,7 +168,8 @@ async def update_button_styles( current[section]['enabled'] = overrides['enabled'] if isinstance(overrides.get('labels'), dict): current[section]['labels'] = { - k: v for k, v in overrides['labels'].items() + k: v + for k, v in overrides['labels'].items() if isinstance(k, str) and isinstance(v, str) and k in BOT_LOCALES } except (json.JSONDecodeError, TypeError): diff --git a/app/utils/button_styles_cache.py b/app/utils/button_styles_cache.py index cc4fab25..2b67da80 100644 --- a/app/utils/button_styles_cache.py +++ b/app/utils/button_styles_cache.py @@ -108,7 +108,8 @@ async def load_button_styles_cache() -> dict[str, dict]: merged[section]['enabled'] = overrides['enabled'] if isinstance(overrides.get('labels'), dict): merged[section]['labels'] = { - k: v for k, v in overrides['labels'].items() + k: v + for k, v in overrides['labels'].items() if isinstance(k, str) and isinstance(v, str) and k in BOT_LOCALES } except Exception: