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

green_magic.data.interfaces   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 13
eloc 47
dl 0
loc 64
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A TabularIterator.itercolumns() 0 3 1
A Normalization.__subclasshook__() 0 3 1
A TabularIterator.columnnames() 0 3 1
A TabularRetriever.row() 0 3 1
A TabularRetriever.column() 0 3 1
A TabularRetriever.nb_rows() 0 3 1
A Encoding.encode() 0 3 1
A TabularRetriever.nb_columns() 0 3 1
A Discretization.discretize() 0 3 1
A Encoding.__subclasshook__() 0 3 1
A Discretization.__subclasshook__() 0 3 1
A Normalization.normalize() 0 3 1
A TabularIterator.iterrows() 0 3 1
1
from abc import ABCMeta, abstractmethod, ABC
2
3
__all__ = ['TabularIterator', 'TabularRetriever', 'Normalization', 'Discretization', 'Encoding', 'Visitor', 'Component']
4
5
6
class TabularRetriever(ABC):
7
    @abstractmethod
8
    def column(self, identifier, data):
9
        raise NotImplementedError
10
    @abstractmethod
11
    def row(self, identifier, data):
12
        raise NotImplementedError
13
    @abstractmethod
14
    def nb_columns(self, data):
15
        raise NotImplementedError
16
    @abstractmethod
17
    def nb_rows(self, data):
18
        raise NotImplementedError
19
20
21
class TabularIterator(ABC):
22
    @abstractmethod
23
    def iterrows(self, data):
24
        raise NotImplementedError
25
    @abstractmethod
26
    def itercolumns(self, data):
27
        raise NotImplementedError
28
    @abstractmethod
29
    def columnnames(self, data):
30
        raise NotImplementedError
31
32
33
class Normalization(metaclass=ABCMeta):
34
35
    @classmethod
36
    def __subclasshook__(cls, subclass):
37
        return hasattr(subclass, 'normalize') and callable(subclass.normalize)
38
39
    @abstractmethod
40
    def normalize(self, *args, **kwargs):
41
        raise NotImplementedError
42
43
44
class Discretization(metaclass=ABCMeta):
45
46
    @classmethod
47
    def __subclasshook__(cls, subclass):
48
        return hasattr(subclass, 'discretize') and callable(subclass.discretize)
49
50
    @abstractmethod
51
    def discretize(self, *args, **kwargs):
52
        raise NotImplementedError
53
54
55
class Encoding(metaclass=ABCMeta):
56
57
    @classmethod
58
    def __subclasshook__(cls, subclass):
59
        return hasattr(subclass, 'encode') and callable(subclass.encode)
60
61
    @abstractmethod
62
    def encode(self, *args, **kwargs):
63
        raise NotImplementedError