From cdd137655561fa099fb82ff30b6de9d355fd0874 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:15:33 +0000 Subject: [PATCH 1/3] autoupdate pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.5.0) - [github.com/pycqa/pylint: v3.1.0 → v3.2.4](https://github.com/pycqa/pylint/compare/v3.1.0...v3.2.4) - [github.com/fsfe/reuse-tool: v3.0.1 → v3.1.0a1](https://github.com/fsfe/reuse-tool/compare/v3.0.1...v3.1.0a1) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3510a62..ba0acd8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,24 +11,24 @@ repos: hooks: - id: prettier - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.5 + rev: v0.5.0 hooks: - id: ruff args: [--fix, --show-fixes] - id: ruff-format - repo: https://github.com/pycqa/pylint - rev: v3.1.0 + rev: v3.2.4 hooks: - id: pylint files: ehist args: [--ignore=E401] additional_dependencies: [numpy, matplotlib] - repo: https://github.com/fsfe/reuse-tool - rev: v3.0.1 + rev: v3.1.0a1 hooks: - id: reuse - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: From 88f5b0238d19889e08bd957fe30de83597965930 Mon Sep 17 00:00:00 2001 From: Kevin Meagher <11620178+kjmeagher@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:01:17 -0500 Subject: [PATCH 2/3] Add exception for unknown method --- .pre-commit-config.yaml | 6 +++--- ehist/hist1d.py | 3 +++ pyproject.toml | 8 ++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba0acd8..48b75ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,20 +11,20 @@ repos: hooks: - id: prettier - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 + rev: v0.6.1 hooks: - id: ruff args: [--fix, --show-fixes] - id: ruff-format - repo: https://github.com/pycqa/pylint - rev: v3.2.4 + rev: v3.2.6 hooks: - id: pylint files: ehist args: [--ignore=E401] additional_dependencies: [numpy, matplotlib] - repo: https://github.com/fsfe/reuse-tool - rev: v3.1.0a1 + rev: v4.0.3 hooks: - id: reuse - repo: https://github.com/codespell-project/codespell diff --git a/ehist/hist1d.py b/ehist/hist1d.py index 5336a11..bab76bb 100644 --- a/ehist/hist1d.py +++ b/ehist/hist1d.py @@ -265,6 +265,9 @@ def fit(self, func, p0=None, mask=None, method="points", **kwargs): ) elif method == "quad": fit = optimize.minimize(self._integrate, p0, args=(func, self.x.edges, self.N), **kwargs) + else: + msg = f"Unknown value for method: `{method}`" + raise ValueError(msg) return fit # y, yerr = self._get_hist("area") diff --git a/pyproject.toml b/pyproject.toml index f360a85..3c02b37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,15 +39,11 @@ test = ["pytest", "pytest-cov"] testpaths = ["tests"] addopts = ["--cov"] -[tool.black] -line-length = 108 -target-version = ["py38"] - [tool.pylint.messages_control] disable = "C0103,C0104,C0114,C0115,C0116,W0603,R0902,R0903,R0912,R0913,R0914,W0201,W0622" [tool.pylint.format] -max-line-length = "108" +max-line-length = "128" [tool.ruff] select = ["ALL"] @@ -61,7 +57,7 @@ ignore = [ "PLR0912", # Too many branches "ERA001", # Found commented-out code ] -line-length = 108 +line-length = 128 target-version = "py38" fixable = ["I"] From 57074870979662fa9d0029f9dd72b29657d7af38 Mon Sep 17 00:00:00 2001 From: Kevin Meagher <11620178+kjmeagher@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:19:51 -0500 Subject: [PATCH 3/3] move line length back to 108 remove pylint --- .pre-commit-config.yaml | 7 ------- ehist/bayesian_blocks.py | 1 - ehist/hist1d.py | 4 ++-- examples/plot_ehist.py | 2 +- pyproject.toml | 15 +++++---------- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48b75ca..80af8ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,13 +16,6 @@ repos: - id: ruff args: [--fix, --show-fixes] - id: ruff-format - - repo: https://github.com/pycqa/pylint - rev: v3.2.6 - hooks: - - id: pylint - files: ehist - args: [--ignore=E401] - additional_dependencies: [numpy, matplotlib] - repo: https://github.com/fsfe/reuse-tool rev: v4.0.3 hooks: diff --git a/ehist/bayesian_blocks.py b/ehist/bayesian_blocks.py index 08994e7..824a0a6 100644 --- a/ehist/bayesian_blocks.py +++ b/ehist/bayesian_blocks.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: BSD-2-Clause -# pylint: skip-file # Licensed under a 3-clause BSD style license - see LICENSE.rst """Bayesian Blocks for Time Series Analysis diff --git a/ehist/hist1d.py b/ehist/hist1d.py index bab76bb..de75caa 100644 --- a/ehist/hist1d.py +++ b/ehist/hist1d.py @@ -8,8 +8,8 @@ import numpy as np import pylab as plt -from scipy import integrate, optimize # pylint: disable=import-error -from scipy.stats import poisson # pylint: disable=import-error +from scipy import integrate, optimize +from scipy.stats import poisson from .axis import IntAxis, LogIntAxis, auto_axis from .util import HorizontalPlot, VerticalPlot, handle_weights diff --git a/examples/plot_ehist.py b/examples/plot_ehist.py index 20614fd..b74a4ae 100755 --- a/examples/plot_ehist.py +++ b/examples/plot_ehist.py @@ -8,7 +8,7 @@ import numpy as np import pylab as plt -from scipy import stats # pylint: disable=import-error +from scipy import stats from ehist import Hist1D as h1 diff --git a/pyproject.toml b/pyproject.toml index 3c02b37..e29b010 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,13 +39,11 @@ test = ["pytest", "pytest-cov"] testpaths = ["tests"] addopts = ["--cov"] -[tool.pylint.messages_control] -disable = "C0103,C0104,C0114,C0115,C0116,W0603,R0902,R0903,R0912,R0913,R0914,W0201,W0622" - -[tool.pylint.format] -max-line-length = "128" - [tool.ruff] +line-length = 108 +target-version = "py38" + +[tool.ruff.lint] select = ["ALL"] ignore = [ "D", # pydocstyle @@ -57,12 +55,9 @@ ignore = [ "PLR0912", # Too many branches "ERA001", # Found commented-out code ] -line-length = 128 -target-version = "py38" fixable = ["I"] - -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "ehist/bayesian_blocks.py" = [ "N","A","RET","EM","TRY","PLR","ISC","B","FBT" ]