From aa0aba812e63af95fc3cdcb495a61a7cf13d9a06 Mon Sep 17 00:00:00 2001 From: Rezha Julio Date: Mon, 6 Jul 2026 22:45:23 +0700 Subject: [PATCH] style: convert remaining logger %-style calls to f-strings Last 3 logger calls still using printf-style formatting; all other log messages and inline string formatting already use f-strings. Template constants in constants.py keep .format() since they are an i18n boundary. --- src/bot/plugins/config.py | 2 +- src/bot/plugins/manager.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bot/plugins/config.py b/src/bot/plugins/config.py index f1c94b4..40c39f0 100644 --- a/src/bot/plugins/config.py +++ b/src/bot/plugins/config.py @@ -147,7 +147,7 @@ async def wrapper( effective_map: dict[int, dict[str, bool]] = context.bot_data.get("plugin_effective_map", {}) if not is_plugin_enabled_for_group(effective_map, group_id, plugin_name): - logger.debug("Plugin '%s' disabled for group %d, skipping", plugin_name, group_id) + logger.debug(f"Plugin '{plugin_name}' disabled for group {group_id}, skipping") return await callback(update, context, *args, **kwargs) diff --git a/src/bot/plugins/manager.py b/src/bot/plugins/manager.py index 9c35e7a..dbc17c6 100644 --- a/src/bot/plugins/manager.py +++ b/src/bot/plugins/manager.py @@ -150,7 +150,10 @@ def register_all( handlers = registrar(application) result[name] = handlers noun = "job(s)" if name.endswith("_job") else "handler(s)" - logger.info("Registered plugin: %s (group=%d, %d %s)", name, defs_by_name[name]["handler_group"], len(handlers), noun) # type: ignore[arg-type] + group = defs_by_name[name]["handler_group"] + logger.info( + f"Registered plugin: {name} (group={group}, {len(handlers)} {noun})" + ) # Store metadata for later gating metadata: dict[str, dict] = {} @@ -188,5 +191,5 @@ def compute_effective_map( plugins_default = getattr(settings, "plugins_default", {}) effective_map = compute_effective_plugin_map(plugins_default, registry) application.bot_data["plugin_effective_map"] = effective_map # type: ignore[index] - logger.info("Computed effective plugin map for %d group(s)", len(effective_map)) + logger.info(f"Computed effective plugin map for {len(effective_map)} group(s)") return effective_map \ No newline at end of file