From fba5ae697aa52f8fdd12763f2a498614551ebdb0 Mon Sep 17 00:00:00 2001 From: bskjon Date: Mon, 15 Apr 2024 01:18:25 +0200 Subject: [PATCH] Correction2 --- apps/pyMetadata/sources/select.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/pyMetadata/sources/select.py b/apps/pyMetadata/sources/select.py index cfcb6ea6..5baef7ec 100644 --- a/apps/pyMetadata/sources/select.py +++ b/apps/pyMetadata/sources/select.py @@ -1,5 +1,5 @@ import logging -from dataclasses import dataclass +from dataclasses import dataclass, asdict from typing import List, Optional from .result import Metadata, DataResult from .anii import metadata as AniiMetadata @@ -17,10 +17,16 @@ class WeightedData: result: DataResult weight: int = 1 + def to_dict(self): + return asdict(self) + @dataclass class DataAndScore: result: DataResult = None score: int = 0 + def to_dict(self): + + return asdict(self) class UseSource(): title: str @@ -69,6 +75,7 @@ class UseSource(): scored = self.__calculate_score(title=self.title, weightData=weightResult) scored.sort(key=lambda x: x.score, reverse=True) + jsr = "" try: jsr = json.dumps(scored, indent=4) with open(f"./logs/{self.evnetId}.json", "w", encoding="utf-8") as f: