Skip to content

Commit 7c867d7

Browse files
Add clear_cache function
1 parent 728a8af commit 7c867d7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

robot_descriptions/_cache.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,14 @@ def clone_to_cache(description_name: str, commit: Optional[str] = None) -> str:
138138
commit=repository.commit if commit is None else commit,
139139
)
140140
return str(clone.working_dir)
141+
142+
143+
def clear_cache() -> None:
144+
"""Clears the local cache where robot descriptions are stored."""
145+
cache_dir = os.path.expanduser(
146+
os.environ.get(
147+
"ROBOT_DESCRIPTIONS_CACHE",
148+
"~/.cache/robot_descriptions",
149+
)
150+
)
151+
shutil.rmtree(cache_dir, ignore_errors=True)

0 commit comments

Comments
 (0)