Coverage for kwai/modules/training/trainings/training_definition_query.py: 100%

4 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-09-05 17:55 +0000

1"""Module that defines an interface for a training definition query.""" 

2 

3 

4from abc import ABC, abstractmethod 

5 

6from kwai.core.domain.repository.query import Query 

7from kwai.modules.training.trainings.training_definition import ( 

8 TrainingDefinitionIdentifier, 

9) 

10 

11 

12class TrainingDefinitionQuery(Query, ABC): 

13 """Interface for a training definition query.""" 

14 

15 @abstractmethod 

16 def filter_by_id( 

17 self, id_: TrainingDefinitionIdentifier 

18 ) -> "TrainingDefinitionQuery": 

19 """Add a filter on the training definition id. 

20 

21 Args: 

22 id_: id of a training definition 

23 

24 Returns: 

25 TrainingDefinitionQuery: 

26 """ 

27 raise NotImplementedError 

28 

29 @abstractmethod 

30 def filter_by_ids( 

31 self, *ids: TrainingDefinitionIdentifier 

32 ) -> "TrainingDefinitionQuery": 

33 """Add a filter on multiple training definition identifiers. 

34 

35 Args: 

36 ids: a variable list of training definition identifiers 

37 

38 Returns: 

39 TrainingDefinitionQuery: 

40 """ 

41 raise NotImplementedError