From cd3629c6c157ca253a87484c170d844bf3a7fd92 Mon Sep 17 00:00:00 2001 From: TheSomsie Date: Tue, 16 Dec 2025 13:24:47 +0100 Subject: [PATCH] tools: add helper to clean temporary files Adds cleanup_temp_files.py, a helper that removes common Python cache directories (.pytest_cache, .mypy_cache, __pycache__). --- scripts/cleanup_temp_files.py | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 scripts/cleanup_temp_files.py diff --git a/scripts/cleanup_temp_files.py b/scripts/cleanup_temp_files.py new file mode 100644 index 0000000..0fc63a0 --- /dev/null +++ b/scripts/cleanup_temp_files.py @@ -0,0 +1,39 @@ +""" +Small helper to remove common temporary files created while experimenting +with the Kalshi starter code. + +This script is intentionally conservative and only targets a few known +paths. Adjust it for your own workflow as needed. +""" + +from __future__ import annotations + +import shutil +from pathlib import Path + + +def main() -> None: + root = Path(__file__).resolve().parents[1] + + candidates = [ + root / ".pytest_cache", + root / ".mypy_cache", + root / "__pycache__", + ] + + removed_any = False + + for path in candidates: + if path.exists(): + print(f"Removing {path} ...") + shutil.rmtree(path) + removed_any = True + + if not removed_any: + print("No known temporary directories found.") + else: + print("Cleanup finished.") + + +if __name__ == "__main__": + main()