etlt.condition.SimpleCondition   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 92.31%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 53
ccs 12
cts 13
cp 0.9231
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A SimpleCondition.expression() 0 6 1
A SimpleCondition.field() 0 6 1
A SimpleCondition.scheme() 0 7 1
A SimpleCondition.__init__() 0 14 1
1 1
import abc
2
3 1
from etlt.condition.Condition import Condition
4
5
6 1
class SimpleCondition(Condition):
7
    """
8
    A simple condition matches a single field in the row against an expression.
9
    """
10
11
    # ------------------------------------------------------------------------------------------------------------------
12 1
    def __init__(self, field: str, expression: str):
13
        """
14
        Object contructor.
15
16
        :param field: The name of the field in the row that must be match against the expression.
17
        :param expression: The expression.
18
        """
19 1
        self._field: str = field
20
        """
21
        The name of the field in the row that must be match against the expression.
22
        """
23
24
        self._expression: str = expression
25
        """
26 1
        The expression.
27 1
        """
28
29
    # ------------------------------------------------------------------------------------------------------------------
30
    @property
31
    def expression(self) -> str:
32
        """
33
        Returns the expression.
34 1
        """
35 1
        return self._expression
36
37
    # ------------------------------------------------------------------------------------------------------------------
38
    @property
39
    def field(self) -> str:
40
        """
41 1
        Returns the name of the field in the row that must be match against the expression.
42
        """
43
        return self._field
44 1
45 1
    # ------------------------------------------------------------------------------------------------------------------
46
    @property
47
    @abc.abstractmethod
48
    def scheme(self) -> str:
49
        """
50
        Returns the scheme of the simple condition.
51
        """
52
        raise NotImplementedError()
53
54
# ----------------------------------------------------------------------------------------------------------------------
55