Cohérence des dépôts : controle.py et ids.py se lancent d'ici ou par le lien ; notes sans renvois morts (pompage dans aimsight-data, règles non négociables recopiées, analyste de Diagnostic-App)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b465d5c99b
commit
6067f8dfcd
8 files changed
+23
-15
No files matched your search
@@ -11,6 +11,8 @@ import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
AUTO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "auto") # ~/labeling/auto, ou par le lien labeling/
|
||||
|
||||
|
||||
def en_tete(e):
|
||||
"""Remet l'id en premier champ de l'étiquette, en place (les lignes se lisent par leur id)."""
|
||||
@@ -39,7 +41,7 @@ def attribuer(station, etiquettes, retires=()):
|
||||
|
||||
|
||||
def fichier(station):
|
||||
p = f"labeling/auto/{station}.jsonl"
|
||||
p = os.path.join(AUTO, f"{station}.jsonl")
|
||||
lignes = [l for l in open(p, encoding="utf-8") if l.strip()]
|
||||
es = [json.loads(l) for l in lignes]
|
||||
attribuer(station, es)
|
||||
@@ -53,9 +55,9 @@ def fichier(station):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
stations = sys.argv[1:] or sorted(os.path.basename(p)[:-6] for p in glob.glob("labeling/auto/*.jsonl"))
|
||||
stations = sys.argv[1:] or sorted(os.path.basename(p)[:-6] for p in glob.glob(os.path.join(AUTO, "*.jsonl")))
|
||||
for st in stations:
|
||||
avant = sum(1 for l in open(f"labeling/auto/{st}.jsonl", encoding="utf-8") if l.strip() and '"id"' not in l)
|
||||
avant = sum(1 for l in open(os.path.join(AUTO, f"{st}.jsonl"), encoding="utf-8") if l.strip() and '"id"' not in l)
|
||||
es = fichier(st)
|
||||
ids = [e["id"] for e in es]
|
||||
assert len(ids) == len(set(ids)), f"{st} : ids en double"
|
||||
|
||||
Reference in new issue
Block a user