-
-
Notifications
You must be signed in to change notification settings - Fork 378
Open
Description
We use enums in a few places in the codebase, and I think in every instance a simple string literal is a better solution. We should remove or deprecate the use of Enum from the following modules:
- bytes.py:
zarr-python/src/zarr/codecs/bytes.py
Lines 21 to 27 in bce30dd
class Endian(Enum): """ Enum for endian type used by bytes codec. """ big = "big" little = "little" - indexing.py: https://github.com/zarr-developers/zarr-python/blob/bce30dd3cc92a35038b88f80c4c42130670d4100/src/zarr/core/indexing.py#L697C7-L720
- sharding.py:
zarr-python/src/zarr/codecs/sharding.py
Lines 68 to 74 in bce30dd
class ShardingCodecIndexLocation(Enum): """ Enum for index location used by the sharding codec. """ start = "start" end = "end" - blosc.py:
zarr-python/src/zarr/codecs/blosc.py
Lines 25 to 56 in bce30dd
class BloscShuffle(Enum): """ Enum for shuffle filter used by blosc. """ noshuffle = "noshuffle" shuffle = "shuffle" bitshuffle = "bitshuffle" @classmethod def from_int(cls, num: int) -> BloscShuffle: blosc_shuffle_int_to_str = { 0: "noshuffle", 1: "shuffle", 2: "bitshuffle", } if num not in blosc_shuffle_int_to_str: raise ValueError(f"Value must be between 0 and 2. Got {num}.") return BloscShuffle[blosc_shuffle_int_to_str[num]] class BloscCname(Enum): """ Enum for compression library used by blosc. """ lz4 = "lz4" lz4hc = "lz4hc" blosclz = "blosclz" zstd = "zstd" snappy = "snappy" zlib = "zlib"
Metadata
Metadata
Assignees
Labels
No labels