Passed
Push — dev ( 1b3874...6a1e3c )
by Konstantinos
03:33
created

DataManager.commands()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
import attr
2
from green_magic.utils import GenericMediator, BaseComponent
3
from enum import Enum
4
5
6
class MediatorEvent(Enum):
7
    A = 'A'
8
    B = 'B'
9
    C = 'C'
10
11
12
class DataMediator(GenericMediator):
13
    def __init__(self, *args, **kwargs):
14
        self.events = kwargs.get('events', {})
15
16
    def notify(self, sender: object, event: str) -> None:
17
        pass
18
19
20
@attr.s
21
class DataManager:
22
    commands_manager = attr.ib(init=True)
23
    backend = attr.ib(init=True)
24
    mediator = attr.ib(init=False, default=None)
25
26
    def __attrs_post_init__(self):
27
        self.mediator = DataMediator(self.commands_manager, self.backend)
28
29
    @property
30
    def commands(self):
31
        return self.commands_manager.commands_dict
32
33
    @property
34
    def command(self):
35
        return self.commands_manager.command