SimpleCondition.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 14
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 3
dl 0
loc 14
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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