summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-03 10:00:51 +0200
committerDanilo M. <danix@danix.xyz>2026-05-03 10:00:51 +0200
commitdf09c8dc84c7df2ba589c486b801454290a2b404 (patch)
tree923c3fd9f401804d72c9ba13d163f34bc7af37b6 /core
parentcf1c58081d68fe7f8833bc32589b4feb7210165f (diff)
downloadpublisher-df09c8dc84c7df2ba589c486b801454290a2b404.tar.gz
publisher-df09c8dc84c7df2ba589c486b801454290a2b404.zip
fix: remove unused field import, document orphan-discard contract in save_taxonomy
Diffstat (limited to 'core')
-rw-r--r--core/taxonomy.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/taxonomy.py b/core/taxonomy.py
index 9d71a91..8aee0aa 100644
--- a/core/taxonomy.py
+++ b/core/taxonomy.py
@@ -1,5 +1,5 @@
from __future__ import annotations
-from dataclasses import dataclass, field
+from dataclasses import dataclass
from pathlib import Path
@dataclass
@@ -18,6 +18,7 @@ def load_taxonomy(it_path: Path, en_path: Path) -> TaxonomyModel:
return TaxonomyModel(it_to_en=it_to_en, orphans_it=orphans_it, orphans_en=orphans_en)
def save_taxonomy(model: TaxonomyModel, it_path: Path, en_path: Path) -> None:
+ """Write paired terms to disk, sorted by IT term. Orphans are NOT written — callers must resolve them first."""
pairs = sorted(model.it_to_en.items(), key=lambda x: x[0])
it_path.write_text("\n".join(k for k, _ in pairs) + "\n")
en_path.write_text("\n".join(v for _, v in pairs) + "\n")