Add per label remark, post correction
This commit is contained in:
1 parent
3abd7873e6
commit
8918d64452
13 files changed
+343
-23
No files matched your search
@@ -79,8 +79,9 @@ def update_named_return_answers(
|
||||
annotation_dir_name: str,
|
||||
*,
|
||||
copy_ids: Collection[str] | None = None,
|
||||
refresh_named: bool = False,
|
||||
) -> ExitCode:
|
||||
"""Refresh answers/ in existing returns, optionally only successful rereads."""
|
||||
"""Refresh answers/; readers also refresh named outputs after successful rereads."""
|
||||
if copy_ids is not None and (not copy_ids or not workspace.return_dir.is_dir()):
|
||||
return ExitCode.SUCCESS
|
||||
workspace.require_directories(annotation_dir_name, "A Rendre")
|
||||
@@ -118,6 +119,18 @@ def update_named_return_answers(
|
||||
destination,
|
||||
answers_only=True,
|
||||
)
|
||||
if refresh_named:
|
||||
stem = destination.name[:match.start()].rstrip()
|
||||
for source_name, suffix, enabled in (
|
||||
("Concat.jpg", ".jpg", configuration.RETURN_JPEG_ENABLED),
|
||||
("Concat_F.pdf", ".pdf", configuration.RETURN_PDF_ENABLED),
|
||||
):
|
||||
source = source_folder / source_name
|
||||
target = destination / (stem + suffix)
|
||||
if enabled and source.is_file():
|
||||
replace_with_link_or_copy(source, target, prefer="symlink")
|
||||
else:
|
||||
target.unlink(missing_ok=True)
|
||||
print(f"Updated answers for {destination.name} from Copie{copy_id}")
|
||||
except (OSError, TypeError, ValueError) as exc:
|
||||
print(f"Error updating answers for {destination.name}: {exc}", file=sys.stderr)
|
||||
|
||||
Reference in new issue
Block a user