| Total Complexity | 3 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """ |
||
| 11 | class Message(metaclass=abc.ABCMeta): |
||
| 12 | """ |
||
| 13 | Class for messages exchanged between the processes of Enarksh. |
||
| 14 | """ |
||
| 15 | |||
| 16 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 17 | message_controller = None |
||
| 18 | """ |
||
| 19 | The message controller. |
||
| 20 | |||
| 21 | :type: None|enarksh.message.MessageController.MessageController |
||
| 22 | """ |
||
| 23 | |||
| 24 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 25 | def __init__(self, message_type): |
||
| 26 | """ |
||
| 27 | Object constructor. |
||
| 28 | """ |
||
| 29 | self._message_type = message_type |
||
| 30 | """ |
||
| 31 | The type of the message. |
||
| 32 | |||
| 33 | :type: str |
||
| 34 | """ |
||
| 35 | |||
| 36 | self.message_source = None |
||
| 37 | """ |
||
| 38 | For incoming messages the name of the source of the message. This field will be set by the message controller. |
||
| 39 | |||
| 40 | :type: str |
||
| 41 | """ |
||
| 42 | |||
| 43 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 44 | @property |
||
| 45 | def message_type(self): |
||
| 46 | """ |
||
| 47 | Returns the message type of this message. |
||
| 48 | |||
| 49 | :rtype: str |
||
| 50 | """ |
||
| 51 | return self._message_type |
||
| 52 | |||
| 53 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 54 | @abc.abstractmethod |
||
| 55 | def send_message(self, end_point): |
||
| 56 | """ |
||
| 57 | Sends the message to an end point. |
||
| 58 | |||
| 59 | :param str end_point: The end point. |
||
| 60 | |||
| 61 | :rtype: None|enarksh.message.Message.Message |
||
| 62 | """ |
||
| 63 | raise NotImplementedError() |
||
| 64 | |||
| 66 |