lint: explicit encoding on harness file opens (ruff unspecified-encoding)
This commit is contained in:
@@ -41,7 +41,7 @@ for task_id in task_ids:
|
||||
out = f"{RESULTS}/{arm}__{task_id}__rep{rep}.json"
|
||||
if os.path.exists(out):
|
||||
try:
|
||||
with open(out) as f:
|
||||
with open(out, encoding="utf-8") as f:
|
||||
rec = json.load(f)
|
||||
if rec.get("error") is None or rec.get("score", 0) > 0:
|
||||
continue # keep good/attempted records
|
||||
@@ -70,7 +70,7 @@ def run_cell(cell):
|
||||
"total_tokens": None, "wall_s": round(time.time() - t0, 1),
|
||||
"bridge_calls": None, "tool_calls_total": None,
|
||||
"tool_counts": {}, "raw_xml_noise": False}
|
||||
with open(out, "w") as f:
|
||||
with open(out, "w", encoding="utf-8") as f:
|
||||
json.dump(rec, f, indent=1)
|
||||
return (cell, "WORKER_ERR", p.stderr[-300:])
|
||||
return (cell, "OK", p.stdout.strip().splitlines()[-1] if p.stdout.strip() else "")
|
||||
@@ -80,7 +80,7 @@ def run_cell(cell):
|
||||
"api_turns": None, "total_tokens": None,
|
||||
"wall_s": round(time.time() - t0, 1), "bridge_calls": None,
|
||||
"tool_calls_total": None, "tool_counts": {}, "raw_xml_noise": False}
|
||||
with open(out, "w") as f:
|
||||
with open(out, "w", encoding="utf-8") as f:
|
||||
json.dump(rec, f, indent=1)
|
||||
return (cell, "TIMEOUT", "")
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ def load(model):
|
||||
for p in glob.glob(f"{BASE}/{model}/*.json"):
|
||||
if p.endswith(".transcript.json"):
|
||||
continue
|
||||
with open(p) as f:
|
||||
with open(p, encoding="utf-8") as f:
|
||||
recs.append(json.load(f))
|
||||
return recs
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ IMG_URL = "https://img.eval.local/fern-forge.png"
|
||||
def _w(ws, rel, content):
|
||||
p = os.path.join(ws, rel)
|
||||
os.makedirs(os.path.dirname(p), exist_ok=True)
|
||||
with open(p, "w") as f:
|
||||
with open(p, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def _read(ws, rel):
|
||||
p = os.path.join(ws, rel)
|
||||
try:
|
||||
with open(p) as f:
|
||||
with open(p, encoding="utf-8") as f:
|
||||
return f.read()
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
@@ -39,7 +39,7 @@ hermes_home = os.path.join(tmp_root, ".hermes")
|
||||
workspace = os.path.join(tmp_root, "ws")
|
||||
os.makedirs(hermes_home)
|
||||
os.makedirs(workspace)
|
||||
with open(os.path.join(hermes_home, "config.yaml"), "w") as f:
|
||||
with open(os.path.join(hermes_home, "config.yaml"), "w", encoding="utf-8") as f:
|
||||
f.write("model:\n provider: openrouter\n model: %s\n" % MODEL)
|
||||
|
||||
os.environ["HERMES_HOME"] = hermes_home
|
||||
@@ -356,10 +356,10 @@ record = {
|
||||
}
|
||||
|
||||
os.makedirs(os.path.dirname(OUT), exist_ok=True)
|
||||
with open(OUT + ".transcript.json", "w") as f:
|
||||
with open(OUT + ".transcript.json", "w", encoding="utf-8") as f:
|
||||
json.dump({"messages": messages, "events": EVENTS, "callback_log": CALLBACK_LOG},
|
||||
f, default=str)
|
||||
with open(OUT, "w") as f:
|
||||
with open(OUT, "w", encoding="utf-8") as f:
|
||||
json.dump(record, f, indent=1, default=str)
|
||||
print(json.dumps({k: record[k] for k in ("arm", "model", "task", "rep", "score",
|
||||
"api_turns", "total_tokens", "wall_s",
|
||||
|
||||
Reference in New Issue
Block a user