logger.debug(f'Attempting to instantiate {cls.__name__} directly.')
self.instance = cls(*args, **kwargs)
else:
- logger.debug(
- f'Class {cls.__name__} was loaded from persisted state successfully.'
- )
+ logger.debug(f'Class {cls.__name__} was loaded from persisted state successfully.')
was_loaded = True
assert self.instance is not None
if self.persist_at_shutdown is PersistAtShutdown.ALWAYS or (
- not was_loaded
- and self.persist_at_shutdown is PersistAtShutdown.IF_NOT_LOADED
+ not was_loaded and self.persist_at_shutdown is PersistAtShutdown.IF_NOT_LOADED
):
- logger.debug(
- 'Scheduling a deferred called to save at process shutdown time.'
- )
+ logger.debug('Scheduling a deferred called to save at process shutdown time.')
atexit.register(self.instance.save)
return self.instance