| Message ID | 20260331160703.3137930-4-rob.woolley@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | bitbake-setup PyPI Packaging | expand |
On Tue, 2026-03-31 at 09:06 -0700, Rob Woolley via lists.openembedded.org wrote: > The function defaults are evaluated once and use across calls > can lead to unexpected behaviour. > > Set the value to none and let the function initialize the value > in the case when the value is not set. > > Resolves B006 from flake8-bugbear > > Signed-off-by: Rob Woolley <rob.woolley@windriver.com> > --- > bin/bitbake-setup | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bin/bitbake-setup b/bin/bitbake-setup > index 313962cd4..f90f01f55 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] = []): > +def print_configs(prompt: str, choices: list[str], descriptions: list[str] = None): This breaks the typing as None is not a list. Adrian then patched it to fix that but that caused it's own set of problems as it required python 3.10. Whilst I agree there is a problem, I cannot take this patch in this form, we need to find a different solution. Cheers, Richard
diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 313962cd4..f90f01f55 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] = []): +def print_configs(prompt: str, choices: list[str], descriptions: list[str] = 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
The function defaults are evaluated once and use across calls can lead to unexpected behaviour. Set the value to none and let the function initialize the value in the case when the value is not set. Resolves B006 from flake8-bugbear Signed-off-by: Rob Woolley <rob.woolley@windriver.com> --- bin/bitbake-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)