From 6cabf378ec988c132019c0cb86d33942b8732dcc Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 20 Aug 2023 21:05:48 -0400 Subject: [PATCH] fix(python): use Union over | for cast_image To address: ERROR test/test_compress_stringify.py - TypeError: unsupported operand type(s) for |: 'EnumMeta' and 'EnumMeta' with Python 3.8. --- packages/core/python/itkwasm/itkwasm/__init__.py | 2 +- packages/core/python/itkwasm/itkwasm/cast_image.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/python/itkwasm/itkwasm/__init__.py b/packages/core/python/itkwasm/itkwasm/__init__.py index 7103282a5..b01ee7bb2 100644 --- a/packages/core/python/itkwasm/itkwasm/__init__.py +++ b/packages/core/python/itkwasm/itkwasm/__init__.py @@ -1,6 +1,6 @@ """itkwasm: Python interface to itk-wasm WebAssembly modules.""" -__version__ = "1.0b128" +__version__ = "1.0b129" from .interface_types import InterfaceTypes from .image import Image, ImageType diff --git a/packages/core/python/itkwasm/itkwasm/cast_image.py b/packages/core/python/itkwasm/itkwasm/cast_image.py index 40643e193..81f77ae20 100644 --- a/packages/core/python/itkwasm/itkwasm/cast_image.py +++ b/packages/core/python/itkwasm/itkwasm/cast_image.py @@ -1,4 +1,4 @@ -from typing import Optional +from typing import Optional, Union from dataclasses import asdict import copy @@ -11,7 +11,7 @@ def cast_image(input_image: Image, pixel_type: Optional[PixelTypes]=None, - component_type: Optional[IntTypes | FloatTypes]=None) -> Image: + component_type: Optional[Union[IntTypes, FloatTypes]]=None) -> Image: """Cast an image to another pixel type and / or component type.""" output_image_type = ImageType(**asdict(input_image.imageType))