diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 2633344c..84364973 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -19,7 +19,7 @@ jobs: tests: strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cc709819..7f5a46f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.3.0 hooks: - id: black language_version: python3 @@ -15,14 +15,15 @@ repos: - id: check-symlinks - id: check-toml - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-no-eval # A quick check for the eval() built-in function. - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.6.0 hooks: - id: docformatter args: [--in-place] + exclude: mkdocs_macros.py - repo: https://github.com/PyCQA/flake8 rev: 6.0.0 hooks: @@ -33,11 +34,11 @@ repos: hooks: - id: nbstripout - repo: https://github.com/asottile/blacken-docs - rev: v1.12.1 + rev: 1.13.0 hooks: - id: blacken-docs - repo: https://github.com/nbQA-dev/nbQA - rev: 1.6.0 + rev: 1.7.0 hooks: - id: nbqa-black args: [--nbqa-mutate] diff --git a/src/ruptures/detection/binseg.py b/src/ruptures/detection/binseg.py index dd8369bf..075212b7 100644 --- a/src/ruptures/detection/binseg.py +++ b/src/ruptures/detection/binseg.py @@ -21,7 +21,6 @@ def __init__(self, model="l2", custom_cost=None, min_size=2, jump=5, params=None jump (int, optional): subsample (one every *jump* points). Defaults to 5 samples. params (dict, optional): a dictionary of parameters for the cost instance. """ - if custom_cost is not None and isinstance(custom_cost, BaseCost): self.cost = custom_cost else: @@ -47,7 +46,6 @@ def _seg(self, n_bkps=None, pen=None, epsilon=None): Returns: dict: partition dict {(start, end): cost value,...} """ - # initialization bkps = [self.n_samples] stop = False diff --git a/src/ruptures/detection/kernelcpd.py b/src/ruptures/detection/kernelcpd.py index 8da904c5..970ac7f8 100644 --- a/src/ruptures/detection/kernelcpd.py +++ b/src/ruptures/detection/kernelcpd.py @@ -23,8 +23,8 @@ class KernelCPD(BaseEstimator): Given a segment model, it computes the best partition for which the sum of errors is minimum. - See the [user guide](../../../user-guide/detection/kernelcpd) for more - information. + See the [user guide](../../../user-guide/detection/kernelcpd) for + more information. """ def __init__(self, kernel="linear", min_size=2, jump=1, params=None): diff --git a/src/ruptures/detection/pelt.py b/src/ruptures/detection/pelt.py index e4135cc6..1b0c352d 100644 --- a/src/ruptures/detection/pelt.py +++ b/src/ruptures/detection/pelt.py @@ -45,7 +45,6 @@ def _seg(self, pen): Returns: dict: partition dict {(start, end): cost value,...} """ - # initialization # partitions[t] contains the optimal partition of signal[0:t] partitions = dict() # this dict will be recursively filled diff --git a/src/ruptures/detection/window.py b/src/ruptures/detection/window.py index 74668a0f..98a36ac6 100644 --- a/src/ruptures/detection/window.py +++ b/src/ruptures/detection/window.py @@ -54,7 +54,6 @@ def _seg(self, n_bkps=None, pen=None, epsilon=None): Returns: list: breakpoint index list """ - # initialization bkps = [self.n_samples] stop = False diff --git a/tests/test_costs.py b/tests/test_costs.py index 0b10d3cd..6a680d66 100644 --- a/tests/test_costs.py +++ b/tests/test_costs.py @@ -204,7 +204,7 @@ def test_costml(signal_bkps_5D_noisy, signal_bkps_1D_noisy): """ # no user-defined metric matrix c = CostMl() - for (signal, bkps) in (signal_bkps_5D_noisy, signal_bkps_1D_noisy): + for signal, bkps in (signal_bkps_5D_noisy, signal_bkps_1D_noisy): c.fit(signal=signal) c.error(0, 100) c.sum_of_costs(bkps) @@ -219,7 +219,6 @@ def test_costml(signal_bkps_5D_noisy, signal_bkps_1D_noisy): def test_costl2_small_data(): """Test if CostL2 returns the correct segmentation for small data.""" - signal = np.array([0.0, 0.1, 1.2, 1.0]) n_samples = signal.shape[0] algo = Binseg(model="l2", min_size=1, jump=1).fit(signal)