From 74fb1aaec7da8b35ce2c5916db73c2760d07def8 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Fri, 10 Feb 2023 17:03:35 -0500 Subject: [PATCH] fix(Python): Use field for PolyData default points --- src/python/itkwasm/itkwasm/polydata.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/python/itkwasm/itkwasm/polydata.py b/src/python/itkwasm/itkwasm/polydata.py index 0bacb8bde..47b591370 100644 --- a/src/python/itkwasm/itkwasm/polydata.py +++ b/src/python/itkwasm/itkwasm/polydata.py @@ -21,13 +21,16 @@ class PolyDataType: cellPixelType: PixelTypes = PixelTypes.Scalar cellPixelComponents: int = 1 +def _default_points() -> ArrayLike: + return np.empty((0,), np.float32) + @dataclass class PolyData: polyDataType: Union[PolyDataType, Dict] = field(default_factory=PolyDataType) name: str = 'polydata' numberOfPoints: int = 0 - points: ArrayLike = np.empty((0,), np.float32) + points: ArrayLike = field(default_factory=_default_points) verticesBufferSize: int = 0 vertices: Optional[ArrayLike] = None