Skip to content

Commit

Permalink
Type-check guard numpy.typing import
Browse files Browse the repository at this point in the history
Numpy versions less than 1.20 do not have the typing module.
  • Loading branch information
mferrera authored and eivindjahren committed Nov 10, 2023
1 parent 0d3ee8e commit 850609f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/resfo/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
"""
import warnings
from typing import Union
from typing import TYPE_CHECKING, Union

import numpy as np
from numpy.typing import ArrayLike

if TYPE_CHECKING:
from numpy.typing import ArrayLike

# np dtype for res types with fixed width
static_dtypes = {
Expand All @@ -48,7 +50,7 @@ class MESS:


ReadArrayValue = Union[np.ndarray, MESS]
WriteArrayValue = Union[ArrayLike, MESS]
WriteArrayValue = Union["ArrayLike", MESS]


def to_np_type(type_keyword):
Expand Down

0 comments on commit 850609f

Please sign in to comment.