1 | from __future__ import annotations |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
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 |
||
0 ignored issues
–
show
|
|||
7 | |||
8 | from mandos import MandosResources |
||
9 | from mandos.model import Search |
||
10 | |||
11 | |||
12 | @dataclass(frozen=True, eq=True, repr=True) |
||
0 ignored issues
–
show
|
|||
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) |
||
0 ignored issues
–
show
|
|||
22 | class KnowledgeSet: |
||
23 | sources: FrozenSet[Source] |
||
24 | |||
25 | @classmethod |
||
26 | def create(cls, param_values: Mapping[str, Union[None, str, int, float]]) -> KnowledgeSet: |
||
0 ignored issues
–
show
|
|||
27 | _data = NestedDotDict.read_json(MandosResources.path("knowledge.json")) |
||
28 | knowledge = [] |
||
0 ignored issues
–
show
|
|||
29 | params = {v["key"]: v for v in _data["params"]} |
||
30 | for source in _data["sources"]: |
||
0 ignored issues
–
show
|
|||
31 | for pkey, pvalue in params.items(): |
||
0 ignored issues
–
show
|
|||
32 | pass |
||
33 |