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

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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