Skip to content

Commit

Permalink
FIX: Union dtypes for Python 3.8 compatibility
Browse files Browse the repository at this point in the history
Even with future annotations imported creating a unioned type of types,
using the `type[]` future annotations, caused some errors.
  • Loading branch information
mferrera committed Nov 29, 2023
1 parent 19a7988 commit 7267887
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/xtgeo/grid3d/grid_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
logger = null_logger(__name__)

if TYPE_CHECKING:
from typing import Union

import numpy.typing as npt

from xtgeo.common.types import FileLike
Expand All @@ -47,17 +49,17 @@
from ._gridprop_op1 import XYValueLists
from .grid import Grid

GridProperty_DType = (
type[np.uint8]
| type[np.uint16]
| type[np.int16]
| type[np.int32]
| type[np.int64]
| type[np.float16]
| type[np.float32]
| type[np.float64]
)
Roxar_DType = type[np.uint8] | type[np.uint16] | type[np.float32]
GridProperty_DType = Union[
type[np.uint8],
type[np.uint16],
type[np.int16],
type[np.int32],
type[np.int64],
type[np.float16],
type[np.float32],
type[np.float64],
]
Roxar_DType = Union[type[np.uint8], type[np.uint16], type[np.float32]]

# --------------------------------------------------------------------------------------
# Comment on 'asmasked' vs 'activeonly:
Expand Down

0 comments on commit 7267887

Please sign in to comment.