satcfdi.models.code.Code.__gt__()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 3.6875

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 2
dl 0
loc 4
ccs 1
cts 4
cp 0.25
crap 3.6875
rs 10
c 0
b 0
f 0
1 1
import logging
2
3 1
logger = logging.getLogger(__name__)
4
5
6 1
class Code:
7 1
    def __init__(self, code, description):
8 1
        self.code = code
9 1
        self.description = description
10
11 1
    def __str__(self):
12 1
        if self.description is None:
13 1
            return self.code
14 1
        if isinstance(self.description, list):
15 1
            return str(self.code) + " - " + "; ".join(self.description)
16 1
        return str(self.code) + " - " + str(self.description)
17
18
    def __repr__(self):
19
        # return '%s.%s(%s)' % (self.__class__.__module__,
20
        #                       self.__class__.__qualname__,
21
        #                       f'{repr(self.code)}, {repr(self.description)}')
22
23
        return '%s(%s)' % (
24
            self.__class__.__qualname__,
25
            f'{repr(self.code)}, {repr(self.description)}'
26
        )
27
28 1
    def __eq__(self, other):
29 1
        if isinstance(other, Code):
30 1
            return self.code == other.code
31 1
        return self.code == other
32
33 1
    def __ne__(self, other):
34 1
        if isinstance(other, Code):
35
            return self.code != other.code
36 1
        return self.code != other
37
38 1
    def __lt__(self, other):
39
        if isinstance(other, Code):
40
            return self.code < other.code
41
        return self.code < other
42
43 1
    def __le__(self, other):
44
        if isinstance(other, Code):
45
            return self.code <= other.code
46
        return self.code <= other
47
48 1
    def __gt__(self, other):
49
        if isinstance(other, Code):
50
            return self.code > other.code
51
        return self.code > other
52
53 1
    def __ge__(self, other):
54
        if isinstance(other, Code):
55
            return self.code >= other.code
56
        return self.code >= other
57
58 1
    def __hash__(self):
59 1
        return self.code.__hash__()
60
61
62