INNER CODE UNIT · Python
remove_database_cache
pairinteraction/pairinteraction · src/pairinteraction/cli.py:331
def remove_database_cache() -> int:
"""Delete the cached database directory."""
import shutil
from pairinteraction._backend import get_cache_directory
database_dir = get_cache_directory() / "database"
confirmation = input(f"Are you sure you want to delete all downloaded database tables in {database_dir}? (y/N): ")
if confirmation.lower() not in ["y", "yes"]:
print(Fore.YELLOW + "Aborted deletion of database directory." + Style.RESET_ALL)
return 0
print(f"Deleting cached database directory {database_dir}...")
try:
shutil.rmtree(database_dir)
except Exception as e:
print(Fore.RED + f"Error while deleting database directory: {e}" + Style.RESET_ALL)