From cee7b345469f94c18a266170855ded2eb95024ba Mon Sep 17 00:00:00 2001 From: jakub-nt <175944085+jakub-nt@users.noreply.github.com> Date: Thu, 6 Nov 2025 13:59:38 +0100 Subject: [PATCH 1/2] Rewrote a condition, removing a Pyright warning It seems Pyright does not understand `old_module` cannot be `None` when `custom_index` is `True`. The assertion seems incorrect. Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com> --- cfbs/commands.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cfbs/commands.py b/cfbs/commands.py index 69224a6a..ce4fa408 100644 --- a/cfbs/commands.py +++ b/cfbs/commands.py @@ -597,12 +597,11 @@ def update_command(to_update): update_objects = [] for update in to_update: old_module = config.get_module_from_build(update.name) - assert ( - old_module is not None - ), 'We\'ve already checked that modules are in config["build"]' - custom_index = old_module is not None and "index" in old_module - index = Index(old_module["index"]) if custom_index else config.index + if old_module is not None and "index" in old_module: + index = Index(old_module["index"]) + else: + index = config.index if not old_module: index.translate_alias(update) From 93020eb30c9d564adc14a75c6919760dae81f45e Mon Sep 17 00:00:00 2001 From: jakub-nt <175944085+jakub-nt@users.noreply.github.com> Date: Thu, 6 Nov 2025 14:01:10 +0100 Subject: [PATCH 2/2] Simplified code logic Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com> --- cfbs/commands.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cfbs/commands.py b/cfbs/commands.py index ce4fa408..25f670a8 100644 --- a/cfbs/commands.py +++ b/cfbs/commands.py @@ -613,8 +613,7 @@ def update_command(to_update): ) continue - custom_index = old_module is not None and "index" in old_module - index = Index(old_module["index"]) if custom_index else config.index + index = Index(old_module["index"]) if "index" in old_module else config.index if not old_module: index.translate_alias(update)