(cls, *, src: Path, cache_id=None, tags=None)
| 330 | |
| 331 | @classmethod |
| 332 | def proxy(cls, *, src: Path, cache_id=None, tags=None) -> Path: |
| 333 | if cls.get_location() is None: # Caching is disabled |
| 334 | return src |
| 335 | |
| 336 | cache_obj = cls(src=src, cache_id=cache_id, tags=tags) |
| 337 | |
| 338 | if cache_obj.is_valid: |
| 339 | logger.debug(f"Retrieving mirror file path {cache_obj.cid} from cache") |
| 340 | return cache_obj.cache_file_location |
| 341 | |
| 342 | if not src.exists(): |
| 343 | return src |
| 344 | |
| 345 | try: |
| 346 | cache_obj.fetch() |
| 347 | return cache_obj.cache_file_location |
| 348 | except Exception as exc: |
| 349 | cache_obj.delete() |
| 350 | raise exc |
| 351 | |
| 352 | @property |
| 353 | def metadata(self) -> dict: |
nothing calls this directly
no test coverage detected