diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e228775f..b4a7afee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: # Ruff linter and formatter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.8.3' + rev: 'v0.9.4' hooks: - id: ruff args: [--fix, --show-fixes] @@ -42,7 +42,7 @@ repos: # C++ formatting - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v19.1.5 + rev: v19.1.7 hooks: - id: clang-format files: "src" @@ -58,7 +58,7 @@ repos: # Python type checking - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.13.0' + rev: 'v1.14.1' hooks: - id: mypy additional_dependencies: [numpy] @@ -73,11 +73,11 @@ repos: args: [--drop-empty-cells] - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.30.0 + rev: 0.31.1 hooks: - id: check-github-workflows - repo: https://github.com/henryiii/validate-pyproject-schema-store - rev: 2024.11.25 + rev: 2025.02.03 hooks: - id: validate-pyproject diff --git a/bench/plot.ipynb b/bench/plot.ipynb index 312b191f..81f562f1 100644 --- a/bench/plot.ipynb +++ b/bench/plot.ipynb @@ -5255,8 +5255,8 @@ "print(\n", " f\"\"\"\\\n", "benchmark results\n", - " {data['datetime']}\n", - " {data['machine_info']['cpu']['brand_raw']}\n", + " {data[\"datetime\"]}\n", + " {data[\"machine_info\"][\"cpu\"][\"brand_raw\"]}\n", "\"\"\"\n", ")\n", "\n", diff --git a/doc/notebooks/automatic_differentiation.ipynb b/doc/notebooks/automatic_differentiation.ipynb index 56bca718..3356a6bb 100644 --- a/doc/notebooks/automatic_differentiation.ipynb +++ b/doc/notebooks/automatic_differentiation.ipynb @@ -1614,7 +1614,7 @@ "y = -np.arange(len(times))\n", "plt.barh(y, x)\n", "for yi, k, v in zip(y, times, x):\n", - " plt.text(v, yi, f\"{v/xmin:.1f}x\")\n", + " plt.text(v, yi, f\"{v / xmin:.1f}x\")\n", "plt.yticks(y, times.keys())\n", "for loc in (\"top\", \"right\"):\n", " plt.gca().spines[loc].set_visible(False)\n", @@ -3886,7 +3886,7 @@ "# check fit quality\n", "chi2 = m.fval\n", "ndof = len(data_y) - 3\n", - "plt.title(f\"$\\\\chi^2 / n_\\\\mathrm{{dof}} = {chi2:.2f} / {ndof} = {chi2/ndof:.2f}$\");" + "plt.title(f\"$\\\\chi^2 / n_\\\\mathrm{{dof}} = {chi2:.2f} / {ndof} = {chi2 / ndof:.2f}$\");" ] }, { diff --git a/doc/notebooks/binned_vs_unbinned.ipynb b/doc/notebooks/binned_vs_unbinned.ipynb index 97781492..904890b4 100644 --- a/doc/notebooks/binned_vs_unbinned.ipynb +++ b/doc/notebooks/binned_vs_unbinned.ipynb @@ -10286,7 +10286,7 @@ "y = [v[2] for v in results.values()]\n", "plt.plot(x, y, \"o\")\n", "for xi, yi in zip(x[1:], y[1:]):\n", - " plt.text(xi, yi * 1.2, f\"{y[0]/yi:.0f}x\", ha=\"center\")\n", + " plt.text(xi, yi * 1.2, f\"{y[0] / yi:.0f}x\", ha=\"center\")\n", "plt.xticks(x, [f\"{x}\" for x in results.keys()])\n", "plt.ylabel(\"time / sec\")\n", "plt.semilogy();" diff --git a/doc/notebooks/numba.ipynb b/doc/notebooks/numba.ipynb index f1ae721c..f4142e0e 100644 --- a/doc/notebooks/numba.ipynb +++ b/doc/notebooks/numba.ipynb @@ -2232,7 +2232,7 @@ "source": [ "for signature, code in norm_pdf.inspect_asm().items():\n", " print(\n", - " f\"signature: {signature}\\n{'-'*(len(str(signature)) + 11)}\\n{code[:1000]}\\n[...]\"\n", + " f\"signature: {signature}\\n{'-' * (len(str(signature)) + 11)}\\n{code[:1000]}\\n[...]\"\n", " )" ] }, @@ -2283,7 +2283,7 @@ "from collections import Counter\n", "\n", "for signature, code in norm_pdf.inspect_asm().items():\n", - " print(f\"signature: {signature}\\n{'-'*(len(str(signature)) + 11)}\")\n", + " print(f\"signature: {signature}\\n{'-' * (len(str(signature)) + 11)}\")\n", " instructions = []\n", " for line in code.split(\"\\n\"):\n", " instr = line.strip().split(\"\\t\")[0]\n", diff --git a/doc/notebooks/weighted_histograms.ipynb b/doc/notebooks/weighted_histograms.ipynb index 3f0db66e..d828dd55 100644 --- a/doc/notebooks/weighted_histograms.ipynb +++ b/doc/notebooks/weighted_histograms.ipynb @@ -6927,13 +6927,13 @@ " lambd1,\n", " bins=20,\n", " alpha=0.5,\n", - " label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1)*100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.2f}\",\n", + " label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1) * 100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.2f}\",\n", ")\n", "plt.hist(\n", " lambd2,\n", " bins=20,\n", " alpha=0.5,\n", - " label=f\"BinnedNLL\\nvalid={np.mean(valid2)*100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.2f}\",\n", + " label=f\"BinnedNLL\\nvalid={np.mean(valid2) * 100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.2f}\",\n", ")\n", "plt.legend()\n", "\n", @@ -9187,7 +9187,7 @@ "x = np.linspace(0, 100)\n", "plt.plot(x, chi2(bins - 2).pdf(x))\n", "plt.title(\n", - " f\"ExtendedBinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n", + " f\"ExtendedBinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n", ")\n", "\n", "plt.sca(ax[1])\n", @@ -9195,7 +9195,7 @@ "x = np.linspace(0, 100)\n", "plt.plot(x, chi2(bins - 2).pdf(x))\n", "plt.title(\n", - " f\"BinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n", + " f\"BinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n", ");" ] }, @@ -11951,13 +11951,13 @@ " lambd1,\n", " bins=20,\n", " alpha=0.5,\n", - " label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1)*100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.3f}\",\n", + " label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1) * 100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.3f}\",\n", ")\n", "plt.hist(\n", " lambd2,\n", " bins=20,\n", " alpha=0.5,\n", - " label=f\"BinnedNLL\\nvalid={np.mean(valid2)*100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.3f}\",\n", + " label=f\"BinnedNLL\\nvalid={np.mean(valid2) * 100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.3f}\",\n", ")\n", "plt.legend()\n", "\n", @@ -14031,7 +14031,7 @@ "x = np.linspace(0, 100)\n", "plt.plot(x, chi2(bins - 2).pdf(x))\n", "plt.title(\n", - " f\"ExtendedBinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n", + " f\"ExtendedBinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n", ")\n", "\n", "plt.sca(ax[1])\n", @@ -14039,7 +14039,7 @@ "x = np.linspace(0, 100)\n", "plt.plot(x, chi2(bins - 2).pdf(x))\n", "plt.title(\n", - " f\"BinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n", + " f\"BinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n", ");" ] }, diff --git a/tests/test_cost.py b/tests/test_cost.py index c04ab141..5fb0c72d 100644 --- a/tests/test_cost.py +++ b/tests/test_cost.py @@ -904,8 +904,7 @@ def cdf(r, mx, my, mz, sx, sy, sz): with pytest.raises( ValueError, match=( - 'use_pdf="numerical" is not supported ' - "for multidimensional histograms" + 'use_pdf="numerical" is not supported for multidimensional histograms' ), ): BinnedNLL(n, xe, pdf, use_pdf=use_pdf)