Skip to content

Commit 14d4a13

Browse files
ronald-jaepelschmoelder
authored andcommitted
Improve backwards compatibility for H5.load with deprecation warning
1 parent 46e2e67 commit 14d4a13

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

cadet/h5.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,33 @@ def __init__(self, *data: Any):
9595
for i in data:
9696
self.root.update(copy.deepcopy(i))
9797

98+
def load(
99+
self,
100+
paths: Optional[list[str]] = None,
101+
update: bool = False,
102+
lock: bool = False
103+
) -> None:
104+
"""
105+
Load data from the specified HDF5 file.
106+
107+
Parameters
108+
----------
109+
paths : Optional[List[str]], optional
110+
Specific paths to load within the HDF5 file.
111+
update : bool, optional
112+
If True, update the existing data with the loaded data,
113+
i.e. keep existing data and ADD loaded data.
114+
If False, discard existing data and only keep loaded data.
115+
lock : bool, optional
116+
If True, uses a file lock while loading.
117+
"""
118+
warnings.warn(
119+
"Deprecation warning: Support for `load` will be removed in a future "
120+
"version. Use `load_from_file` instead.",
121+
FutureWarning
122+
)
123+
self.load_from_file(paths=paths, update=update, lock=lock)
124+
98125
def load_from_file(
99126
self,
100127
paths: Optional[list[str]] = None,

0 commit comments

Comments
 (0)