From 75685a1000ccb980b0ebc0209f7992d43f1228cd Mon Sep 17 00:00:00 2001 From: sdupourque Date: Fri, 16 Aug 2024 15:34:23 +0200 Subject: [PATCH] linting with new rules --- .pre-commit-config.yaml | 2 +- src/chainconsumer/plotter.py | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3934217a..23a84892 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - --unsafe - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.7 + rev: v0.6.0 hooks: - id: ruff args: ["--fix", "--no-unsafe-fixes"] diff --git a/src/chainconsumer/plotter.py b/src/chainconsumer/plotter.py index 620dd236..1be4d366 100644 --- a/src/chainconsumer/plotter.py +++ b/src/chainconsumer/plotter.py @@ -889,10 +889,8 @@ def _get_parameter_extents( min_prop = point.coordinate[column] max_prop = min_prop - if min_prop < min_val: - min_val = min_prop - if max_prop > max_val: - max_val = max_prop + min_val = min(min_prop, min_val) + max_val = max(max_prop, max_val) return min_val, max_val @@ -952,10 +950,8 @@ def _plot_bars( lower = fit_values.lower upper = fit_values.upper if lower is not None and upper is not None: - if lower < xs.min(): - lower = xs.min() - if upper > xs.max(): - upper = xs.max() + lower = max(lower, xs.min()) + upper = min(upper, xs.max()) x = np.linspace(lower, upper, 1000) # type: ignore if flip: ax.fill_betweenx(