Coverage for bc/kwai-bc-training/src/kwai_bc_training/coaches/coach_query.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module that defines an interface for a coach query.""" 

2 

3from abc import ABC, abstractmethod 

4from typing import Self 

5 

6from kwai_core.domain.repository.query import Query 

7from kwai_core.domain.value_objects.unique_id import UniqueId 

8 

9from kwai_bc_training.coaches.coach import CoachIdentifier 

10 

11 

12class CoachQuery(Query, ABC): 

13 """Interface for a coach query.""" 

14 

15 @abstractmethod 

16 def filter_by_id(self, id_: CoachIdentifier) -> Self: 

17 """Add a filter for a given id. 

18 

19 Args: 

20 id_: A coach id. 

21 """ 

22 raise NotImplementedError 

23 

24 @abstractmethod 

25 def filter_by_ids(self, *id_: CoachIdentifier) -> Self: 

26 """Add a filter on one or more coach identifiers. 

27 

28 Args: 

29 id_: one or more ids of a coach. 

30 """ 

31 raise NotImplementedError 

32 

33 @abstractmethod 

34 def filter_by_active(self) -> Self: 

35 """Add a filter for the active coaches.""" 

36 raise NotImplementedError 

37 

38 @abstractmethod 

39 def filter_by_uuid(self, uuid: UniqueId) -> Self: 

40 """Add a filter for getting the coach for the given uuid of a member.""" 

41 raise NotImplementedError 

42 

43 @abstractmethod 

44 def filter_by_uuids(self, *uuids: UniqueId) -> Self: 

45 """Add a filter for getting the coach for the given member uuids.""" 

46 raise NotImplementedError