Skip to content

Commit 4918d02

Browse files
committed
feat: Add ruff in pre-commit hooks
1 parent 60d42bd commit 4918d02

File tree

25 files changed

+63
-23
lines changed

25 files changed

+63
-23
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ repos:
2828
- id: isort
2929
name: "Sort Imports"
3030
args: ["--profile", "black"]
31+
32+
- repo: https://github.com/astral-sh/ruff-pre-commit
33+
rev: v0.3.5
34+
hooks:
35+
# Run the linter.
36+
- id: ruff

benchmark/dataset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import gzip
21
import os
32
import shutil
43
import tarfile

engine/base_client/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@
66

77
class IncompatibilityError(Exception):
88
pass
9+
10+
11+
__all__ = [
12+
"BaseClient",
13+
"BaseConfigurator",
14+
"BaseSearcher",
15+
"BaseUploader",
16+
"IncompatibilityError",
17+
]

engine/base_client/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
import os
33
from datetime import datetime
4-
from pathlib import Path
54
from typing import List
65

76
from benchmark import ROOT_DIR

engine/base_client/upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
from multiprocessing import get_context
3-
from typing import Iterable, List, Optional, Tuple
3+
from typing import Iterable, List, Optional
44

55
import tqdm
66

engine/base_client/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Iterable
1+
from typing import Iterable
22

33
from dataset_reader.base_reader import Record
44

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
from engine.clients.elasticsearch.configure import ElasticConfigurator
22
from engine.clients.elasticsearch.search import ElasticSearcher
33
from engine.clients.elasticsearch.upload import ElasticUploader
4+
5+
__all__ = [
6+
"ElasticConfigurator",
7+
"ElasticSearcher",
8+
"ElasticUploader",
9+
]

engine/clients/elasticsearch/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def search_one(cls, query: Query, top: int) -> List[Tuple[int, float]]:
5555
**{"num_candidates": 100, **cls.search_params},
5656
}
5757

58-
meta_conditions = cls.parser.parse(meta_conditions)
58+
meta_conditions = cls.parser.parse(query.meta_conditions)
5959
if meta_conditions:
6060
knn["filter"] = meta_conditions
6161

engine/clients/elasticsearch/upload.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import multiprocessing as mp
22
import uuid
3-
from typing import List, Optional
3+
from typing import List
44

55
from elasticsearch import Elasticsearch
66

@@ -46,8 +46,6 @@ def init_client(cls, host, distance, connection_params, upload_params):
4646

4747
@classmethod
4848
def upload_batch(cls, batch: List[Record]):
49-
if metadata is None:
50-
metadata = [{}] * len(batch)
5149
operations = []
5250
for record in batch:
5351
vector_id = uuid.UUID(int=record.idx).hex

engine/clients/milvus/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
from engine.clients.milvus.configure import MilvusConfigurator
22
from engine.clients.milvus.search import MilvusSearcher
33
from engine.clients.milvus.upload import MilvusUploader
4+
5+
__all__ = [
6+
"MilvusConfigurator",
7+
"MilvusSearcher",
8+
"MilvusUploader",
9+
]

0 commit comments

Comments
 (0)