Completed
Pull Request — master (#58)
by Jace
02:38
created

NameMixin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __str__() 0 2 1
A __ne__() 0 2 1
A __lt__() 0 2 1
A __eq__() 0 2 1
1
"""Shared base classes and mixins."""
2
3
4 1
class NameMixin:
5
    """Mixin class for objects identified by their name."""
6
7 1
    def __str__(self):
8 1
        return str(self.name)
9
10 1
    def __eq__(self, other):
11 1
        return str(self).lower() == str(other).lower()
12
13 1
    def __ne__(self, other):
14 1
        return not self.__eq__(other)
15
16 1
    def __lt__(self, other):
17
        return str(self).lower() < str(other).lower()
18