| Total Complexity | 5 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from pathlib import Path |
||
| 2 | |||
| 3 | from ..domain import Font |
||
| 4 | |||
| 5 | |||
| 6 | class FontStore: |
||
| 7 | |||
| 8 | def __init__(self, root): |
||
| 9 | self._items = {} |
||
| 10 | for path in Path(root).iterdir(): |
||
| 11 | font = Font(path) |
||
| 12 | self._items[font.name] = font |
||
| 13 | |||
| 14 | def all(self): |
||
| 15 | return self._items |
||
| 16 | |||
| 17 | def find(self, key): |
||
| 18 | try: |
||
| 19 | return self._items[key] |
||
| 20 | except KeyError: |
||
| 21 | return None |
||
| 22 |