Skip to content

Commit

Permalink
New function to clear the cache (#437)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
samuelduchesne committed Jan 29, 2023
1 parent a854409 commit 0b8630b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions archetypal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 0b8630b

Please sign in to comment.