def reset_sources(confirm: bool = False):
"""Reset local bionty sources file."""
from importlib import reload
import bionty
if confirm:
try:
LOCAL_SOURCES.unlink()
logger.success(f"Removed file: {LOCAL_SOURCES}.")
except FileNotFoundError:
pass
try:
CURRENT_SOURCES.unlink()
logger.success(f"Removed file: {CURRENT_SOURCES}.")
except FileNotFoundError:
pass
try:
LAMINDB_SOURCES.unlink()
logger.success(f"Removed file: {LAMINDB_SOURCES}.")
except FileNotFoundError:
pass
reload(bionty)
logger.info("Reloaded bionty!")
else:
logger.warning(
"Are you sure to reset your local bionty sources? Pass 'confirm=True'"
)
Not the prettiest UX to get asked to run the function again with a parameter. Ideally use https://github.com/tmbo/questionary but it is an additional dependency (only prompt_toolkit as a transitive one)
Not the prettiest UX to get asked to run the function again with a parameter. Ideally use https://github.com/tmbo/questionary but it is an additional dependency (only prompt_toolkit as a transitive one)