Coverage for src / lexigram / contracts / domain / specification.py: 0%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-15 18:57 +0800

1"""SpecificationProtocol pattern relocated into domain package.""" 

2 

3from __future__ import annotations 

4 

5from typing import Protocol, TypeVar, runtime_checkable 

6 

7T = TypeVar("T") 

8 

9 

10@runtime_checkable 

11class SpecificationProtocol(Protocol[T]): 

12 """Protocol for the SpecificationProtocol pattern. 

13 

14 This class was previously defined in ``lexigram.contracts.specification`` 

15 before the 2026 reorg. It has been moved here alongside the other 

16 DDD primitives. A migration mapping ensures imports are rewritten. 

17 """ 

18 

19 def is_satisfied_by(self, candidate: T) -> bool: ... 

20 

21 def __and__(self, other: SpecificationProtocol[T]) -> SpecificationProtocol[T]: ... 

22 

23 def __or__(self, other: SpecificationProtocol[T]) -> SpecificationProtocol[T]: ... 

24 

25 def __invert__(self) -> SpecificationProtocol[T]: ... 

26 

27 

28__all__ = ["SpecificationProtocol", "T"]