Skip to content

Commit db71491

Browse files
committed
[feat] Add validation for func output
1 parent 5bc133a commit db71491

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/oqd_dataschema/datastore.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import json
2020
import pathlib
21-
from typing import Any, Dict, Literal
21+
from typing import Any, Callable, Dict, Literal
2222

2323
import h5py
2424
from pydantic import (
@@ -220,8 +220,13 @@ def add(self, **groups):
220220

221221
self.update(**groups)
222222

223-
def pipe(self, func) -> Datastore:
224-
return func(self)
223+
def pipe(self, func: Callable[[Datastore], None]) -> Datastore:
224+
_result = func(self)
225+
226+
if _result is not None:
227+
raise ValueError("`func` must return None.")
228+
229+
return self
225230

226231

227232
# %%

0 commit comments

Comments
 (0)