Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add python v3.11 to test gh action #299

Merged
merged 11 commits into from
Jun 6, 2023
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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]
Expand Down
2 changes: 0 additions & 2 deletions src/ruptures/detection/binseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ruptures/detection/kernelcpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion src/ruptures/detection/pelt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/ruptures/detection/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/test_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down