Skip to content

Commit 07cba09

Browse files
authored
fix: Use StrEnum instead of str, Enum (#722)
Signed-off-by: yangxuan <xuan.yang@zilliz.com>
1 parent 34e8f25 commit 07cba09

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

vectordb_bench/backend/clients/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from abc import ABC, abstractmethod
22
from contextlib import contextmanager
3-
from enum import Enum
3+
from enum import StrEnum
44

55
from pydantic import BaseModel, SecretStr, validator
66

77
from vectordb_bench.backend.filter import Filter, FilterOp
88

99

10-
class MetricType(str, Enum):
10+
class MetricType(StrEnum):
1111
L2 = "L2"
1212
COSINE = "COSINE"
1313
IP = "IP"
@@ -16,7 +16,7 @@ class MetricType(str, Enum):
1616
JACCARD = "JACCARD"
1717

1818

19-
class IndexType(str, Enum):
19+
class IndexType(StrEnum):
2020
HNSW = "HNSW"
2121
HNSW_SQ = "HNSW_SQ"
2222
HNSW_BQ = "HNSW_BQ"
@@ -47,7 +47,7 @@ class IndexType(str, Enum):
4747
NONE = "NONE"
4848

4949

50-
class SQType(str, Enum):
50+
class SQType(StrEnum):
5151
SQ6 = "SQ6"
5252
SQ8 = "SQ8"
5353
BF16 = "BF16"

vectordb_bench/backend/clients/elastic_cloud/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33
from pydantic import BaseModel, SecretStr
44

@@ -16,7 +16,7 @@ def to_dict(self) -> dict:
1616
}
1717

1818

19-
class ESElementType(str, Enum):
19+
class ESElementType(StrEnum):
2020
float = "float" # 4 byte
2121
byte = "byte" # 1 byte, -128 to 127
2222

vectordb_bench/backend/clients/tencent_elasticsearch/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum
1+
from enum import StrEnum
22

33
from pydantic import BaseModel, SecretStr
44

@@ -20,7 +20,7 @@ def to_dict(self) -> dict:
2020
}
2121

2222

23-
class ESElementType(str, Enum):
23+
class ESElementType(StrEnum):
2424
float = "float" # 4 byte
2525
byte = "byte" # 1 byte, -128 to 127
2626

0 commit comments

Comments
 (0)