Support evaluation-local configuration and names overrides
This commit is contained in:
1 parent
0bb6f7d97c
commit
d4404e4c27
36 files changed
+409
-184
No files matched your search
@@ -26,7 +26,7 @@ from copienator import (
|
||||
workspace_from_target,
|
||||
)
|
||||
from copienator.annotation_data import load_annotation_data
|
||||
from copienator.annotation_documents import MAX_HEIGHT_PX, MAX_PIXELS, copy_documents, document_fits
|
||||
from copienator.annotation_documents import annotation_limits, copy_documents, document_fits
|
||||
from copienator.commands import annotating
|
||||
from copienator.commands.import_annotations import clear_import_directory
|
||||
from copienator.filesystem import staged_directory
|
||||
@@ -160,6 +160,7 @@ def _render_student(
|
||||
output_mode: str,
|
||||
output_root: Path | None = None,
|
||||
) -> str:
|
||||
max_height_px, max_pixels = annotation_limits()
|
||||
output_dir = (
|
||||
output_root
|
||||
if output_root is not None
|
||||
@@ -214,15 +215,15 @@ def _render_student(
|
||||
height = 0
|
||||
width = 0
|
||||
for index, image in enumerate(label_images):
|
||||
if not document_fits(image.width, image.height, MAX_HEIGHT_PX, MAX_PIXELS):
|
||||
if not document_fits(image.width, image.height, max_height_px, max_pixels):
|
||||
raise CliError(
|
||||
f"Copie{student_id} ({bnote_entries[index]['label']}) is "
|
||||
f"{image.width} × {image.height} px ({image.width * image.height} pixels); "
|
||||
f"a single answer cannot be split. Document limits are "
|
||||
f"{MAX_HEIGHT_PX} px high and {MAX_PIXELS} pixels."
|
||||
f"{max_height_px} px high and {max_pixels} pixels."
|
||||
)
|
||||
if not document_fits(max(width, image.width), height + image.height,
|
||||
MAX_HEIGHT_PX, MAX_PIXELS):
|
||||
max_height_px, max_pixels):
|
||||
batches.append((start, index))
|
||||
start = index
|
||||
height = 0
|
||||
@@ -254,13 +255,14 @@ def _save_document(
|
||||
checkbox_groups: list[list[dict[str, Any]]],
|
||||
bnote_entries: list[dict[str, Any]],
|
||||
) -> None:
|
||||
max_height_px, max_pixels = annotation_limits()
|
||||
max_width = max(image.width for image in label_images)
|
||||
total_height = sum(image.height for image in label_images)
|
||||
if not document_fits(max_width, total_height, MAX_HEIGHT_PX, MAX_PIXELS):
|
||||
if not document_fits(max_width, total_height, max_height_px, max_pixels):
|
||||
raise CliError(
|
||||
f"Document would be {max_width} × {total_height} px "
|
||||
f"({max_width * total_height} pixels); document limits are "
|
||||
f"{MAX_HEIGHT_PX} px high and {MAX_PIXELS} pixels."
|
||||
f"{max_height_px} px high and {max_pixels} pixels."
|
||||
)
|
||||
concatenated = Image.new("RGB", (max_width, total_height), "white")
|
||||
checkbox_map: list[dict[str, Any]] = []
|
||||
|
||||
Reference in new issue
Block a user