Passed
Push — dev ( 5faf7b...5a9f48 )
by Konstantinos
01:22
created

green_magic.data.interfaces   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 15
eloc 54
dl 0
loc 72
rs 10
c 0
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A TabularRetriever.row() 0 3 1
A TabularRetriever.column() 0 3 1
A TabularRetriever.nb_rows() 0 3 1
A TabularRetriever.nb_columns() 0 3 1
A TabularIterator.itercolumns() 0 3 1
A TabularIterator.columnnames() 0 3 1
A TabularRetriever.get_numerical_attributes() 0 3 1
A TabularIterator.iterrows() 0 3 1
A Normalization.__subclasshook__() 0 3 1
A Encoding.encode() 0 3 1
A TabularReporter.column_names() 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
1
from abc import ABCMeta, abstractmethod, ABC
2
3
__all__ = ['TabularIterator', 'TabularRetriever', 'TabularReporter', '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
    @abstractmethod
20
    def get_numerical_attributes(self, data):
21
        raise NotImplementedError
22
23
24
class TabularIterator(ABC):
25
    @abstractmethod
26
    def iterrows(self, data):
27
        raise NotImplementedError
28
    @abstractmethod
29
    def itercolumns(self, data):
30
        raise NotImplementedError
31
    @abstractmethod
32
    def columnnames(self, data):
33
        raise NotImplementedError
34
35
class TabularReporter(ABC):
36
    @abstractmethod
37
    def column_names(self, data):
38
        raise NotImplementedError
39
40
41
class Normalization(metaclass=ABCMeta):
42
43
    @classmethod
44
    def __subclasshook__(cls, subclass):
45
        return hasattr(subclass, 'normalize') and callable(subclass.normalize)
46
47
    @abstractmethod
48
    def normalize(self, *args, **kwargs):
49
        raise NotImplementedError
50
51
52
class Discretization(metaclass=ABCMeta):
53
54
    @classmethod
55
    def __subclasshook__(cls, subclass):
56
        return hasattr(subclass, 'discretize') and callable(subclass.discretize)
57
58
    @abstractmethod
59
    def discretize(self, *args, **kwargs):
60
        raise NotImplementedError
61
62
63
class Encoding(metaclass=ABCMeta):
64
65
    @classmethod
66
    def __subclasshook__(cls, subclass):
67
        return hasattr(subclass, 'encode') and callable(subclass.encode)
68
69
    @abstractmethod
70
    def encode(self, *args, **kwargs):
71
        raise NotImplementedError
72