Skip to content

Commit

Permalink
Export the validate_saves decorator for downstream use.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Jan 20, 2024
1 parent 5f853fb commit f5efc04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dolomite_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/dolomite_base/save_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f5efc04

Please sign in to comment.