File size: 572 Bytes
6c3043e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import annotations

import json
from pathlib import Path

from agent_threat_map.schema import Probe


def load_probes(path: str | Path) -> list[Probe]:
    path = Path(path)
    probes: list[Probe] = []
    with path.open(encoding="utf-8") as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            probes.append(Probe.from_dict(json.loads(line)))
    return probes


def load_categories(path: str | Path) -> dict:
    with Path(path).open(encoding="utf-8") as f:
        return json.load(f)