Skip to content

Commit ed4f37b

Browse files
committed
Handle older numpy versions
1 parent bfb0dfc commit ed4f37b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/blosc2/proxy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
from abc import ABC, abstractmethod
99
from collections.abc import Sequence
1010

11+
try:
12+
from numpy.typing import DTypeLike
13+
except (ImportError, AttributeError):
14+
# fallback to internal module (use with caution)
15+
from numpy._typing import DTypeLike
16+
1117
import numpy as np
1218

1319
import blosc2
@@ -569,7 +575,7 @@ def __getitem__(self, item: slice | list[slice]) -> np.ndarray:
569575
return nparr[self.field]
570576

571577

572-
def _convert_dtype(dt: str | np.typing.DTypeLike):
578+
def _convert_dtype(dt: str | DTypeLike):
573579
"""
574580
Attempts to convert to blosc2.dtype (i.e. numpy dtype)
575581
"""

0 commit comments

Comments
 (0)