INNER CODE UNIT · Python
loadcache
DeepLabCut/DeepLabCut · deeplabcut/benchmark/__init__.py:111
def loadcache(cache=CACHE, on_missing: Literal["raise", "ignore"] = "ignore") -> ResultCollection:
if not Path(cache).exists():
if on_missing == "raise":
raise FileNotFoundError(cache)
return ResultCollection()
with Path(cache).open() as fh:
try:
data = json.load(fh)
except json.decoder.JSONDecodeError as e:
if on_missing == "raise":
raise e
return ResultCollection()
return ResultCollection.fromdicts(data)