feat: make convert work on Windows
All checks were successful
build / build (push) Successful in 1m49s

This commit is contained in:
张泊明518370910136 2025-05-30 06:57:05 -04:00
parent dde9ad3dea
commit 1dd3babe70
3 changed files with 9 additions and 7 deletions

View File

@ -82,6 +82,6 @@ def convert(
result_dict = result_model.model_dump( result_dict = result_model.model_dump(
mode="json", by_alias=True, exclude_none=True mode="json", by_alias=True, exclude_none=True
) )
with result_json_path.open("w") as result_file: with result_json_path.open("w", newline="") as result_file:
json.dump(result_dict, result_file, ensure_ascii=False, indent=4) json.dump(result_dict, result_file, ensure_ascii=False, indent=4)
result_file.write("\n") result_file.write("\n")

View File

@ -1,4 +1,4 @@
from pathlib import Path from pathlib import PurePosixPath
from joj3_config_generator.models.common import Memory, Time from joj3_config_generator.models.common import Memory, Time
@ -9,9 +9,9 @@ DEFAULT_CASE_SCORE = 5
DEFAULT_CLOCK_LIMIT_MULTIPLIER = 2 DEFAULT_CLOCK_LIMIT_MULTIPLIER = 2
DEFAULT_PROC_LIMIT = 50 DEFAULT_PROC_LIMIT = 50
JOJ3_CONFIG_ROOT = Path("/home/tt/.config/joj") JOJ3_CONFIG_ROOT = PurePosixPath("/home/tt/.config/joj")
TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot") TEAPOT_CONFIG_ROOT = PurePosixPath("/home/tt/.config/teapot")
CACHE_ROOT = Path("/home/tt/.cache") CACHE_ROOT = PurePosixPath("/home/tt/.cache")
JOJ3_LOG_PATH = CACHE_ROOT / "joj3" / "joj3.log" JOJ3_LOG_PATH = CACHE_ROOT / "joj3" / "joj3.log"
TEAPOT_LOG_PATH = CACHE_ROOT / "joint-teapot-debug.log" TEAPOT_LOG_PATH = CACHE_ROOT / "joint-teapot-debug.log"
ACTOR_CSV_PATH = JOJ3_CONFIG_ROOT / "students.csv" ACTOR_CSV_PATH = JOJ3_CONFIG_ROOT / "students.csv"

View File

@ -1,7 +1,7 @@
import re import re
import shlex import shlex
from functools import partial from functools import partial
from pathlib import Path from pathlib import Path, PurePosixPath
from typing import Any, Callable, Dict, List, Set, Tuple from typing import Any, Callable, Dict, List, Set, Tuple
from joj3_config_generator.models import result, task from joj3_config_generator.models import result, task
@ -262,7 +262,9 @@ def get_testcases(
continue continue
testcases.add( testcases.add(
str( str(
testcases_path.relative_to((task_root / task_path).parent) PurePosixPath(
testcases_path.relative_to((task_root / task_path).parent)
)
).removesuffix(".in") ).removesuffix(".in")
) )
return testcases return testcases