diff --git a/tools/battery/nullmodel.py b/tools/battery/nullmodel.py index efb5c33e5..b1ef4fba3 100644 --- a/tools/battery/nullmodel.py +++ b/tools/battery/nullmodel.py @@ -39,6 +39,7 @@ RANDOM_R_FREE_MIN = 0.50 # lines of p_report.txt that say how and when the run was made, not what it decided PROVENANCE = {"DATE", "COMMAND_LINE", "WALL_TIME"} MODEL_SECTION = "5. MODEL VALIDATION" +SECTION_TITLE = re.compile(r"^# \d+\. [A-Z]") def f(x, fmt): @@ -61,7 +62,8 @@ def decision_keys(path): """KEY= lines of a report outside the model section, provenance left out.""" out, in_model = {}, False for line in open(path, errors="replace"): - if line.startswith("# ") and line[3:].strip()[:1].isdigit(): + # a numbered section's title ("# 5. MODEL VALIDATION"), not a table row that starts with a number + if SECTION_TITLE.match(line): in_model = line[3:].strip() == MODEL_SECTION m = score.REPORT_LINE.match(line.rstrip("\n")) if m and not in_model and m.group(1) not in PROVENANCE: