license.py: rename variables
PATCH 1/1 license.py: rename variables
Update the comment to reflect new variable names
--- meta/lib/oe/license.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
meta/lib/oe/license.py +15 -13
@@ -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): + """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. + + 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
@@ -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)]
Signature · 1 line
2.31.1
Quoted 20 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Saul Wold
Sent: den 24 februari 2022 16:27
To: [email protected]
Cc: Saul Wold <[email protected]>
Subject: [OE-core] [PATCH]license.py: rename variablesUpdate the comment to reflect new variable names
Signed-off-by Saul Wold <[email protected]>--- meta/lib/oe/license.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)meta/lib/oe/license.py +0
-0@@ -99,20 +99,22 @@ def flattened_licenses(licensestr, choose_licenses): raise LicenseSyntaxError(licensestr, exc)
meta/lib/oe/license.py def flattened_licenses(licensestr, choose_licenses): · line 102
Quoted 10 lines
meta/lib/oe/license.py +1
-7return 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.
meta/lib/oe/license.py def flattened_licenses(licensestr, choose_licenses): · line 105
Quoted 3 lines
meta/lib/oe/license.py +3
-0+ """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.
Quoted 7 lines
meta/lib/oe/license.py +5
-0+ + 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. """
meta/lib/oe/license.py def flattened_licenses(licensestr, choose_licenses): · line 120
Quoted 10 lines
meta/lib/oe/license.py +2
-2def 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?
Quoted 17 lines
meta/lib/oe/license.py +4
-5@@ -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)] --
Quoted 1 line
2.31.1
//Peter