From 8a39a951d15b4ff53a63cc17e2a47908e32b7e48 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 27 Jul 2026 22:03:10 +0200 Subject: [PATCH] [ci] Fix ruff 0.16 regression (#289) * [ci] Add free threaded python interpreter 3.14t to pytest action * [ci] Return to pre 0.16 ruff behaviour * [ci] Add back ruff pyflake checks and allow 3.14t to fail * [ci] undo pytest change, bump ruff runner version * [ci] Explicitly bump ruff action version --- .github/workflows/ruff.yml | 2 +- pyerrors/correlators.py | 9 ++------- pyerrors/obs.py | 3 +-- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index c4d5d7f1..e747bb2b 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -10,6 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: astral-sh/ruff-action@v3 + - uses: astral-sh/ruff-action@v4.1.0 with: src: "./pyerrors" diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index a8d2361e..b9a4f440 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -727,9 +727,7 @@ class Corr: if variant == 'log': newcontent = [] for t in range(self.T - 1): - if ((self.content[t] is None) or (self.content[t + 1] is None)) or (self.content[t + 1][0].value == 0): - newcontent.append(None) - elif self.content[t][0].value / self.content[t + 1][0].value < 0: + if ((self.content[t] is None) or (self.content[t + 1] is None)) or (self.content[t + 1][0].value == 0) or self.content[t][0].value / self.content[t + 1][0].value < 0: newcontent.append(None) else: newcontent.append(self.content[t] / self.content[t + 1]) @@ -741,9 +739,7 @@ class Corr: elif variant == 'logsym': newcontent = [] for t in range(1, self.T - 1): - if ((self.content[t - 1] is None) or (self.content[t + 1] is None)) or (self.content[t + 1][0].value == 0): - newcontent.append(None) - elif self.content[t - 1][0].value / self.content[t + 1][0].value < 0: + if ((self.content[t - 1] is None) or (self.content[t + 1] is None)) or (self.content[t + 1][0].value == 0) or self.content[t - 1][0].value / self.content[t + 1][0].value < 0: newcontent.append(None) else: newcontent.append(self.content[t - 1] / self.content[t + 1]) @@ -872,7 +868,6 @@ class Corr: raise ValueError("Start and end point must define a range in the interval 0,T") self.prange = prange - return def show(self, x_range=None, comp=None, y_range=None, logscale=False, plateau=None, fit_res=None, fit_key=None, ylabel=None, save=None, auto_gamma=False, hide_sigma=None, references=None, title=None): """Plots the correlator using the tag of the correlator as label if available. diff --git a/pyerrors/obs.py b/pyerrors/obs.py index 69a05bdf..8e6fc757 100644 --- a/pyerrors/obs.py +++ b/pyerrors/obs.py @@ -364,7 +364,6 @@ class Obs: self.ddvalue = 0.0 else: self.ddvalue = np.sqrt(self.ddvalue) / self._dvalue - return gm = gamma_method @@ -1303,7 +1302,7 @@ def derived_observable(func, data, array_mode=False, **kwargs): options = { 'base_step': 0.1, 'step_ratio': 2.5} - for key in options.keys(): + for key in options: kwarg = kwargs.get(key) if kwarg is not None: options[key] = kwarg diff --git a/pyproject.toml b/pyproject.toml index a78c2bc0..02507dad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" target-version = "py310" [tool.ruff.lint] -extend-select = ["E", "W", "I", "B", "PIE", "PLE", "PLW", "UP", "NPY", "RUF"] +select = ["E", "W", "I", "B", "PIE", "PLE", "PLW", "UP", "NPY", "RUF", "F"] ignore = [ "F403", # star imports in __init__ files are intentional "E501", # line too long