Closed faroit closed 3 years ago
@faroit there are two ways:
license-expression
Where (as in which piece of code) would you use it so that I can provide some help? Do you have a collection of all the values your have to date?
@pombredanne thanks for your suggestions. Can you give a working example for 1.
to make that more clear?
@faroit sorry for the late reply! Here would be a way:
>>> from license_expression import LicenseSymbol, Licensing
>>> symbols = [
... LicenseSymbol(key='cc-by-nc-4.0', aliases=['http://creativecommons.org/licenses/by-nc/4.0/legalcode',]),
... LicenseSymbol(key='cc-by-4.0', aliases=['http://creativecommons.org/licenses/by/4.0/legalcode',]),
... ]
>>> licensing = Licensing(symbols)
>>> expression = 'http://creativecommons.org/licenses/by-nc/4.0/legalcode OR http://creativecommons.org/licenses/by/4.0/legalcode'
>>> licensing.parse(expression)
OR(LicenseSymbol('cc-by-nc-4.0', aliases=('http://creativecommons.org/licenses/by-nc/4.0/legalcode',), is_exception=False), LicenseSymbol('cc-by-4.0', aliases=('http://creativecommons.org/licenses/by/4.0/legalcode',), is_exception=False))
thats great, sorry for the late response!
Glad it helped!
on some public data providers licenses are given as urls to the legal code... eg. this entry is referring to
http://creativecommons.org/licenses/by-nc/4.0/legalcode
.Is there a simple way to use
license-expression
to match these?