memegen.domain.font.Font.name()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 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