Skip to content

Commit

Permalink
lint: ignore flake8-boolean-trap errors
Browse files Browse the repository at this point in the history
To reproduce the errors:

```
ruff check --select "FBT" black_it tests examples scripts\n
```

In fact, we added "FBT" in the ignore list. The reason is that fixing them would have required changing the signature of many functions, which could have broken user code in many ways.
We decided that such errors do not have the highest priority for the improvmement of the quality of the software.

We fixed a couple of errors that do not have an impact on the user code since they deal with private/test functions:

black_it/utils/time_series.py:83:32: FBT003 Boolean positional value in function call
tests/test_losses/test_gsl.py:28:34: FBT001 Boolean-typed positional argument in function definition
tests/test_losses/test_gsl.py:28:34: FBT002 Boolean default positional argument in function definition
  • Loading branch information
marcofavorito authored and marcofavoritobi committed Sep 1, 2023
1 parent d0bd368 commit 4dfe6e8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
select = ["ALL"]
ignore = ["ANN101", "ANN102", "E203", "S"]
ignore = ["ANN101", "ANN102", "E203", "S", "FBT"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
Expand Down
2 changes: 1 addition & 1 deletion black_it/utils/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_mom_ts_1d(time_series: NDArray[np.float64]) -> NDArray[np.float64]:
avg_vec_mom[16] = ts_diff_acf[4]
avg_vec_mom[17] = ts_diff_acf[5]

np.nan_to_num(avg_vec_mom, False)
np.nan_to_num(avg_vec_mom, copy=False)

return avg_vec_mom

Expand Down
2 changes: 1 addition & 1 deletion tests/test_losses/test_gsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from tests.utils.strategies import discretize_args, get_words_args


def is_sorted(array: np.ndarray, reverse: bool = False) -> bool:
def is_sorted(array: np.ndarray, *, reverse: bool = False) -> bool:
"""Test that a unidimensional array is sorted.
Args:
Expand Down

0 comments on commit 4dfe6e8

Please sign in to comment.