chore: update Q1 scripts with minor fixes
This commit is contained in:
parent
a13167dc3e
commit
8cfcb6d51f
|
|
@ -13,8 +13,6 @@ Room schema and identity hash are untouched. build_db.py is NOT run.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -279,7 +277,12 @@ def rewrite_template_overflow(files: dict[Path, dict[str, Any]]) -> dict[str, st
|
||||||
by_stem[stem].append(q)
|
by_stem[stem].append(q)
|
||||||
break
|
break
|
||||||
|
|
||||||
taken = {normalize_text(q["text"]) for data in files.values() for q in data.get("questions", []) if q.get("text")}
|
taken = {
|
||||||
|
normalize_text(q["text"])
|
||||||
|
for data in files.values()
|
||||||
|
for q in data.get("questions", [])
|
||||||
|
if q.get("text")
|
||||||
|
}
|
||||||
|
|
||||||
for stem, rows in by_stem.items():
|
for stem, rows in by_stem.items():
|
||||||
rows = sorted(rows, key=lambda item: item["id"])
|
rows = sorted(rows, key=lambda item: item["id"])
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue