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

Discretization.discretize()   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 3
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