mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 08:14:10 +03:00
Merge pull request #8187 from neutrinoceros/bug/compat/numpy1.20
This commit is contained in:
commit
ececa9df4e
|
@ -2,14 +2,15 @@ from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Protocol, Sequence, TypeVar, Union
|
from typing import TYPE_CHECKING, Any, Protocol, Sequence, TypeVar, Union
|
||||||
|
|
||||||
try:
|
if TYPE_CHECKING:
|
||||||
import numpy.typing as npt
|
try:
|
||||||
|
import numpy.typing as npt
|
||||||
|
|
||||||
NumpyArray = npt.NDArray[Any]
|
NumpyArray = npt.NDArray[Any] # requires numpy>=1.21
|
||||||
except ImportError:
|
except (ImportError, AttributeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
from typing import TypeGuard
|
from typing import TypeGuard
|
||||||
|
|
Loading…
Reference in New Issue
Block a user