Source code for tt.errors.symbols
"""Exception types related to symbol processing."""
from .base import TtError
[docs]class SymbolError(TtError):
"""An exception for errors occurring in symbol processing.
.. note::
This exception type should be sub-classed and is not meant to be raised
explicitly.
"""
[docs]class DuplicateSymbolError(SymbolError):
"""An exception type for user-specified duplicate symbols.
.. code-block:: python
>>> from tt import TruthTable
>>> try:
... t = TruthTable('A or B', ordering=['A', 'A', 'B'])
... except Exception as e:
... print(type(e))
...
<class 'tt.errors.symbols.DuplicateSymbolError'>
"""
[docs]class MissingSymbolError(SymbolError):
"""An exception type for a missing token value in evaluation.
.. code-block:: python
>>> from tt import BooleanExpression
>>> try:
... b = BooleanExpression('A and B')
... b.evaluate(A=1)
... except Exception as e:
... print(type(e))
...
<class 'tt.errors.symbols.MissingSymbolError'>
"""