From: adrian.freihofer@gmail.com
To: rob.woolley@windriver.com, bitbake-devel@lists.openembedded.org
Cc: alex.kanavin@gmail.com
Subject: Re: [bitbake-devel] [PATCH 10/11] bitbake-setup: Set function default to None
Date: Mon, 30 Mar 2026 18:34:15 +0200 [thread overview]
Message-ID: <fcac19e4dff25335679496878b691fa73bcb7485.camel@gmail.com> (raw)
In-Reply-To: <20260326185742.542268-11-rob.woolley@windriver.com>
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
> ]
> -=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2026-03-30 16:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 18:57 BitBake Linting Errors Rob Woolley
2026-03-26 18:57 ` [PATCH 01/11] bitbake-setup: Remove extraneous variable from str.format() Rob Woolley
2026-03-26 18:57 ` [PATCH 02/11] bitbake-setup: Resolve unused loop control variables Rob Woolley
2026-03-26 18:57 ` [PATCH 03/11] bitbake-setup: Fix ambiguous variable names Rob Woolley
2026-03-26 18:57 ` [PATCH 04/11] bitbake-setup: Remove unused stdout variable Rob Woolley
2026-03-26 18:57 ` [PATCH 05/11] bitbake-setup: Replace f-string without placeholders Rob Woolley
2026-03-26 18:57 ` [PATCH 06/11] bitbake-setup: Remove unused Namespace import Rob Woolley
2026-03-26 18:57 ` [PATCH 07/11] bitbake-setup: Remove unused parser_settings_list Rob Woolley
2026-03-26 18:57 ` [PATCH 08/11] bitbake-setup: Fix linting error related to membership Rob Woolley
2026-03-26 18:57 ` [PATCH 09/11] bitbake-setup: Maintain exception chain Rob Woolley
2026-03-26 18:57 ` [PATCH 10/11] bitbake-setup: Set function default to None Rob Woolley
2026-03-30 16:34 ` adrian.freihofer [this message]
2026-03-30 21:49 ` [bitbake-devel] " Woolley, Rob
2026-03-30 22:51 ` Richard Purdie
2026-03-26 18:57 ` [PATCH 11/11] bitbake-setup: Sort and format imports Rob Woolley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fcac19e4dff25335679496878b691fa73bcb7485.camel@gmail.com \
--to=adrian.freihofer@gmail.com \
--cc=alex.kanavin@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=rob.woolley@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.