memegen.domain.font   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 15
cts 15
cp 1
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A Font.__init__() 0 2 1
A Font.__str__() 0 2 1
A Font.__bool__() 0 2 1
A Font.name() 0 3 1
A Font.path() 0 3 1
1 1
from pathlib import Path
2 1
3
4
class Font:
5 1
    """Font file used to render text onto an image."""
6
7
    DEFAULT = 'titilliumweb-black'
8 1
    WATERMARK = 'tahoma-bold'
9
10
    def __init__(self, path):
11 1
        self._path = path
12
13 1
    def __str__(self):
14 1
        return self.name
15
16 1
    def __bool__(self):
17 1
        return self.name != self.DEFAULT
18
19 1
    @property
20 1
    def name(self):
21
        return self._path.stem.lower().replace('_', '-')
22 1
23
    @property
24 1
    def path(self):
25
        return str(self._path)
26 1
27
    @path.setter
28 1
    def path(self, value):
29
        self._path = Path(value)
30