Skip to content

Commit

Permalink
fix: Add further array serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Nov 1, 2024
1 parent d03e4f5 commit 8ea0ba3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/qibolab/_core/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ def ndarray_deserialize(x: Union[str, npt.NDArray]) -> npt.NDArray:
PlainValidator(ndarray_deserialize),
PlainSerializer(ndarray_serialize, return_type=str),
]
"""Pydantic-compatible array representation."""
"""Bytes-based array representation."""

ArrayList = Annotated[
npt.NDArray,
PlainValidator(np.array),
PlainSerializer(lambda a: a.tolist(), return_type=list),
]
"""Array representation based on list serialization."""


def eq(obj1: BaseModel, obj2: BaseModel) -> bool:
Expand Down

0 comments on commit 8ea0ba3

Please sign in to comment.