| Total Complexity | 4 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 92.31% |
| Changes | 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 | |||
| 55 |