bastikr / boolean.py

Implements boolean algebra in one module.
BSD 2-Clause "Simplified" License
76 stars 34 forks source link

Simplifying "not (True and False) or True" results in '_TRUE' object is not callable #85

Open 1v-0 opened 5 years ago

1v-0 commented 5 years ago
from boolean import BooleanAlgebra
BooleanAlgebra().parse("not (True and False) or True").simplify()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ivigan/topic-streams-tools/env/lib/python3.6/site-packages/boolean/boolean.py", line 1170, in simplify
    expr = expr.literalize()
  File "/home/ivigan/topic-streams-tools/env/lib/python3.6/site-packages/boolean/boolean.py", line 603, in literalize
    args = tuple(arg.literalize() for arg in self.args)
  File "/home/ivigan/topic-streams-tools/env/lib/python3.6/site-packages/boolean/boolean.py", line 603, in <genexpr>
    args = tuple(arg.literalize() for arg in self.args)
  File "/home/ivigan/topic-streams-tools/env/lib/python3.6/site-packages/boolean/boolean.py", line 1035, in literalize
    expr = self.demorgan()
  File "/home/ivigan/topic-streams-tools/env/lib/python3.6/site-packages/boolean/boolean.py", line 1084, in demorgan
    return op.dual(*(self.__class__(arg).cancel() for arg in op.args))
TypeError: '_TRUE' object is not callable
kkew3 commented 5 years ago

Same here for OR(FALSE, NOT(AND(TRUE, TRUE))), which gives TypeError: '_FALSE' object is not callable.