Skip to content

Commit

Permalink
Revert "Remove dtype lists"
Browse files Browse the repository at this point in the history
This reverts commit 6e39a2e.
  • Loading branch information
lagru committed Feb 21, 2024
1 parent 6e39a2e commit daaf7bc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions skimage/_shared/dtype.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
import numpy as np

# Define classes of supported dtypes and Python scalar types
# Variables ending in `_dtypes` only contain numpy.dtypes of the respective
# class; variables ending in `_types` additionally include Python scalar types.
signed_integer_dtypes = {np.int8, np.int16, np.int32, np.int64}
signed_integer_types = signed_integer_dtypes | {int}

unsigned_integer_dtypes = {np.uint8, np.uint16, np.uint32, np.uint64}

integer_dtypes = signed_integer_dtypes | unsigned_integer_dtypes
integer_types = signed_integer_types | unsigned_integer_dtypes

floating_dtypes = {np.float16, np.float32, np.float64}
floating_types = floating_dtypes | {float}

complex_dtypes = {np.complex64, np.complex128}
complex_types = complex_dtypes | {complex}

inexact_dtypes = floating_dtypes | complex_dtypes
inexact_types = floating_types | complex_types

bool_types = {np.dtype(bool), bool}

numeric_dtypes = integer_dtypes | inexact_dtypes | {np.bool_}
numeric_types = integer_types | inexact_types | bool_types


def numeric_dtype_min_max(dtype):
"""Return minimum and maximum representable value for a given dtype.
Expand Down

0 comments on commit daaf7bc

Please sign in to comment.