mandos.knowledge.KnowledgeSet.create()   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 8
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
from __future__ import annotations
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
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
introduced by
Unable to import 'pocketutils.core.dot_dict'
Loading history...
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
introduced by
Missing class docstring
Loading history...
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
introduced by
Missing class docstring
Loading history...
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
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
The argument param_values seems to be unused.
Loading history...
27
        _data = NestedDotDict.read_json(MandosResources.path("knowledge.json"))
28
        knowledge = []
0 ignored issues
show
Unused Code introduced by
The variable knowledge seems to be unused.
Loading history...
29
        params = {v["key"]: v for v in _data["params"]}
30
        for source in _data["sources"]:
0 ignored issues
show
Unused Code introduced by
The variable source seems to be unused.
Loading history...
31
            for pkey, pvalue in params.items():
0 ignored issues
show
Unused Code introduced by
The variable pkey seems to be unused.
Loading history...
Unused Code introduced by
The variable pvalue seems to be unused.
Loading history...
32
                pass
33