diff mbox series

[v3,01/14] bitbake-setup: Fix type annotation for descriptions parameter in print_configs

Message ID 20260329183332.1996183-2-adrian.freihofer@siemens.com
State New
Headers show
Series bitbake-setup: improvements, VSCode workspace generation | expand

Commit Message

AdrianF March 29, 2026, 6:32 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Fixup for "bitbake-setup: Set function default to None":
when the default was changed from [] to None to avoid the mutable default
argument pitfall (B006), the type annotation was not updated accordingly.

The function body already explicitly handles None via:

    if not descriptions:
        descriptions = ["" for _ in choices]

Update the annotation to use the union type list[str] | None (Python 3.10+)
to accurately reflect that None is a valid value for this parameter.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 bin/bitbake-setup | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index ce712e517..f0240cae5 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -46,7 +46,7 @@  def color_enabled() -> bool:
 def get_diff_color_param() -> str:
     return "--color=always" if color_enabled() else "--color=never"
 
-def print_configs(prompt: str, choices: list[str], descriptions: list[str] = None):
+def print_configs(prompt: str, choices: list[str], descriptions: list[str] | None = None):
     """
     Helper function to print a list of choices and align the output.
     Each option name is made bold to stand out, unless color is not enabled in