From b4436e08049d6ca22d692539d77d657d0efb3998 Mon Sep 17 00:00:00 2001 From: forrestmckee <43412563+forrestmckee@users.noreply.github.com> Date: Tue, 9 Jul 2024 03:26:45 -0500 Subject: [PATCH] refactor: update type hint and remove unused import (#1436) change typehint on `_invert_score` from `List[float]` to `float`. remove unnecessary typing import --- python/python/lancedb/rerankers/linear_combination.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/python/python/lancedb/rerankers/linear_combination.py b/python/python/lancedb/rerankers/linear_combination.py index 4f4110fa..3eb19b1d 100644 --- a/python/python/lancedb/rerankers/linear_combination.py +++ b/python/python/lancedb/rerankers/linear_combination.py @@ -1,5 +1,3 @@ -from typing import List - import pyarrow as pa from .base import Reranker @@ -112,6 +110,6 @@ class LinearCombinationReranker(Reranker): # these scores represent distance return 1 - (self.weight * score1 + (1 - self.weight) * score2) - def _invert_score(self, scores: List[float]): - # Invert the scores between relevance and distance - return 1 - scores + def _invert_score(self, score: float): + # Invert the score between relevance and distance + return 1 - score