WIP - Work on base classes

This commit is contained in:
GeoffreyCoulaud
2023-04-30 00:49:41 +02:00
parent 19496ab9c3
commit 524a56ea9a
9 changed files with 319 additions and 0 deletions

20
src/importer/location.py Normal file
View File

@@ -0,0 +1,20 @@
from dataclasses import dataclass
from functools import cached_property
from pathlib import Path
@dataclass
class Location():
"""Abstraction for a location that can be overriden by a schema key"""
win = None
default: str = None
key: str = None
@cached_property
def path(self):
override = Path(self.win.schema.get_string(self.path_override_key))
if override.exists():
return override
return self.path_default