Coverage for src/seqrule/generators/constraints.py: 89%
9 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-27 10:39 -0600
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-27 10:39 -0600
1"""
2Constraints for sequence generation.
4This module provides constraint definitions for controlling
5sequence generation.
6"""
8from dataclasses import dataclass
9from typing import Any, Callable
12@dataclass
13class Constraint:
14 """Represents a constraint on sequence generation."""
16 property_name: str
17 condition: Callable[[Any], bool]
18 description: str = ""
20 def __call__(self, value: Any) -> bool:
21 """Apply the constraint to a value."""
22 return self.condition(value)