Skip to content

Commit 8aff472

Browse files
committed
Explicit NominalDtypeEnum declaration
1 parent 1c338c3 commit 8aff472

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

tests/strategies.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections.abc import Mapping
22
from enum import Enum
3-
from typing import Collection, Dict, List, NamedTuple
3+
from typing import Collection, Dict, NamedTuple
44

55
import numpy as np
66
from hypothesis import strategies as st
@@ -9,23 +9,22 @@
99
__all__ = ["mock_dataframes", "MockDataFrame", "MockColumn", "NominalDtypeEnum"]
1010

1111

12-
nominal_numerics: List[str] = []
13-
for kind in ["int", "uint"]:
14-
for bitwidth in [8, 16, 32, 64]:
15-
nominal_numerics.append(f"{kind}{bitwidth}")
16-
for bitwidth in [32, 64]:
17-
nominal_numerics.append(f"float{bitwidth}")
18-
19-
NominalDtypeEnum = Enum(
20-
"NominalDtypeEnum",
21-
{
22-
"BOOL": "bool",
23-
**{name.upper(): name for name in nominal_numerics},
24-
"UTF8": "U8",
25-
"DATETIME64NS": "datetime64[ns]",
26-
"CATEGORY": "category",
27-
},
28-
)
12+
class NominalDtypeEnum(Enum):
13+
BOOL = "bool"
14+
UTF8 = "U8"
15+
DATETIME64NS = "datetime64[ns]"
16+
CATEGORY = "category"
17+
# Numerics
18+
UINT8 = "uint8"
19+
UINT16 = "uint16"
20+
UINT32 = "uint32"
21+
UINT64 = "uint64"
22+
INT8 = "int8"
23+
INT16 = "int16"
24+
INT32 = "int32"
25+
INT64 = "int64"
26+
FLOAT32 = "float32"
27+
FLOAT64 = "float64"
2928

3029

3130
class MockColumn(NamedTuple):

0 commit comments

Comments
 (0)