(cache=CACHE, on_missing: Literal["raise", "ignore"] = "ignore")
| 108 | |
| 109 | |
| 110 | def loadcache(cache=CACHE, on_missing: Literal["raise", "ignore"] = "ignore") -> ResultCollection: |
| 111 | if not os.path.exists(cache): |
| 112 | if on_missing == "raise": |
| 113 | raise FileNotFoundError(cache) |
| 114 | return ResultCollection() |
| 115 | with open(cache) as fh: |
| 116 | try: |
| 117 | data = json.load(fh) |
| 118 | except json.decoder.JSONDecodeError as e: |
| 119 | if on_missing == "raise": |
| 120 | raise e |
| 121 | return ResultCollection() |
| 122 | return ResultCollection.fromdicts(data) |
nothing calls this directly
no test coverage detected