def reuse_if_mtime_is_today() -> Callable[[datetime.datetime], bool]:
"""
A helper that returns a lambda appropriate for use in the
def reuse_if_mtime_is_today() -> Callable[[datetime.datetime], bool]:
"""
A helper that returns a lambda appropriate for use in the
parameter that allows persisted state to be reused as long as it
was persisted on the same day as the load.
parameter that allows persisted state to be reused as long as it
was persisted on the same day as the load.
) -> Callable[[datetime.datetime], bool]:
"""
A helper that returns a lambda appropriate for use in the
) -> Callable[[datetime.datetime], bool]:
"""
A helper that returns a lambda appropriate for use in the
parameter that allows persisted state to be reused as long as it
was persisted within the past limit_seconds.
parameter that allows persisted state to be reused as long as it
was persisted within the past limit_seconds.
class PersistAtShutdown(enum.Enum):
"""
An enum to describe the conditions under which state is persisted
class PersistAtShutdown(enum.Enum):
"""
An enum to describe the conditions under which state is persisted
"""This class is meant to be used as a decorator around a class that:
1. Is a singleton; one global instance per python program.
"""This class is meant to be used as a decorator around a class that:
1. Is a singleton; one global instance per python program.
filename = "my_cache_file.bin",
may_reuse_persisted = reuse_if_mtime_less_than_limit_sec(60),
persist_at_shutdown = PersistAtShutdown.IF_NOT_INITIALIZED_FROM_DISK,
filename = "my_cache_file.bin",
may_reuse_persisted = reuse_if_mtime_less_than_limit_sec(60),
persist_at_shutdown = PersistAtShutdown.IF_NOT_INITIALIZED_FROM_DISK,