(cls, cache_id=None)
| 448 | |
| 449 | @classmethod |
| 450 | def proxy(cls, cache_id=None) -> Tuple[ASTPattern, ...]: |
| 451 | if cls._AST_PATTERN_CACHE: |
| 452 | return cls._AST_PATTERN_CACHE |
| 453 | |
| 454 | if cls.get_location() is None: |
| 455 | return cls._compile_all() |
| 456 | |
| 457 | cache_obj = cls(cache_id=cache_id) |
| 458 | if cache_obj.is_valid: |
| 459 | return pickle.loads(cache_obj.cache_file_location.read_bytes()) |
| 460 | |
| 461 | try: |
| 462 | patterns = cls._compile_all() |
| 463 | cache_obj.save_metadata() |
| 464 | cache_obj.cache_file_location.write_bytes(pickle.dumps(patterns)) |
| 465 | return patterns |
| 466 | except Exception as exc: |
| 467 | cache_obj.delete() |
| 468 | raise exc |
| 469 | |
| 470 | @property |
| 471 | def metadata(self) -> dict: |
nothing calls this directly
no test coverage detected