memegen.stores.font.FontStore.find()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 5
cts 5
cp 1
crap 2
1 1
from pathlib import Path
2
3 1
from ..domain import Font
4
5
6 1
class FontStore:
7
8 1
    def __init__(self, root):
9 1
        self._items = {}
10 1
        for path in Path(root).iterdir():
11 1
            font = Font(path)
12 1
            self._items[font.name] = font
13
14 1
    def all(self):
15 1
        return self._items
16
17 1
    def find(self, key):
18 1
        try:
19 1
            return self._items[key]
20 1
        except KeyError:
21
            return None
22