MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / log_removal_started

Function log_removal_started

archivebox/logging_util.py:490–510  ·  view source on GitHub ↗
(links: List["Link"], yes: bool, delete: bool)

Source from the content-addressed store, hash-verified

488
489
490def log_removal_started(links: List["Link"], yes: bool, delete: bool):
491 print('{lightyellow}[i] Found {} matching URLs to remove.{reset}'.format(len(links), **ANSI))
492 if delete:
493 file_counts = [link.num_outputs for link in links if Path(link.link_dir).exists()]
494 print(
495 f' {len(links)} Links will be de-listed from the main index, and their archived content folders will be deleted from disk.\n'
496 f' ({len(file_counts)} data folders with {sum(file_counts)} archived files will be deleted!)'
497 )
498 else:
499 print(
500 ' Matching links will be de-listed from the main index, but their archived content folders will remain in place on disk.\n'
501 ' (Pass --delete if you also want to permanently delete the data folders)'
502 )
503
504 if not yes:
505 print()
506 print('{lightyellow}[?] Do you want to proceed with removing these {} links?{reset}'.format(len(links), **ANSI))
507 try:
508 assert input(' y/[n]: ').lower() == 'y'
509 except (KeyboardInterrupt, EOFError, AssertionError):
510 raise SystemExit(0)
511
512def log_removal_finished(all_links: int, to_remove: int):
513 if all_links == 0:

Callers 1

removeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected