| Message ID | 20260326185742.542268-11-rob.woolley@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | [01/11] bitbake-setup: Remove extraneous variable from str.format() | expand |
On Thu, 2026-03-26 at 11:57 -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 2e1e347d6..6b210cd3e 100755 > --- a/bin/bitbake-setup > +++ b/bin/bitbake-setup > @@ -45,7 +45,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): While "= None" looks better than "= []", this is still a bit wrong. It should be: list[str] | None = None However, this syntax would require Python 3.10+, so not possible. Other options could be: - Dropping the type checks from this function - Using typing.Optional ? Regards, Adrian > """ > 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 > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#19255): > https://lists.openembedded.org/g/bitbake-devel/message/19255 > Mute This Topic: https://lists.openembedded.org/mt/118523930/4454582 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: > https://lists.openembedded.org/g/bitbake-devel/unsub [adrian.freihofer@gmail.com > ] > -=-=-=-=-=-=-=-=-=-=-=-
Thanks for pointing this out. As far as Python 3.9 is concerned, it went end-of-life on October 31, 2025. I recognize that some supported hosts (like Debian 11 and RHEL 9) may have it by default. Do we increment the minimum Python version when the language runtime goes EOL or when the supported hosts do? Regards, Rob
On Mon, 2026-03-30 at 21:49 +0000, Rob Woolley via lists.openembedded.org wrote: > Thanks for pointing this out. > > > As far as Python 3.9 is concerned, it went end-of-life on October 31, > 2025. I recognize that some supported hosts (like Debian 11 and RHEL > 9) may have it by default. Do we increment the minimum Python > version when the language runtime goes EOL or when the supported > hosts do? This is not an invitation to discuss the minimum python version this close to release, particularly on a relatively trivial change like this. I'd rather just remove the typing than start trying to work out minimum versions of different systems, how that combines with build tools, the docs updates needed and so on. Cheers, Richard
diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 2e1e347d6..6b210cd3e 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -45,7 +45,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(-)