Completed
Push — master ( 7f328c...e44757 )
by Steffen
03:00
created

kuon.watcher.adapters.models.abstract_entity   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 32
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A AbstractEntity.__dict__() 0 7 1
A AbstractEntity.value() 0 8 1
A AbstractEntity.__repr__() 0 6 1
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3 1
from abc import ABC, abstractmethod
4
5
6 1
class AbstractEntity(ABC):
7
    """Abstract Entity abstract class"""
8
9
    def __repr__(self) -> str:
10
        """Return only the values we set before
11
12
        :return:
13
        """
14
        return str(self.value)
15
16 1
    @property
17 1
    def __dict__(self) -> dict:
18
        """Needed for JSON encoding the objects
19
20
        :return:
21
        """
22 1
        return self.value
23
24 1
    @property
25 1
    @abstractmethod
26 1
    def value(self) -> dict:
27
        """Returning all values we actually want to have in the model
28
29
        :return:
30
        """
31
        pass
32