Skip to content

Commit

Permalink
add ruff configuration to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjleo committed Dec 9, 2024
1 parent 241dca1 commit ea15b41
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
4 changes: 2 additions & 2 deletions src/fast_forward/index/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/fast_forward/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit ea15b41

Please sign in to comment.