@@ -266,16 +266,16 @@ def build_unknown_spdx_symbol(licenses_db=None):
266266 return LicenseSymbolLike (licenses [u'unknown-spdx' ])
267267
268268
269- def get_cache ():
269+ def get_cache (check_consistency = SCANCODE_DEV_MODE ):
270270 """
271271 Optionally return and either load or build and cache a LicenseCache.
272272 """
273- populate_cache ()
273+ populate_cache (check_consistency = check_consistency )
274274 global _LICENSE_CACHE
275275 return _LICENSE_CACHE
276276
277277
278- def populate_cache ():
278+ def populate_cache (check_consistency = SCANCODE_DEV_MODE ):
279279 """
280280 Load or build and cache a LicenseCache. Return None.
281281 """
@@ -284,7 +284,7 @@ def populate_cache():
284284 _LICENSE_CACHE = LicenseCache .load_or_build (
285285 licensedcode_cache_dir = licensedcode_cache_dir ,
286286 scancode_cache_dir = scancode_cache_dir ,
287- check_consistency = SCANCODE_DEV_MODE ,
287+ check_consistency = check_consistency ,
288288 # used for testing only
289289 timeout = LICENSE_INDEX_LOCK_TIMEOUT ,
290290 tree_base_dir = scancode_src_dir ,
@@ -338,39 +338,42 @@ def tree_checksum(tree_base_dir=licensedcode_dir, _ignored=_ignored_from_hash):
338338 return md5 (hashable ).hexdigest ()
339339
340340
341- def get_index ():
341+ def get_index (check_consistency = SCANCODE_DEV_MODE ):
342342 """
343343 Return and eventually build and cache a LicenseIndex.
344344 """
345- return get_cache ().index
345+ return get_cache (check_consistency = check_consistency ).index
346346
347347
348- def get_licenses_db ():
348+ get_cached_index = get_index
349+
350+
351+ def get_licenses_db (check_consistency = SCANCODE_DEV_MODE ):
349352 """
350353 Return a mapping of license key -> license object.
351354 """
352- return get_cache ().db
355+ return get_cache (check_consistency = check_consistency ).db
353356
354357
355- def get_licensing ():
358+ def get_licensing (check_consistency = SCANCODE_DEV_MODE ):
356359 """
357360 Return a license_expression.Licensing objet built from the all the licenses.
358361 """
359- return get_cache ().licensing
362+ return get_cache (check_consistency = check_consistency ).licensing
360363
361364
362- def get_unknown_spdx_symbol ():
365+ def get_unknown_spdx_symbol (check_consistency = SCANCODE_DEV_MODE ):
363366 """
364367 Return the unknown SPDX license symbol.
365368 """
366- return get_cache ().unknown_spdx_symbol
369+ return get_cache (check_consistency = check_consistency ).unknown_spdx_symbol
367370
368371
369- def get_spdx_symbols (licenses_db = None ):
372+ def get_spdx_symbols (licenses_db = None , check_consistency = SCANCODE_DEV_MODE ):
370373 """
371374 Return a mapping of {lowercased SPDX license key: LicenseSymbolLike} where
372375 LicenseSymbolLike wraps a License object
373376 """
374377 if licenses_db :
375378 return build_spdx_symbols (licenses_db )
376- return get_cache ().spdx_symbols
379+ return get_cache (check_consistency = check_consistency ).spdx_symbols
0 commit comments