Coverage for o2/models/constraints/batching_constraints.py: 93%

14 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-05-16 11:18 +0000

1from abc import ABC, abstractmethod 

2from dataclasses import dataclass 

3from typing import TYPE_CHECKING 

4 

5from dataclass_wizard import JSONWizard 

6 

7from o2.models.timetable import BATCH_TYPE, RULE_TYPE 

8 

9if TYPE_CHECKING: 

10 from o2.models.timetable import TimetableType 

11 

12 

13@dataclass(frozen=True) 

14class BatchingConstraints(JSONWizard, ABC): 

15 """Base class for all batching constraints.""" 

16 

17 id: str 

18 tasks: list[str] 

19 batch_type: BATCH_TYPE 

20 rule_type: RULE_TYPE 

21 

22 @abstractmethod 

23 def verify_timetable(self, timetable: "TimetableType") -> bool: 

24 """Check if the timetable is valid against the constraints.""" 

25 pass