mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #1 from radarhere/bug/compat/numpy1.20
Do not import numpy.typing unless TYPE_CHECKING
This commit is contained in:
commit
ce6fb1279f
|
@ -2,13 +2,14 @@ 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:
|
||||
if TYPE_CHECKING:
|
||||
try:
|
||||
import numpy.typing as npt
|
||||
|
||||
NumpyArray = npt.NDArray[Any] # requires numpy>=1.21
|
||||
except (ImportError, AttributeError):
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
|
|
Loading…
Reference in New Issue
Block a user