Completed
Push — master ( 80d6ff...d0b076 )
by Jace
16s
created

Font.__bool__()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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