diff --git a/pyproject.toml b/pyproject.toml index 919a0a8..b27a074 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,3 +51,18 @@ ignore = ["tests"] typeCheckingMode = "standard" useLibraryCodeForTypes = true reportMissingParameterType = true + +[tool.ruff] +include = ["pyproject.toml", "src/**/*.py"] + +[tool.ruff.lint] +select = [ + "E4", # pycodestyle + "E7", # pycodestyle + "E9", # pycodestyle + "F", # Pyflakes + "ANN", # flake8 +] +ignore = [ + "ANN401", # any-type +] diff --git a/src/fast_forward/index/__init__.py b/src/fast_forward/index/__init__.py index 3902de7..f1c307f 100644 --- a/src/fast_forward/index/__init__.py +++ b/src/fast_forward/index/__init__.py @@ -304,7 +304,7 @@ def _compute_scores( else: op = itemgetter(0) - def _mapfunc(i: int): + def _mapfunc(i: int) -> float: scores_i = select_scores[i] if len(scores_i) == 0: return np.nan @@ -426,7 +426,7 @@ def __call__( # batch encode queries query_vectors = self.encode_queries(list(query_df["query"])) - def _get_result(df: pd.DataFrame): + def _get_result(df: pd.DataFrame) -> pd.DataFrame: if early_stopping is None: return self._compute_scores(df, query_vectors) diff --git a/src/fast_forward/util/__init__.py b/src/fast_forward/util/__init__.py index 925d0b0..f47af07 100644 --- a/src/fast_forward/util/__init__.py +++ b/src/fast_forward/util/__init__.py @@ -53,7 +53,7 @@ def create_coalesced_index( if len(target_index) > 0: raise ValueError("Target index is not empty.") - def _coalesce(P: np.ndarray): + def _coalesce(P: np.ndarray) -> list[np.ndarray]: P_new = [] A = [] A_avg = np.empty(())