# Path: formulaic/parser/types/term.py
# class Term:
#     """
#     Represents a "term" of a formula.
# 
#     A "term" is a product of "factors" (represented by `Factor`) instances, and
#     a formula is made up of a sum of terms.
# 
#     Attributes:
#         factors: The set of factors to be multipled to form the term.
#     """
# 
#     def __init__(self, factors: Iterable["Factor"]):
#         self.factors = set(factors)
# 
#     def __mul__(self, other):
#         if isinstance(other, Term):
#             return Term([*self.factors, *other.factors])
#         return NotImplemented
# 
#     @property
#     def _tuple(self):
#         return tuple(factor.expr for factor in sorted(self.factors))
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         if isinstance(other, Term):
#             return self._tuple == other._tuple
#         if isinstance(other, str):
#             return repr(self) == other
#         return NotImplemented
# 
#     def __lt__(self, other):
#         if isinstance(other, Term):
#             if len(self.factors) == len(other.factors):
#                 return sorted(self.factors) < sorted(other.factors)
#             if len(self.factors) < len(other.factors):
#                 return True
#             return False
#         return NotImplemented
# 
#     def __repr__(self):
#         return ":".join(self._tuple)


from enum import Enum
from typing import Dict, Iterable, Optional, Union
from .term import Term
        self._eval_method = Factor.EvalMethod(eval_method or "unknown")

    @property
    def kind(self) -> Kind:
        return self._kind

    @kind.setter
    def kind(self, kind):
        self._kind = Factor.Kind(kind or "unknown")

    def __eq__(self, other):
        if isinstance(other, str):
            return self.expr == other
        if isinstance(other, Factor):
            return self.expr == other.expr
        return NotImplemented

    def __hash__(self):
        return self.expr.__hash__()

    def __lt__(self, other):
        if isinstance(other, Factor):
            return self.expr < other.expr
        return NotImplemented

    def to_terms(self) -> Iterable[Term]:
        """
        Convert this `Factor` instance into a `Term` instance, and expose it as
        a single-element iterable.
        """

# Path: formulaic/parser/types/term.py
# class Term:
#     """
#     Represents a "term" of a formula.
# 
#     A "term" is a product of "factors" (represented by `Factor`) instances, and
#     a formula is made up of a sum of terms.
# 
#     Attributes:
#         factors: The set of factors to be multipled to form the term.
#     """
# 
#     def __init__(self, factors: Iterable["Factor"]):
#         self.factors = set(factors)
# 
#     def __mul__(self, other):
#         if isinstance(other, Term):
#             return Term([*self.factors, *other.factors])
#         return NotImplemented
# 
#     @property
#     def _tuple(self):
#         return tuple(factor.expr for factor in sorted(self.factors))
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         if isinstance(other, Term):
#             return self._tuple == other._tuple
#         if isinstance(other, str):
#             return repr(self) == other
#         return NotImplemented
# 
#     def __lt__(self, other):
#         if isinstance(other, Term):
#             if len(self.factors) == len(other.factors):
#                 return sorted(self.factors) < sorted(other.factors)
#             if len(self.factors) < len(other.factors):
#                 return True
#             return False
#         return NotImplemented
# 
#     def __repr__(self):
#         return ":".join(self._tuple)


# Path: formulaic/parser/types/factor.py
from enum import Enum
from typing import Dict, Iterable, Optional, Union
from .term import Term

        self._eval_method = Factor.EvalMethod(eval_method or "unknown")

    @property
    def kind(self) -> Kind:
        return self._kind

    @kind.setter
    def kind(self, kind):
        self._kind = Factor.Kind(kind or "unknown")

    def __eq__(self, other):
        if isinstance(other, str):
            return self.expr == other
        if isinstance(other, Factor):
            return self.expr == other.expr
        return NotImplemented

    def __hash__(self):
        return self.expr.__hash__()

    def __lt__(self, other):
        if isinstance(other, Factor):
            return self.expr < other.expr
        return NotImplemented

    def to_terms(self) -> Iterable[Term]:
        """
        Convert this `Factor` instance into a `Term` instance, and expose it as
        a single-element iterable.
        """

        return {Term([self])}