Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mit AND (mit OR bsd-new) incorrectly simplifies to mit #49

Closed
steven-esser opened this issue Dec 6, 2019 · 3 comments
Closed

mit AND (mit OR bsd-new) incorrectly simplifies to mit #49

steven-esser opened this issue Dec 6, 2019 · 3 comments
Assignees
Labels

Comments

@steven-esser
Copy link
Contributor

>>> from license_expression import Licensing
>>> Licensing().parse('mit AND (mit OR bsd-new)').simplify()
LicenseSymbol('mit', is_exception=False)

From the above output, one can see that mit AND (mit OR bsd-new) simplifies down to just mit. If this were just boolean logical elements, this result would be correct. However, when its a license-expression, we are loosing data (this case, the bsd-new key).

In a perfect world, I would like the result to be simply reduce to mit OR bsd-new.

@pombredanne
Copy link
Member

Actually I think that mit AND (mit OR bsd-new) should be reduced to mit AND (mit OR bsd-new) and nothing else. (e.g. not be reduced).
IMHO the approach should be to have an option to keep the choices and treat these as something that cannot be simplified further (such that the choice stays)

So mit AND (mit OR bsd-new) AND mit AND (mit OR bsd-new) should be reduced to mit AND (mit OR bsd-new) but not your exmaple above IMHO.

@pombredanne
Copy link
Member

My point is that in mit AND (mit OR bsd-new) the mit terms would always apply and the bsd-new terms may apply depending on your choice, so the terms cannot be reduce to mit OR bsd-new only.

@DennisClark
Copy link
Member

Agreed with @pombredanne

@chinyeungli chinyeungli self-assigned this Feb 16, 2021
chinyeungli added a commit that referenced this issue Feb 16, 2021
 * Instead of using the simplify() from the boolean.py (as it over
simplified the expression and the order cannot be kept), I've
implemented a new function, dedup(self, expression), to de-duplicate the
license_expression and keep the order of the license key.

Signed-off-by: Chin Yeung Li <tli@nexb.com>
pombredanne added a commit that referenced this issue Jun 4, 2021
Deduplicate license expressions correctly #49

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue May 10, 2022
Disable Python 3.10 tests on macOS 10.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants