decision_engine.comparisons   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 28
dl 0
loc 45
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A NotEqual.check() 0 2 1
A NoOp.check() 0 2 1
A LessThan.check() 0 2 1
A GreaterThanOrEqual.check() 0 2 1
A Equal.check() 0 2 1
A Comparison.check() 0 3 1
A GreaterThan.check() 0 2 1
A LessThanOrEqual.check() 0 2 1
1
from typing import Any
2
3
from abc import ABC, abstractmethod
4
5
6
class Comparison(ABC):
7
    @abstractmethod
8
    def check(self, x: Any, y: Any) -> bool:  # pragma: no cover
9
        raise NotImplementedError
10
11
12
class NoOp(Comparison):
13
    def check(self, x: Any, y: Any) -> bool:
14
        return True
15
16
17
class Equal(Comparison):
18
    def check(self, x: Any, y: Any) -> bool:
19
        return x == y
20
21
22
class NotEqual(Comparison):
23
    def check(self, x: Any, y: Any) -> bool:
24
        return x != y
25
26
27
class GreaterThan(Comparison):
28
    def check(self, x: Any, y: Any) -> bool:
29
        return x > y
30
31
32
class GreaterThanOrEqual(Comparison):
33
    def check(self, x: Any, y: Any) -> bool:
34
        return x >= y
35
36
37
class LessThan(Comparison):
38
    def check(self, x: Any, y: Any) -> bool:
39
        return x < y
40
41
42
class LessThanOrEqual(Comparison):
43
    def check(self, x: Any, y: Any) -> bool:
44
        return x <= y
45