Load star data from JSON. Returns empty dict if file doesn't exist or is corrupt.
(path: Path)
| 87 | |
| 88 | |
| 89 | def load_stars(path: Path) -> dict[str, dict]: |
| 90 | """Load star data from JSON. Returns empty dict if file doesn't exist or is corrupt.""" |
| 91 | if path.exists(): |
| 92 | try: |
| 93 | return json.loads(path.read_text(encoding="utf-8")) |
| 94 | except json.JSONDecodeError: |
| 95 | return {} |
| 96 | return {} |
| 97 | |
| 98 | |
| 99 | def sort_entries(entries: Sequence[TemplateEntry]) -> list[TemplateEntry]: |
no outgoing calls