Coverage for src/botadi/mokadi/mokadi_action.py: 80%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

15 statements  

1""" 

2@file 

3@brief Defines an action for Mokadi. 

4""" 

5 

6 

7class MokadiAction: 

8 """ 

9 Action. 

10 """ 

11 

12 def __init__(self, fLOG=None): 

13 """ 

14 Constructor. 

15 """ 

16 if fLOG is not None: 

17 self._fLOG = fLOG 

18 

19 def fLOG(self, *args, **kwargs): 

20 """ 

21 logging function 

22 """ 

23 if hasattr(self, "_fLOG") and self._fLOG is not None: 

24 self._fLOG(*args, **kwargs) 

25 

26 def __str__(self): 

27 """ 

28 usual 

29 """ 

30 return self.__class__.__name__ 

31 

32 def __repr__(self): 

33 """ 

34 usual 

35 """ 

36 return self.__class__.__name__ 

37 

38 def can_do(self, interpreted, message): 

39 """ 

40 Tells if the class can process the message. 

41 

42 @param interpreted interpreted message 

43 @param message message 

44 @return true if the class can process the message 

45 """ 

46 raise NotImplementedError("You should overload this method.") 

47 

48 def process_interpreted_message(self, interpretation, message): 

49 """ 

50 Process the interpreted message. 

51 

52 @param interpretation interpretation 

53 @param message original message 

54 @return iterator on Info 

55 """ 

56 raise NotImplementedError("You should overload this method.")