Skip to content

Commit aeca40c

Browse files
alwayslove2013XuanYang-cn
authored andcommitted
upgrade black/ruff and fix lint issues
Signed-off-by: min.tian <[email protected]>
1 parent 9ab7e3c commit aeca40c

File tree

7 files changed

+17
-18
lines changed

7 files changed

+17
-18
lines changed

vectordb_bench/backend/clients/oss_opensearch/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
run,
1313
)
1414
from .. import DB
15-
from .config import OSSOS_Engine, OSSOpenSearchQuantization
15+
from .config import OSSOpenSearchQuantization, OSSOS_Engine
1616

1717
log = logging.getLogger(__name__)
1818

vectordb_bench/backend/clients/oss_opensearch/config.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class OSSOpenSearchConfig(DBConfig, BaseModel):
1717
def to_dict(self) -> dict:
1818
use_ssl = self.port == 443
1919
http_auth = (
20-
(self.user, self.password.get_secret_value())
21-
if self.user is not None and self.password is not None and len(self.user) != 0 and len(self.password) != 0
20+
(self.user, self.password.get_secret_value())
21+
if self.user is not None and self.password is not None and len(self.user) != 0 and len(self.password) != 0
2222
else ()
2323
)
2424
return {
@@ -78,7 +78,7 @@ class OSSOpenSearchIndexConfig(BaseModel, DBCaseConfig):
7878
quantization_type: OSSOpenSearchQuantization = OSSOpenSearchQuantization.fp32
7979

8080
@root_validator
81-
def validate_engine_name(cls, values):
81+
def validate_engine_name(cls, values: dict):
8282
"""Map engine_name string from UI to engine enum"""
8383
if values.get("engine_name"):
8484
engine_name = values["engine_name"].lower()
@@ -138,8 +138,6 @@ def index_param(self) -> dict:
138138
log.info(f"Using metric_type: {self.metric_type_name} for index creation")
139139
log.info(f"Resulting space_type: {self.parse_metric()} for index creation")
140140

141-
parameters = {"ef_construction": self.efConstruction, "m": self.M}
142-
143141
return {
144142
"name": "hnsw",
145143
"engine": self.engine.value,

vectordb_bench/backend/clients/oss_opensearch/oss_opensearch.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ def _create_index(self, client: OpenSearch) -> None:
9393
settings["index"]["knn.algo_param.ef_search"] = ef_search_value
9494
# Build properties mapping, excluding _id which is automatically handled by OpenSearch
9595
properties = {}
96-
96+
9797
# Only add id field to properties if it's not the special _id field
9898
if self.id_col_name != "_id":
9999
properties[self.id_col_name] = {"type": "integer", "store": True}
100-
100+
101101
properties[self.label_col_name] = {"type": "keyword"}
102102
properties[self.vector_col_name] = {
103103
"type": "knn_vector",
104104
"dimension": self.dim,
105105
"method": self.case_config.index_param(),
106106
}
107-
107+
108108
mappings = {
109109
"properties": properties,
110110
}
@@ -342,17 +342,16 @@ def search_embedding(
342342
preference="_only_local" if self.case_config.number_of_shards == 1 else None,
343343
routing=self.routing_key,
344344
)
345-
345+
346346
log.debug(f"Search took: {resp['took']}")
347347
log.debug(f"Search shards: {resp['_shards']}")
348348
log.debug(f"Search hits total: {resp['hits']['total']}")
349349
try:
350350
if self.id_col_name == "_id":
351351
# Get _id directly from hit metadata
352352
return [int(h["_id"]) for h in resp["hits"]["hits"]]
353-
else:
354-
# Get custom id field from docvalue fields
355-
return [int(h["fields"][self.id_col_name][0]) for h in resp["hits"]["hits"]]
353+
# Get custom id field from docvalue fields
354+
return [int(h["fields"][self.id_col_name][0]) for h in resp["hits"]["hits"]]
356355
except Exception:
357356
# empty results
358357
return []

vectordb_bench/backend/clients/s3_vectors/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class S3VectorsIndexConfig(DBCaseConfig, BaseModel):
2929
def parse_metric(self) -> str:
3030
if self.metric_type == MetricType.COSINE:
3131
return "cosine"
32-
elif self.metric_type == MetricType.L2:
32+
if self.metric_type == MetricType.L2:
3333
return "euclidean"
34-
else:
35-
raise ValueError(f"Unsupported metric type: {self.metric_type}")
34+
msg = f"Unsupported metric type: {self.metric_type}"
35+
raise ValueError(msg)
3636

3737
def index_param(self) -> dict:
3838
return {}

vectordb_bench/backend/clients/s3_vectors/s3_vectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Wrapper around the Milvus vector database over VectorDB"""
22

33
import logging
4-
import time
54
from collections.abc import Iterable
65
from contextlib import contextmanager
76

87
import boto3
8+
99
from vectordb_bench.backend.filter import Filter, FilterOp
1010

1111
from ..api import VectorDB

vectordb_bench/backend/clients/tidb/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from ..api import DBCaseConfig, DBConfig, MetricType
66

7+
78
class TiDBConfigDict(TypedDict):
89
host: str
910
port: int
@@ -13,6 +14,7 @@ class TiDBConfigDict(TypedDict):
1314
ssl_verify_cert: bool
1415
ssl_verify_identity: bool
1516

17+
1618
class TiDBConfig(DBConfig):
1719
user_name: str = "root"
1820
password: SecretStr

vectordb_bench/cli/vectordbbench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from ..backend.clients.alloydb.cli import AlloyDBScaNN
22
from ..backend.clients.aws_opensearch.cli import AWSOpenSearch
3-
from ..backend.clients.oss_opensearch.cli import OSSOpenSearch
43
from ..backend.clients.clickhouse.cli import Clickhouse
54
from ..backend.clients.lancedb.cli import LanceDB
65
from ..backend.clients.mariadb.cli import MariaDBHNSW
76
from ..backend.clients.memorydb.cli import MemoryDB
87
from ..backend.clients.milvus.cli import MilvusAutoIndex
98
from ..backend.clients.oceanbase.cli import OceanBaseHNSW, OceanBaseIVF
9+
from ..backend.clients.oss_opensearch.cli import OSSOpenSearch
1010
from ..backend.clients.pgdiskann.cli import PgDiskAnn
1111
from ..backend.clients.pgvecto_rs.cli import PgVectoRSHNSW, PgVectoRSIVFFlat
1212
from ..backend.clients.pgvector.cli import PgVectorHNSW

0 commit comments

Comments
 (0)