Skip to content

Commit

Permalink
MAINT: Fix linting errors
Browse files Browse the repository at this point in the history
Also updated ruffs rules.
  • Loading branch information
derb12 committed Feb 18, 2024
1 parent 3c0b8a4 commit bc3b8e8
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ jobs:
run: python -m pip install ruff

- name: Lint
run: ruff check . --show-source
run: ruff check .
1 change: 0 additions & 1 deletion pybaselines/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,6 @@ def fabc(self, data, lam=1e6, scale=None, num_std=3.0, diff_order=2, min_length=

return baseline, params


@_Algorithm._register(sort_keys=('mask',))
def rubberband(self, data, segments=1, lam=None, diff_order=2, weights=None,
smooth_half_window=None, **pad_kwargs):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ known_local_folder = ["example_helpers"]
exclude = ["docs/*"]
line-length = 100
fix = false
output-format = "full"

[tool.ruff.lint]
preview = true # for using experimental rules
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-r requirements-documentation.txt

# for linting
ruff==0.2.1
ruff==0.2.2

# for testing
pytest==8.0.0
Expand Down
1 change: 0 additions & 1 deletion tests/test_algorithm_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ def func2(self, data, *args, **kwargs):
}
return 1 * data, params


if change_order:
x[sort_indices] = x[sort_indices][::-1]
y[sort_indices] = y[sort_indices][::-1]
Expand Down
2 changes: 0 additions & 2 deletions tests/test_banded_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def test_diff_penalty_diagonals_datasize_too_small():
_banded_utils.diff_penalty_diagonals(-1)



@pytest.mark.parametrize('data_size', (10, 51))
@pytest.mark.parametrize('diff_order', (1, 2, 3, 4))
def test_diff_penalty_matrix(data_size, diff_order):
Expand Down Expand Up @@ -452,7 +451,6 @@ def check_penalized_system(penalized_system, expected_penalty, lam, diff_order,
)



@pytest.mark.parametrize('diff_order', (1, 2, 3))
@pytest.mark.parametrize('allow_lower', (True, False))
@pytest.mark.parametrize('reverse_diags', (None, True, False))
Expand Down
1 change: 0 additions & 1 deletion tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ def test_setup(self):
assert self.param_keys == []
assert self.two_d


def test_reverse_array(self):
"""Ensures the reverse_array funcion works correctly."""
assert_allclose(self.reverse_array(self.y), self.y[..., ::-1])
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_gaussian(_x_data, height, center, sigma):
gaussian(_x_data, height, center, sigma), 1e-12, 1e-12
)


@pytest.mark.parametrize('sigma', (0, -1))
def test_gaussian_non_positive_sigma(_x_data, sigma):
"""Ensures a sigma value not greater than 0 raises an exception."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_yx_arrays_no_x(small_data):
assert isinstance(y, np.ndarray)
assert_allclose(y, small_data, rtol=1e-12, atol=1e-12)


@pytest.mark.parametrize('array_enum', (0, 1))
def test_yxz_arrays_output_array(data_fixture2d, array_enum):
"""Ensures output y, x, and z are always numpy arrays and that x and z are not scaled."""
Expand Down Expand Up @@ -343,6 +344,7 @@ def test_check_half_window_failures():
with pytest.raises(TypeError):
_validation._check_half_window(5.01)


@pytest.mark.parametrize(
'half_window', (
5, 5.0, [5], (5,), [[5]], np.array(5), np.array([5]), np.array([[5]]),
Expand Down
1 change: 0 additions & 1 deletion tests/two_d/test_spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def test_diff_order_one_fails(self):
with pytest.raises(ValueError):
self.class_func(self.y, diff_order=[2, 1])


@pytest.mark.parametrize('lam', (1e1, 1e5, [1e1, 1e5]))
@pytest.mark.parametrize('lam_1', (1e1, [1e1, 1e5]))
@pytest.mark.parametrize('p', (0.01, 0.1))
Expand Down

0 comments on commit bc3b8e8

Please sign in to comment.