From ac04f93bbb982fb6eedb6b4f5db03eec1aca2a68 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 16:46:04 +0000 Subject: [PATCH 1/2] chore: update 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.11.13 → v0.16.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.16.0) - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/kynan/nbstripout: 0.8.1 → 0.9.1](https://github.com/kynan/nbstripout/compare/0.8.1...0.9.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2075a6..25b05a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.11.13" + rev: "v0.16.0" hooks: - id: ruff types_or: [python, pyi, jupyter] @@ -17,7 +17,7 @@ repos: types_or: [python, pyi, jupyter] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: '.*\.fits$' @@ -31,7 +31,7 @@ repos: args: ["--maxkb=10000"] - repo: https://github.com/kynan/nbstripout - rev: 0.8.1 + rev: 0.9.1 hooks: - id: nbstripout args: ["--extra-keys=metadata.kernelspec metadata.language_info.version metadata.toc"] From 783815ad49c641d09afa32dc357e311e963dbdba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 16:47:19 +0000 Subject: [PATCH 2/2] style: pre-commit fixes --- quantities.ipynb | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/quantities.ipynb b/quantities.ipynb index 581e51e..cfbc1dd 100755 --- a/quantities.ipynb +++ b/quantities.ipynb @@ -55,8 +55,8 @@ "metadata": {}, "outputs": [], "source": [ - "import numpy as np\n", "import matplotlib.pyplot as plt\n", + "import numpy as np\n", "\n", "# You shouldn't use the `seed` function in real science code, but we use it here for example purposes.\n", "# It makes the \"random\" number generator always give the same numbers wherever you run it.\n", @@ -161,9 +161,9 @@ "outputs": [], "source": [ "print(\n", - " \"\"\"Half light radius\n", - "value: {0}\n", - "unit: {1}\"\"\".format(Reff.value, Reff.unit)\n", + " f\"\"\"Half light radius\n", + "value: {Reff.value}\n", + "unit: {Reff.unit}\"\"\"\n", ")" ] }, @@ -181,9 +181,9 @@ "outputs": [], "source": [ "print(\n", - " \"\"\"Half light radius\n", - "value: {0.value}\n", - "unit: {0.unit}\"\"\".format(Reff)\n", + " f\"\"\"Half light radius\n", + "value: {Reff.value}\n", + "unit: {Reff.unit}\"\"\"\n", ")" ] }, @@ -200,7 +200,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(\"{0:.3g}\".format(Reff.to(u.m)))" + "print(f\"{Reff.to(u.m):.3g}\")" ] }, { @@ -228,9 +228,9 @@ "outputs": [], "source": [ "print(\n", - " \"\"\"First 10 radial velocity measurements: \n", - "{0}\n", - "{1}\"\"\".format(v[:10], v.to(u.m / u.s)[:10])\n", + " f\"\"\"First 10 radial velocity measurements: \n", + "{v[:10]}\n", + "{v.to(u.m / u.s)[:10]}\"\"\"\n", ")" ] }, @@ -282,7 +282,7 @@ "outputs": [], "source": [ "sigma = np.sqrt(np.sum((v - np.mean(v)) ** 2) / np.size(v))\n", - "print(\"Velocity dispersion: {0:.2f}\".format(sigma))" + "print(f\"Velocity dispersion: {sigma:.2f}\")" ] }, { @@ -355,10 +355,10 @@ "outputs": [], "source": [ "print(\n", - " \"\"\"Galaxy mass\n", - "in solar units: {0:.3g}\n", - "SI units: {1:.3g}\n", - "CGS units: {2:.3g}\"\"\".format(M.to(u.Msun), M.si, M.cgs)\n", + " f\"\"\"Galaxy mass\n", + "in solar units: {M.to(u.Msun):.3g}\n", + "SI units: {M.si:.3g}\n", + "CGS units: {M.cgs:.3g}\"\"\"\n", ")" ] }, @@ -562,9 +562,9 @@ "# Average velocity bin width\n", "dv = (v.max() - v.min()) / len(v)\n", "print(\n", - " \"\"\"dra = {0}\n", - "ddec = {1}\n", - "dv = {2}\"\"\".format(dra.to(u.arcsec), ddec.to(u.arcsec), dv)\n", + " f\"\"\"dra = {dra.to(u.arcsec)}\n", + "ddec = {ddec.to(u.arcsec)}\n", + "dv = {dv}\"\"\"\n", ")" ] }, @@ -607,7 +607,7 @@ " interpolation=\"nearest\",\n", " aspect=\"equal\",\n", ")\n", - "plt.colorbar().set_label(\"Intensity ({})\".format(intcloud.unit))\n", + "plt.colorbar().set_label(f\"Intensity ({intcloud.unit})\")\n", "plt.xlabel(\"RA (deg)\")\n", "plt.ylabel(\"Dec (deg)\");" ] @@ -746,7 +746,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(\"{0}\\n{1}\".format(B, B.decompose()))" + "print(f\"{B}\\n{B.decompose()}\")" ] }, {