Comments (5)
@JonoYang I think the new validation feature should be explicit about which license list is used as a base and there should be no guessing there about whether an expression is from scancode or from SPDX.
from license-expression.
In addition to validation, could you also provide a normalized (whitespace, case, parens) version of the string passed in?
from license-expression.
from license-expression.
Some example:
$ wget https://scancode-licensedb.aboutcode.org/index.json
$ python
>>> import json
>>> lics = json.load(open('index.json'))
>>> lics[0]
{'license_key': '389-exception', 'json': '389-exception.json', 'yml': '389-exception.yml', 'html': '389-exception.html', 'text': '389-exception.LICENSE'}
>>> from license_expression import LicenseSymbol, Licensing
>>> syms =[LicenseSymbol(l['license_key']) for l in lics]
>>> ling=Licensing(symbols=syms)
>>> ling.parse('foo AND mit')
AND(LicenseSymbol('foo', is_exception=False), LicenseSymbol('mit', is_exception=False))
>>> ling.parse('foo AND mit', validate=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/licexp/tmp/lib/python3.6/site-packages/license_expression/__init__.py", line 453, in parse
raise ExpressionError(msg)
license_expression.ExpressionError: Unknown license key(s): foo
>>> e=ling.parse('foo AND mit')
>>> e.symbols
{LicenseSymbol('foo', is_exception=False), LicenseSymbol('mit', is_exception=False)}
from license-expression.
@pombredanne When we are parsing a license expression using Licensing().parse()
, should the .parse()
method be automatically able to determine whether or not an expression is an SPDX license expression or a scancode license expression or should there be a flag that tells the .parse()
method what kind of license expression to expect?
from license-expression.
Related Issues (20)
- Rename master to main branch
- Adopt calver for versions
- Show whether or not a license is deprecated in index.json HOT 1
- Update README HOT 6
- The order of the expression shouldn't be changed HOT 3
- Track which version of the SPDX license list is used HOT 4
- There should be a way to remove particular licenses or license expression from license expressions
- `AND` statements not flattened in dedup()
- Possible simplify error HOT 1
- Failing to validate GPL licenses HOT 4
- Update SPDX license list version HOT 8
- Please provide a proper documentation HOT 4
- Error thrown when Invalid license key character provided HOT 3
- Problem with exception symbols when using `get_spdx_licensing().validate()` HOT 5
- Deprecated SPDX licenses are marked as unknown
- SPDX Failing to parse license for no obvious reason HOT 1
- LLGPL appears to be treated as a plain license, not as a license exception HOT 8
- GNU-All-permissive-Copying-License HOT 7
- install dependencies? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from license-expression.