- class nannyml.io.store.base.Store[source]¶
The abstract class that serves as a base for concrete implementations.
The Store is used to persist and retrieve Python objects at runtime.
One example use case is storing calculators and estimators after fitting them to reference data, a potentially compute intensive operation. When the calculators and estimators are then used on analysis data repeatedly, they can be simply retrieved from the store, eliminating the need for repeated fitting.
This abstract base class does not restrict in any way how the storage mechanism should work.
The only implementation currently is the
- load(as_type: type | None = None, **load_args)[source]¶
Loads an object from the store, pass along any keyword argument to control this behavior.
as_type (Optional[type]) – When provided the load method will check if the loaded object is an instance of as_type. If it is not a StoreException will be raised. The object will be returned unchecked when the as_type parameter is not provided.
load_args (Dict[str, Any]) – Additional arguments passed to the subclass store implementation
- Return type:
- store(obj, **store_args)[source]¶
Stores an object into the store, pass along any keyword argument to control this behavior.
obj (object) – The object to be stored
store_args (Dict[str, Any]) – Additional arguments passed to the subclass store implementation
StoreException – occurs when an unexpected exception occurs during the store call.: