(func, n=5)
| 350 | |
| 351 | @staticmethod |
| 352 | def get_random_items(func, n=5): |
| 353 | import random |
| 354 | |
| 355 | hashes = Cache.get_items_hashes(func, None) |
| 356 | if n is not None: |
| 357 | hashes = random.sample(hashes, n) |
| 358 | else: |
| 359 | random.shuffle(hashes) |
| 360 | |
| 361 | fn_name = getfnname(func) |
| 362 | paths = [relative_path(f'{Cache.cache_directory}{fn_name}/{r}.json') for r in hashes] |
| 363 | return _read_json_files(paths) |
| 364 | @staticmethod |
| 365 | def get_items_hashes(func, items=None): |
| 366 |
nothing calls this directly
no test coverage detected