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
@@ -1,15 +1,20 @@
|
||||
"""Locate tablet documents, including the parts of a large checked copy."""
|
||||
from pathlib import Path
|
||||
|
||||
from copienator.configuration import ANNOTATION_MAX_HEIGHT_PX, ANNOTATION_MAX_PIXELS
|
||||
from copienator import configuration
|
||||
from copienator.json_io import read_json
|
||||
|
||||
if type(ANNOTATION_MAX_HEIGHT_PX) is not int or ANNOTATION_MAX_HEIGHT_PX <= 0:
|
||||
raise ValueError("ANNOTATION_MAX_HEIGHT_PX must be a positive integer (pixels)")
|
||||
MAX_HEIGHT_PX = ANNOTATION_MAX_HEIGHT_PX
|
||||
if type(ANNOTATION_MAX_PIXELS) is not int or ANNOTATION_MAX_PIXELS <= 0:
|
||||
raise ValueError("ANNOTATION_MAX_PIXELS must be a positive integer (pixels)")
|
||||
MAX_PIXELS = ANNOTATION_MAX_PIXELS
|
||||
|
||||
def annotation_limits() -> tuple[int, int]:
|
||||
values = (configuration.ANNOTATION_MAX_HEIGHT_PX, configuration.ANNOTATION_MAX_PIXELS)
|
||||
for name, value in zip(("ANNOTATION_MAX_HEIGHT_PX", "ANNOTATION_MAX_PIXELS"), values):
|
||||
if type(value) is not int or value <= 0:
|
||||
raise ValueError(f"{name} must be a positive integer (pixels)")
|
||||
return values
|
||||
|
||||
|
||||
# Validate global settings at import, as before.
|
||||
annotation_limits()
|
||||
|
||||
|
||||
def document_fits(width: int, height: int, max_height: int, max_pixels: int) -> bool:
|
||||
|
||||
Reference in new issue
Block a user