From 545ea52264ef7e8dd4bfc88ca5e6e96d1e4b964c Mon Sep 17 00:00:00 2001 From: Kevin Meagher <11620178+kjmeagher@users.noreply.github.com> Date: Thu, 4 Apr 2024 15:18:42 -0500 Subject: [PATCH] fix ruff error --- .pre-commit-config.yaml | 9 +++------ ehist/bayesian_blocks.py | 1 + tests/test_hist1d.py | 4 +++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12d7f66..3510a62 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,15 +10,12 @@ repos: rev: v4.0.0-alpha.8 hooks: - id: prettier - - repo: https://github.com/psf/black - rev: 24.3.0 - hooks: - - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.4 + rev: v0.3.5 hooks: - id: ruff - args: [--fix] + args: [--fix, --show-fixes] + - id: ruff-format - repo: https://github.com/pycqa/pylint rev: v3.1.0 hooks: diff --git a/ehist/bayesian_blocks.py b/ehist/bayesian_blocks.py index 17cdbed..08994e7 100644 --- a/ehist/bayesian_blocks.py +++ b/ehist/bayesian_blocks.py @@ -41,6 +41,7 @@ .. [1] https://ui.adsabs.harvard.edu/abs/2013ApJ...764..167S .. [2] https://www.astroml.org/ https://github.com//astroML/astroML/ """ + import warnings from inspect import signature diff --git a/tests/test_hist1d.py b/tests/test_hist1d.py index 0577418..41d1ecd 100644 --- a/tests/test_hist1d.py +++ b/tests/test_hist1d.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: BSD-2-Clause +import functools +import operator import unittest import numpy as np @@ -20,7 +22,7 @@ def quadratic(x, a, b, c): class TestAxis(unittest.TestCase): def test_integer(self): - v = sum([i * [i] for i in range(10)], []) + v = functools.reduce(operator.iadd, [i * [i] for i in range(10)], []) h = Hist1D(v) assert_allclose(h.N, range(1, 10)) assert_allclose(h.H, range(1, 10))