From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Saul Wold <Saul.Wold@windriver.com>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: RE: [OE-core] [PATCH] license.py: rename variables
Date: Thu, 24 Feb 2022 17:32:08 +0000 [thread overview]
Message-ID: <a124dee50efd4d6bab57c31f0aeef9bc@axis.com> (raw)
In-Reply-To: <20220224152659.134461-1-saul.wold@windriver.com>
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Saul Wold
> Sent: den 24 februari 2022 16:27
> To: openembedded-core@lists.openembedded.org
> Cc: Saul Wold <saul.wold@windriver.com>
> Subject: [OE-core] [PATCH] license.py: rename variables
>
> Update the comment to reflect new variable names
>
> Signed-off-by: Saul Wold <saul.wold@windriver.com>
> ---
> meta/lib/oe/license.py | 28 +++++++++++++++-------------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
> index b5d378a549b..4cd382b4fd7 100644
> --- a/meta/lib/oe/license.py
> +++ b/meta/lib/oe/license.py
> @@ -99,20 +99,22 @@ def flattened_licenses(licensestr, choose_licenses):
> raise LicenseSyntaxError(licensestr, exc)
> return flatten.licenses
>
> -def is_included(licensestr, whitelist=None, blacklist=None):
> - """Given a license string and whitelist and blacklist, determine if the
> - license string matches the whitelist and does not match the blacklist.
> -
> - Returns a tuple holding the boolean state and a list of the applicable
> - licenses that were excluded if state is False, or the licenses that were
> - included if the state is True.
> +def is_included(licensestr, include=None, exclude=None):
I suggest calling the renamed arguments "include_licenses" and
"exclude_licenses" instead. "include" and "exclude" are very
generic.
> + """Given a license string and include list and exclude list,
> + determine if the license string matches the an included
> + license and does dont match an excluded license.
Change to:
"""Given a license string, a list of licenses to include and
a list of licenses to exclude, determine if the license
string matches the include list and that it does not
match the exclude list.
> +
> + Returns a tuple holding the boolean state and a list of
> + the applicable licenses that were excluded if state is
> + False, or the licenses that were included if the state
> + is True.
> """
>
> def include_license(license):
> - return any(fnmatch(license, pattern) for pattern in whitelist)
> + return any(fnmatch(license, pattern) for pattern in include)
>
> def exclude_license(license):
> - return any(fnmatch(license, pattern) for pattern in blacklist)
> + return any(fnmatch(license, pattern) for pattern in exclude)
>
> def choose_licenses(alpha, beta):
> """Select the option in an OR which is the 'best' (has the most
A few lines below the above is a comment line that starts "that
the number". Can you change it to "than the number" while here?
> @@ -131,11 +133,11 @@ def is_included(licensestr, whitelist=None, blacklist=None):
> else:
> return beta
>
> - if not whitelist:
> - whitelist = ['*']
> + if not include:
> + include = ['*']
>
> - if not blacklist:
> - blacklist = []
> + if not exclude:
> + exclude = []
>
> licenses = flattened_licenses(licensestr, choose_licenses)
> excluded = [lic for lic in licenses if exclude_license(lic)]
> --
> 2.31.1
//Peter
prev parent reply other threads:[~2022-02-24 17:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 15:26 [PATCH] license.py: rename variables Saul Wold
2022-02-24 17:32 ` Peter Kjellerstedt [this message]
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=a124dee50efd4d6bab57c31f0aeef9bc@axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=Saul.Wold@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/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.