From 0b8630b99e0f2b977d3ad55667076c4ead26926e Mon Sep 17 00:00:00 2001 From: Samuel Letellier-Duchesne Date: Sat, 28 Jan 2023 20:25:51 -0500 Subject: [PATCH] New function to clear the cache (#437) * Fixes an issue where passing a new attributes to IDF.simulate would fail to create a new cache * reformat * Added clear_cache method - deletes the settings.cache_folder (files and sub-directories) - Import from archetypal directly --- archetypal/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/archetypal/utils.py b/archetypal/utils.py index e4213eb2..0b9d8c58 100644 --- a/archetypal/utils.py +++ b/archetypal/utils.py @@ -775,3 +775,10 @@ def signif(x, digits=4): return x digits -= math.ceil(math.log10(abs(x))) return round(x, digits) + + +def clear_cache(): + """Clear the cache.""" + import shutil + + shutil.rmtree(settings.cache_folder)