import logging
import os
from typing import Any, Optional
+import warnings
from overrides import overrides
if len(cached_state) > config.config['arper_min_entries_to_be_valid']:
return cls(cached_state)
else:
- logger.warning(
- f'{cache_file} sucks, only {len(cached_state)} entries. Deleting it.'
- )
+ msg = f'{cache_file} is invalid: only {len(cached_state)} entries. Deleting it.'
+ logger.warning(msg)
+ warnings.warn(msg, stacklevel=2)
os.remove(cache_file)
-
logger.debug('No usable saved state found')
return None