Skip to content

Commit dbec2c0

Browse files
Polishing
1 parent 086fd84 commit dbec2c0

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

rre-dataset-generator/src/search_engine/data_store.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def default_serializer(obj):
152152
"""Default function to handle non-serializable objects"""
153153
if isinstance(obj, QueryRatingContext):
154154
return obj.to_dict()
155-
elif isinstance(obj, Document): # from pydantic import BaseModel
155+
elif isinstance(obj, Document): # more generall: from pydantic import BaseModel
156156
return obj.model_dump()
157157
else:
158158
# Convert to string as fallback
@@ -172,9 +172,6 @@ def load_tmp_file_content(self) -> None:
172172
"""
173173
Loads the content from a file on disk deserializing queries-ratings and documents.
174174
"""
175-
self._documents.clear()
176-
self._queries_by_id.clear()
177-
self._query_text_to_query_id.clear()
178175

179176
filepath: Path = self.ensure_path_and_folder_exists()
180177

@@ -185,6 +182,10 @@ def load_tmp_file_content(self) -> None:
185182
with filepath.open("r", encoding="utf-8") as f:
186183
file_content = json.load(f)
187184

185+
self._documents.clear()
186+
self._queries_by_id.clear()
187+
self._query_text_to_query_id.clear()
188+
188189
queries_data: Dict[str, Dict[str, Any]] = file_content.get("queries", {})
189190
documents_data: Dict[str, Dict[str, Any]] = file_content.get("documents", {})
190191

rre-dataset-generator/src/writers/abstract_writer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from abc import ABC, abstractmethod
22
from typing import List, Tuple
33
from pathlib import Path
4-
5-
from src.model.query_rating_context import QueryRatingContext
64
from src.search_engine.data_store import DataStore
75

86

0 commit comments

Comments
 (0)