MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / load_cache_file

Function load_cache_file

src/licensedcode/cache.py:438–453  ·  view source on GitHub ↗

Return a LicenseCache loaded from ``cache_file``.

(cache_file)

Source from the content-addressed store, hash-verified

436
437
438def load_cache_file(cache_file):
439 """
440 Return a LicenseCache loaded from ``cache_file``.
441 """
442 with open(cache_file, 'rb') as lfc:
443 # Note: weird but read() + loads() is much (twice++???) faster than load()
444 try:
445 return pickle.load(lfc)
446 except Exception as e:
447 msg = (
448 'ERROR: Failed to load license cache (the file may be corrupted ?).\n'
449 f'Please delete "{cache_file}" and retry.\n'
450 'If the problem persists, copy this error message '
451 'and submit a bug report at https://github.com/nexB/scancode-toolkit/issues/'
452 )
453 raise Exception(msg) from e
454
455
456def get_index(

Callers 1

load_or_buildMethod · 0.70

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected