saveable_objects.checkpointing.succeeded

saveable_objects.checkpointing.succeeded(load_attempt: SaveableObject | bool | Tuple[SaveableObject, bool]) bool[source]

Determines if a SaveableObject .load(), .tryload(), .loadif(), or .loadifparams() attempt succeeds.

Parameters:

load_attempt (SaveableObject | bool | (SaveableObject, bool)) – The output of load(), tryload(), loadif(), or loadifparams().

Returns:

Returns True is the the load_attempt succeeded, else False.

Return type:

bool

Notes

Example use:

if succeeded(obj := SaveableObject.loadif(*args, path="filename.pkl", **kwargs)):
    ... # code that uses a successfully loaded obj
else:
    ... # code to run if obj failed to load