From 02112c69da59700095d57c205106a4673a7a722f Mon Sep 17 00:00:00 2001 From: mnoszczak Date: Tue, 27 Jun 2023 11:28:26 +0200 Subject: [PATCH] Further numpy fixes --- labelbox/data/annotation_types/types.py | 7 +++++-- setup.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/labelbox/data/annotation_types/types.py b/labelbox/data/annotation_types/types.py index 5b53a7929..ba7b88ba2 100644 --- a/labelbox/data/annotation_types/types.py +++ b/labelbox/data/annotation_types/types.py @@ -36,7 +36,10 @@ def validate(cls, val, field: ModelField): return val -if version.parse(np.__version__) >= version.parse('1.23.0'): +if version.parse(np.__version__) >= version.parse('1.25.0'): + from typing import GenericAlias + TypedArray = GenericAlias(_TypedArray, (Any, DType)) +elif version.parse(np.__version__) >= version.parse('1.23.0'): from numpy._typing import _GenericAlias TypedArray = _GenericAlias(_TypedArray, (Any, DType)) elif version.parse('1.22.0') <= version.parse( @@ -44,4 +47,4 @@ def validate(cls, val, field: ModelField): from numpy.typing import _GenericAlias TypedArray = _GenericAlias(_TypedArray, (Any, DType)) else: - TypedArray = _TypedArray[Any, DType] \ No newline at end of file + TypedArray = _TypedArray[Any, DType] diff --git a/setup.py b/setup.py index 4b1d309ee..a992bba88 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,8 @@ "tqdm", "python-dateutil>=2.8.2,<2.9.0", 'numpy==1.21.6; python_version<"3.8"', - 'numpy~=1.23.5; python_version>="3.8"', + 'numpy~=1.23.5; python_version=="3.8"', + 'numpy~=1.25.0; python_version>"3.8"', ], extras_require={ 'data': [