# Path: tt/definitions/operands.py
# BOOLEAN_VALUES = {0, 1, True, False}
# 
# Path: tt/errors/evaluation.py
# class InvalidBooleanValueError(EvaluationError):
#     """An exception for when an invalid truth or don't care value is passed.
# 
#     Here's an example where we attempt to evaluate a \
#     :class:`BooleanExpression <tt.expressions.bexpr.BooleanExpression>` with
#     an invalid value passed through ``kwargs``::
# 
#         >>> from tt import BooleanExpression
#         >>> b = BooleanExpression('A or B')
#         >>> b.evaluate(A=1, B='brian')
#         Traceback (most recent call last):
#             ...
#         tt.errors.evaluation.InvalidBooleanValueError: "brian" passed as \
# value for "B" is not a valid Boolean value
# 
#     """
# 
# Path: tt/errors/symbols.py
# class DuplicateSymbolError(SymbolError):
#     """An exception type for user-specified duplicate symbols.
# 
#     Here's an example where we try to pass duplicate symbols to the
#     ``ordering`` property of the :class:`TruthTable \
#     <tt.tables.truth_table.TruthTable>` class::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable('A or B', ordering=['A', 'A', 'B'])
#         Traceback (most recent call last):
#             ...
#         tt.errors.symbols.DuplicateSymbolError: Received duplicate symbols
# 
#     """
# 
# class ExtraSymbolError(SymbolError):
#     """An exception for a passed token that is not a parsed symbol.
# 
#     Here's a quick table example::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable('A or B', ordering=['A', 'B', 'C'])
#         Traceback (most recent call last):
#             ...
#         tt.errors.symbols.ExtraSymbolError: Received unexpected symbols: "C"
# 
#     """
# 
# class MissingSymbolError(SymbolError):
#     """An exception type for a missing token value in evaluation.
# 
#     .. code-block:: python
# 
#         >>> from tt import BooleanExpression
#         >>> b = BooleanExpression('A and B')
#         >>> b.evaluate(A=1)
#         Traceback (most recent call last):
#             ...
#         tt.errors.symbols.MissingSymbolError: Did not receive value for the \
# following symbols: "B"
# 
#     """


from tt.definitions import BOOLEAN_VALUES
from tt.errors import (
    DuplicateSymbolError,
    ExtraSymbolError,
    InvalidBooleanValueError,
    MissingSymbolError)
    .. note::

        This function will consume ``iter_of_strs``.

    :raises DuplicateSymbolError: If the passed iterable contains more than one
        of a given symbol.
    :raises ExtraSymbolError: If the passed iterable contains symbols not
        present in the reference set.
    :raises MissingSymbolError: If the passed iterable is missing symbols
        present in the reference set.

    This assertion is used for validation of user-specified sets of symbols.

    """
    passed_symbol_list = list(iter_of_strs)
    passed_symbol_set = set(passed_symbol_list)
    if len(passed_symbol_list) != len(passed_symbol_set):
        raise DuplicateSymbolError('Received duplicate symbols')

    passed_excess_set = passed_symbol_set - reference_set
    reference_excess_set = reference_set - passed_symbol_set

    if reference_excess_set:
        msg = 'Did not receive value for the following symbols: '
        msg += ', '.join('"{}"'.format(sym) for sym in reference_excess_set)
        raise MissingSymbolError(msg)

    if passed_excess_set:
        msg = 'Received unexpected symbols: '
        msg += ', '.join('"{}"'.format(sym) for sym in passed_excess_set)

# Path: tt/definitions/operands.py
# BOOLEAN_VALUES = {0, 1, True, False}
# 
# Path: tt/errors/evaluation.py
# class InvalidBooleanValueError(EvaluationError):
#     """An exception for when an invalid truth or don't care value is passed.
# 
#     Here's an example where we attempt to evaluate a \
#     :class:`BooleanExpression <tt.expressions.bexpr.BooleanExpression>` with
#     an invalid value passed through ``kwargs``::
# 
#         >>> from tt import BooleanExpression
#         >>> b = BooleanExpression('A or B')
#         >>> b.evaluate(A=1, B='brian')
#         Traceback (most recent call last):
#             ...
#         tt.errors.evaluation.InvalidBooleanValueError: "brian" passed as \
# value for "B" is not a valid Boolean value
# 
#     """
# 
# Path: tt/errors/symbols.py
# class DuplicateSymbolError(SymbolError):
#     """An exception type for user-specified duplicate symbols.
# 
#     Here's an example where we try to pass duplicate symbols to the
#     ``ordering`` property of the :class:`TruthTable \
#     <tt.tables.truth_table.TruthTable>` class::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable('A or B', ordering=['A', 'A', 'B'])
#         Traceback (most recent call last):
#             ...
#         tt.errors.symbols.DuplicateSymbolError: Received duplicate symbols
# 
#     """
# 
# class ExtraSymbolError(SymbolError):
#     """An exception for a passed token that is not a parsed symbol.
# 
#     Here's a quick table example::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable('A or B', ordering=['A', 'B', 'C'])
#         Traceback (most recent call last):
#             ...
#         tt.errors.symbols.ExtraSymbolError: Received unexpected symbols: "C"
# 
#     """
# 
# class MissingSymbolError(SymbolError):
#     """An exception type for a missing token value in evaluation.
# 
#     .. code-block:: python
# 
#         >>> from tt import BooleanExpression
#         >>> b = BooleanExpression('A and B')
#         >>> b.evaluate(A=1)
#         Traceback (most recent call last):
#             ...
#         tt.errors.symbols.MissingSymbolError: Did not receive value for the \
# following symbols: "B"
# 
#     """


# Path: tt/_assertions/collections.py
from tt.definitions import BOOLEAN_VALUES
from tt.errors import (
    DuplicateSymbolError,
    ExtraSymbolError,
    InvalidBooleanValueError,
    MissingSymbolError)

    .. note::

        This function will consume ``iter_of_strs``.

    :raises DuplicateSymbolError: If the passed iterable contains more than one
        of a given symbol.
    :raises ExtraSymbolError: If the passed iterable contains symbols not
        present in the reference set.
    :raises MissingSymbolError: If the passed iterable is missing symbols
        present in the reference set.

    This assertion is used for validation of user-specified sets of symbols.

    """
    passed_symbol_list = list(iter_of_strs)
    passed_symbol_set = set(passed_symbol_list)
    if len(passed_symbol_list) != len(passed_symbol_set):
        raise DuplicateSymbolError('Received duplicate symbols')

    passed_excess_set = passed_symbol_set - reference_set
    reference_excess_set = reference_set - passed_symbol_set

    if reference_excess_set:
        msg = 'Did not receive value for the following symbols: '
        msg += ', '.join('"{}"'.format(sym) for sym in reference_excess_set)
        raise MissingSymbolError(msg)

    if passed_excess_set:
        msg = 'Received unexpected symbols: '
        msg += ', '.join('"{}"'.format(sym) for sym in passed_excess_set)

        raise ExtraSymbolError(msg)