| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from __future__ import annotations |
||
|
|
|||
| 2 | import abc |
||
| 3 | from dataclasses import dataclass |
||
| 4 | from typing import Union, Type, FrozenSet, Mapping |
||
| 5 | |||
| 6 | from pocketutils.core.dot_dict import NestedDotDict |
||
| 7 | |||
| 8 | from mandos import MandosResources |
||
| 9 | from mandos.model import Search |
||
| 10 | |||
| 11 | |||
| 12 | @dataclass(frozen=True, eq=True, repr=True) |
||
| 13 | class Source(metaclass=abc.ABCMeta): |
||
| 14 | meta_ref: str |
||
| 15 | ref: str |
||
| 16 | name: str |
||
| 17 | params: Mapping[str, Union[None, str, int, float]] |
||
| 18 | target: Type[Search] |
||
| 19 | |||
| 20 | |||
| 21 | @dataclass(frozen=True, eq=True, repr=True) |
||
| 22 | class KnowledgeSet: |
||
| 23 | sources: FrozenSet[Source] |
||
| 24 | |||
| 25 | @classmethod |
||
| 26 | def create(cls, param_values: Mapping[str, Union[None, str, int, float]]) -> KnowledgeSet: |
||
| 27 | _data = NestedDotDict.read_json(MandosResources.path("knowledge.json")) |
||
| 28 | knowledge = [] |
||
| 29 | params = {v["key"]: v for v in _data["params"]} |
||
| 30 | for source in _data["sources"]: |
||
| 31 | for pkey, pvalue in params.items(): |
||
| 32 | pass |
||
| 33 |