diff --git a/gnes/__init__.py b/gnes/__init__.py index 967f5db1..82f2e316 100644 --- a/gnes/__init__.py +++ b/gnes/__init__.py @@ -14,7 +14,6 @@ # limitations under the License. - # do not change this line # this is managed by git tag and replaced on every release __version__ = '0.0.27' diff --git a/gnes/client/benchmark.py b/gnes/client/benchmark.py index 17812682..1816ee3e 100644 --- a/gnes/client/benchmark.py +++ b/gnes/client/benchmark.py @@ -14,8 +14,6 @@ # limitations under the License. -import time - import grpc from ..helper import TimeContext diff --git a/gnes/encoder/audio/mfcc.py b/gnes/encoder/audio/mfcc.py index 3cd99959..79af1dee 100644 --- a/gnes/encoder/audio/mfcc.py +++ b/gnes/encoder/audio/mfcc.py @@ -14,7 +14,6 @@ # limitations under the License. - from typing import List import numpy as np diff --git a/gnes/encoder/numeric/hash.py b/gnes/encoder/numeric/hash.py index a1fe8d22..ad5e400f 100644 --- a/gnes/encoder/numeric/hash.py +++ b/gnes/encoder/numeric/hash.py @@ -14,8 +14,6 @@ # limitations under the License. - - import numpy as np from ..base import BaseNumericEncoder diff --git a/gnes/encoder/numeric/pca.py b/gnes/encoder/numeric/pca.py index e77e6dda..970730d5 100644 --- a/gnes/encoder/numeric/pca.py +++ b/gnes/encoder/numeric/pca.py @@ -14,8 +14,6 @@ # limitations under the License. - - import numpy as np from ..base import BaseNumericEncoder diff --git a/gnes/encoder/numeric/pq.py b/gnes/encoder/numeric/pq.py index de93e309..73557a51 100644 --- a/gnes/encoder/numeric/pq.py +++ b/gnes/encoder/numeric/pq.py @@ -14,8 +14,6 @@ # limitations under the License. - - import numpy as np from ..base import BaseBinaryEncoder diff --git a/gnes/encoder/numeric/tf_pq.py b/gnes/encoder/numeric/tf_pq.py index 682c2808..8a302a33 100644 --- a/gnes/encoder/numeric/tf_pq.py +++ b/gnes/encoder/numeric/tf_pq.py @@ -14,8 +14,6 @@ # limitations under the License. - - from typing import Dict, Any import numpy as np diff --git a/gnes/encoder/numeric/vlad.py b/gnes/encoder/numeric/vlad.py index 48509f60..39664aeb 100644 --- a/gnes/encoder/numeric/vlad.py +++ b/gnes/encoder/numeric/vlad.py @@ -14,8 +14,6 @@ # limitations under the License. - - import copy import numpy as np diff --git a/gnes/encoder/text/bert.py b/gnes/encoder/text/bert.py index 75304907..a3cc1b9f 100644 --- a/gnes/encoder/text/bert.py +++ b/gnes/encoder/text/bert.py @@ -14,8 +14,6 @@ # limitations under the License. - - from typing import List import numpy as np diff --git a/gnes/encoder/text/elmo.py b/gnes/encoder/text/elmo.py index ce989ae3..9e0eba51 100644 --- a/gnes/encoder/text/elmo.py +++ b/gnes/encoder/text/elmo.py @@ -14,8 +14,6 @@ # limitations under the License. - - from typing import List import numpy as np diff --git a/gnes/encoder/text/flair.py b/gnes/encoder/text/flair.py index 7647113c..e9f61680 100644 --- a/gnes/encoder/text/flair.py +++ b/gnes/encoder/text/flair.py @@ -14,8 +14,6 @@ # limitations under the License. - - from typing import List import numpy as np diff --git a/gnes/encoder/text/w2v.py b/gnes/encoder/text/w2v.py index 7d9033ec..80231dd9 100644 --- a/gnes/encoder/text/w2v.py +++ b/gnes/encoder/text/w2v.py @@ -14,8 +14,6 @@ # limitations under the License. - - from typing import List import numpy as np diff --git a/gnes/indexer/fulltext/leveldb.py b/gnes/indexer/fulltext/leveldb.py index 633a7f4e..6323bfac 100644 --- a/gnes/indexer/fulltext/leveldb.py +++ b/gnes/indexer/fulltext/leveldb.py @@ -14,8 +14,6 @@ # limitations under the License. - - import pickle from threading import Thread, Event from typing import List, Any diff --git a/gnes/indexer/vector/annoy.py b/gnes/indexer/vector/annoy.py index 1e97ffc1..a3a888fe 100644 --- a/gnes/indexer/vector/annoy.py +++ b/gnes/indexer/vector/annoy.py @@ -72,14 +72,14 @@ def query(self, keys: 'np.ndarray', top_k: int, *args, **kwargs) -> List[List[Tu def normalize_score(self, score: List[float], metrics: str, *args, **kwargs) -> List[float]: if metrics == 'angular': - return list(map(lambda x:1 / (1 + x), score)) + return list(map(lambda x: 1 / (1 + x), score)) elif metrics == 'euclidean': import math - return list(map(lambda x:1 / (1 + math.sqrt(x) / self.num_dim), score)) + return list(map(lambda x: 1 / (1 + math.sqrt(x) / self.num_dim), score)) elif metrics == 'manhattan': - return list(map(lambda x:1 / (1 + x / self.num_dim), score)) + return list(map(lambda x: 1 / (1 + x / self.num_dim), score)) elif metrics == 'hamming': - return list(map(lambda x:1 / (1 + x), score)) + return list(map(lambda x: 1 / (1 + x), score)) elif metrics == 'dot': raise NotImplementedError diff --git a/gnes/indexer/vector/bindexer/__init__.py b/gnes/indexer/vector/bindexer/__init__.py index 9a7935b5..4bb7e2dc 100644 --- a/gnes/indexer/vector/bindexer/__init__.py +++ b/gnes/indexer/vector/bindexer/__init__.py @@ -14,7 +14,6 @@ # limitations under the License. - import os from typing import List, Tuple, Any diff --git a/gnes/indexer/vector/faiss.py b/gnes/indexer/vector/faiss.py index e242e0bf..1f812de5 100644 --- a/gnes/indexer/vector/faiss.py +++ b/gnes/indexer/vector/faiss.py @@ -14,8 +14,6 @@ # limitations under the License. - - import os from typing import List, Tuple, Any diff --git a/gnes/indexer/vector/hbindexer/__init__.py b/gnes/indexer/vector/hbindexer/__init__.py index 17de9ea6..42bb3d8c 100644 --- a/gnes/indexer/vector/hbindexer/__init__.py +++ b/gnes/indexer/vector/hbindexer/__init__.py @@ -14,7 +14,6 @@ # limitations under the License. - import os from typing import List, Tuple, Any diff --git a/gnes/indexer/vector/numpy.py b/gnes/indexer/vector/numpy.py index 7878b3b1..8ae3219d 100644 --- a/gnes/indexer/vector/numpy.py +++ b/gnes/indexer/vector/numpy.py @@ -14,7 +14,6 @@ # limitations under the License. - from typing import List, Tuple, Any import numpy as np diff --git a/gnes/preprocessor/video/ffmpeg.py b/gnes/preprocessor/video/ffmpeg.py index 9a9bc7a4..169dcac3 100644 --- a/gnes/preprocessor/video/ffmpeg.py +++ b/gnes/preprocessor/video/ffmpeg.py @@ -13,10 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import random from typing import List import numpy as np -import random + from .base import BaseVideoPreprocessor from ..helper import get_video_frames, phash_descriptor from ...proto import gnes_pb2, array2blob diff --git a/gnes/router/reduce/chunk_sum.py b/gnes/router/reduce/chunk_sum.py index 14d159b4..fbce320e 100644 --- a/gnes/router/reduce/chunk_sum.py +++ b/gnes/router/reduce/chunk_sum.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List from collections import defaultdict +from typing import List from ..base import BaseReduceRouter from ...proto import gnes_pb2 @@ -42,4 +42,4 @@ def apply(self, msg: 'gnes_pb2.Message', accum_msgs: List['gnes_pb2.Message'], * r.score = v r.score_explained = doc_score_explained[k] - super().apply(msg, accum_msgs) \ No newline at end of file + super().apply(msg, accum_msgs) diff --git a/gnes/router/reduce/doc_sum.py b/gnes/router/reduce/doc_sum.py index fec0b90b..99e957ce 100644 --- a/gnes/router/reduce/doc_sum.py +++ b/gnes/router/reduce/doc_sum.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List from collections import defaultdict +from typing import List from ..base import BaseReduceRouter from ...proto import gnes_pb2 @@ -52,4 +52,4 @@ def apply(self, msg: 'gnes_pb2.Message', accum_msgs: List['gnes_pb2.Message'], * msg.response.search.ClearField('topk_results') msg.response.search.topk_results.extend(final_fulltext_docs[:msg.response.search.top_k]) - super().apply(msg, accum_msgs) \ No newline at end of file + super().apply(msg, accum_msgs)