Internal function to load usage data from disk.
()
| 11 | |
| 12 | |
| 13 | def _load_usage_data() -> Dict[str, int]: |
| 14 | """Internal function to load usage data from disk.""" |
| 15 | if not os.path.exists(USAGE_FILE): |
| 16 | return {} |
| 17 | try: |
| 18 | with open(USAGE_FILE, "r", encoding="utf-8") as f: |
| 19 | return json.load(f) |
| 20 | except (json.JSONDecodeError, IOError) as e: |
| 21 | logger.error(f"Failed to load profile usage data: {e}") |
| 22 | return {} |
| 23 | |
| 24 | |
| 25 | def _save_usage_data(data: Dict[str, int]) -> None: |
no test coverage detected