Merge pull request #8187 from neutrinoceros/bug/compat/numpy1.20

This commit is contained in:
Hugo van Kemenade 2024-07-02 14:28:14 -06:00 committed by GitHub
commit ececa9df4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,14 +2,15 @@ from __future__ import annotations
import os
import sys
from typing import Any, Protocol, Sequence, TypeVar, Union
from typing import TYPE_CHECKING, Any, Protocol, Sequence, TypeVar, Union
try:
import numpy.typing as npt
if TYPE_CHECKING:
try:
import numpy.typing as npt
NumpyArray = npt.NDArray[Any]
except ImportError:
pass
NumpyArray = npt.NDArray[Any] # requires numpy>=1.21
except (ImportError, AttributeError):
pass
if sys.version_info >= (3, 10):
from typing import TypeGuard