Source code for ascetic_ddd.faker.domain.specification.interfaces
import typing
from ascetic_ddd.session.interfaces import ISession
__all__ = (
'ISpecificationVisitor',
'ISpecificationVisitable',
'ISpecification',
)
T = typing.TypeVar("T")
T_contra = typing.TypeVar("T_contra", contravariant=True)
[docs]
class ISpecificationVisitor(typing.Protocol):
[docs]
def visit_query_specification(
self,
query: typing.Any, # IQueryOperator
aggregate_provider_accessor: typing.Callable[[], typing.Any] | None = None
):
...
[docs]
def visit_empty_specification(self):
...
[docs]
class ISpecificationVisitable(typing.Protocol):
[docs]
def accept(self, visitor: ISpecificationVisitor):
...
[docs]
class ISpecification(ISpecificationVisitable, typing.Protocol[T_contra]):
def __str__(self) -> str:
...
def __hash__(self) -> int:
...
def __eq__(self, other: object) -> bool:
...
[docs]
async def is_satisfied_by(self, session: ISession, obj: T_contra) -> bool:
...