Various HTML improvements
This commit is contained in:
1 parent
fd943696fb
commit
8c1fa0af57
16 files changed
+403
-45
No files matched your search
@@ -38,6 +38,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
"directories, matching folders by their trailing copy ID"
|
||||
),
|
||||
)
|
||||
parser.add_argument("--incremental", action="store_true", help="Skip unchanged return folders")
|
||||
return parser
|
||||
|
||||
|
||||
@@ -147,6 +148,7 @@ def update_named_return_answers(
|
||||
def prepare_named_returns(
|
||||
workspace: EvaluationWorkspace,
|
||||
annotation_dir_name: str,
|
||||
*, incremental: bool = False,
|
||||
) -> ExitCode:
|
||||
workspace.require_directories("Copies", annotation_dir_name)
|
||||
workspace.return_dir.mkdir(parents=True, exist_ok=True)
|
||||
@@ -198,6 +200,12 @@ def prepare_named_returns(
|
||||
assigned_names.add(name)
|
||||
destination = existing_returns.get(int(copy_id), workspace.return_dir / f"{safe_name} ({copy_id})")
|
||||
output_name = destination.name.rsplit(" (", 1)[0]
|
||||
from copienator.reviewed_cache import ReturnCache
|
||||
cache = ReturnCache(workspace.root, source_folder, destination) if incremental else None
|
||||
if cache and cache.unchanged():
|
||||
print(f"Skipping unchanged return {destination.name}")
|
||||
continue
|
||||
copy_failed = False
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
try:
|
||||
publish_answer_returns(workspace.root, source_folder, destination)
|
||||
@@ -238,6 +246,9 @@ def prepare_named_returns(
|
||||
file=sys.stderr,
|
||||
)
|
||||
had_errors = True
|
||||
copy_failed = True
|
||||
if cache and not copy_failed:
|
||||
cache.remember()
|
||||
|
||||
unassigned = expected_names - assigned_names
|
||||
if unassigned:
|
||||
@@ -253,10 +264,11 @@ def run(
|
||||
*,
|
||||
annotation_dir: str,
|
||||
update: bool = False,
|
||||
incremental: bool = False,
|
||||
) -> ExitCode:
|
||||
if update:
|
||||
return update_named_return_answers(workspace, annotation_dir)
|
||||
return prepare_named_returns(workspace, annotation_dir)
|
||||
return prepare_named_returns(workspace, annotation_dir, incremental=incremental)
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
@@ -268,6 +280,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
workspace_from_args(args, repository=Path.cwd()),
|
||||
annotation_dir=args.annotation_dir,
|
||||
update=args.update,
|
||||
incremental=args.incremental,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user