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

4 statements  

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

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

2 

3from abc import ABC, abstractmethod 

4 

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

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

7 TrainingDefinitionIdentifier, 

8) 

9 

10 

11class TrainingDefinitionQuery(Query, ABC): 

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

13 

14 @abstractmethod 

15 def filter_by_id( 

16 self, id_: TrainingDefinitionIdentifier 

17 ) -> "TrainingDefinitionQuery": 

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

19 

20 Args: 

21 id_: id of a training definition 

22 

23 Returns: 

24 TrainingDefinitionQuery: 

25 """ 

26 raise NotImplementedError 

27 

28 @abstractmethod 

29 def filter_by_ids( 

30 self, *ids: TrainingDefinitionIdentifier 

31 ) -> "TrainingDefinitionQuery": 

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

33 

34 Args: 

35 ids: a variable list of training definition identifiers 

36 

37 Returns: 

38 TrainingDefinitionQuery: 

39 """ 

40 raise NotImplementedError