Automatic orientation issues detection and fix, experimental
This commit is contained in:
1 parent
78a7b7679c
commit
46845c4612
12 files changed
+683
-9
No files matched your search
@@ -20,7 +20,7 @@ def _validate(value) -> dict[str, dict[str, str]]:
|
||||
if isinstance(flags, str):
|
||||
flags = {"cutleft": flags}
|
||||
if (not isinstance(flags, dict) or not flags
|
||||
or any(step not in {"cutleft", "plotting"} or not isinstance(reason, str)
|
||||
or any(step not in {"cutleft", "plotting", "orientation"} or not isinstance(reason, str)
|
||||
for step, reason in flags.items())):
|
||||
raise CliError("Invalid copy_errors.json: invalid step flags")
|
||||
normalized[name] = dict(flags)
|
||||
@@ -35,7 +35,7 @@ def copy_errors(workspace: EvaluationWorkspace) -> dict[str, str]:
|
||||
|
||||
def mark_copy_error(workspace: EvaluationWorkspace, pdf: Path, reason: str,
|
||||
*, source: str = "cutleft") -> None:
|
||||
if source not in {"cutleft", "plotting"}:
|
||||
if source not in {"cutleft", "plotting", "orientation"}:
|
||||
raise ValueError(f"Unknown copy flag source: {source}")
|
||||
def update(errors):
|
||||
normalized = _validate(errors)
|
||||
@@ -47,7 +47,7 @@ def mark_copy_error(workspace: EvaluationWorkspace, pdf: Path, reason: str,
|
||||
|
||||
def clear_copy_error(workspace: EvaluationWorkspace, pdf: Path,
|
||||
*, source: str = "cutleft") -> None:
|
||||
if source not in {"cutleft", "plotting"}:
|
||||
if source not in {"cutleft", "plotting", "orientation"}:
|
||||
raise ValueError(f"Unknown copy flag source: {source}")
|
||||
if not _path(workspace).exists():
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user