From f5efc04ef9e68adcb948e6d70c06101c338f6094 Mon Sep 17 00:00:00 2001 From: LTLA Date: Sat, 20 Jan 2024 12:04:22 -0800 Subject: [PATCH] Export the validate_saves decorator for downstream use. --- src/dolomite_base/__init__.py | 2 +- src/dolomite_base/save_object.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dolomite_base/__init__.py b/src/dolomite_base/__init__.py index 1a46793..90b9919 100644 --- a/src/dolomite_base/__init__.py +++ b/src/dolomite_base/__init__.py @@ -15,7 +15,7 @@ finally: del version, PackageNotFoundError -from .save_object import save_object +from .save_object import save_object, validate_saves from .validate_object import validate_object from .save_atomic_vector import save_atomic_vector_from_string_list, save_atomic_vector_from_integer_list, save_atomic_vector_from_float_list, save_atomic_vector_from_boolean_list from .save_string_factor import save_string_factor diff --git a/src/dolomite_base/save_object.py b/src/dolomite_base/save_object.py index 5c40646..076f0d9 100644 --- a/src/dolomite_base/save_object.py +++ b/src/dolomite_base/save_object.py @@ -22,6 +22,16 @@ def save_object(x: Any, path: str, **kwargs): def validate_saves(fn): + """ + Decorator to validate the output of :py:func:`~save_object`. + + Args: + fn: Function that implements a method for ``save_object``. + + Returns: + A wrapped version of the function that validates the directory + containing the on-disk representation of the saved object. + """ @wraps(fn) def wrapper(x, path, **kwargs): out = fn(x, path, **kwargs)