From 4241f70ca1ef027e406717dc9dc0781ef2300072 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 20:55:12 +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/psf/black-pre-commit-mirror: 24.2.0 → 24.8.0](https://github.com/psf/black-pre-commit-mirror/compare/24.2.0...24.8.0) - [github.com/adamchainz/blacken-docs: 1.16.0 → 1.18.0](https://github.com/adamchainz/blacken-docs/compare/1.16.0...1.18.0) - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/astral-sh/ruff-pre-commit: v0.3.2 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.2...v0.6.2) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) - [github.com/abravalheri/validate-pyproject: v0.16 → v0.19](https://github.com/abravalheri/validate-pyproject/compare/v0.16...v0.19) - [github.com/python-jsonschema/check-jsonschema: 0.28.0 → 0.29.2](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.0...0.29.2) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fde4fd5..0379d5e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,18 +5,18 @@ ci: repos: - repo: https://github.com/psf/black-pre-commit-mirror - rev: "24.2.0" + rev: "24.8.0" hooks: - id: black-jupyter - repo: https://github.com/adamchainz/blacken-docs - rev: "1.16.0" + rev: "1.18.0" hooks: - id: blacken-docs additional_dependencies: [black==23.*] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -49,7 +49,7 @@ repos: args: [--prose-wrap=always] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.2" + rev: "v0.6.2" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -65,7 +65,7 @@ repos: # - pytest - repo: https://github.com/codespell-project/codespell - rev: "v2.2.6" + rev: "v2.3.0" hooks: - id: codespell additional_dependencies: @@ -92,12 +92,12 @@ repos: exclude: .pre-commit-config.yaml - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.16 + rev: v0.19 hooks: - id: validate-pyproject - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.0 + rev: 0.29.2 hooks: - id: check-dependabot - id: check-github-workflows From 3ee0600d6130fd5e189372674db22c964e9b3a02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 20:55:25 +0000 Subject: [PATCH 2/2] style: pre-commit fixes --- notebooks/IO tests.ipynb | 17 ++++++------ notebooks/Stream-data-pipeline.ipynb | 12 ++++----- notebooks/Stream-subset-Gaia-data.ipynb | 11 ++++---- notebooks/Testing_Isochrones.ipynb | 36 +++++++++++-------------- 4 files changed, 33 insertions(+), 43 deletions(-) diff --git a/notebooks/IO tests.ipynb b/notebooks/IO tests.ipynb index 24e3e18..109a696 100644 --- a/notebooks/IO tests.ipynb +++ b/notebooks/IO tests.ipynb @@ -7,10 +7,12 @@ "metadata": {}, "outputs": [], "source": [ - "import astropy.table as apt\n", + "from __future__ import annotations\n", + "\n", "import asdf\n", - "from astropy.coordinates import SkyCoord\n", - "import astropy.units as u" + "import astropy.table as apt\n", + "import astropy.units as u\n", + "from astropy.coordinates import SkyCoord" ] }, { @@ -242,14 +244,11 @@ "metadata": {}, "outputs": [], "source": [ - "import galstreams as gst\n", - "from matplotlib.path import Path as mpl_path\n", - "from astropy.table import Table\n", "import asdf\n", "import astropy.units as u\n", - "from astropy.coordinates import SkyCoord\n", - "from gala.coordinates import GreatCircleICRSFrame\n", - "import numpy as np" + "import galstreams as gst\n", + "import numpy as np\n", + "from astropy.coordinates import SkyCoord" ] }, { diff --git a/notebooks/Stream-data-pipeline.ipynb b/notebooks/Stream-data-pipeline.ipynb index 3929549..0135e9f 100644 --- a/notebooks/Stream-data-pipeline.ipynb +++ b/notebooks/Stream-data-pipeline.ipynb @@ -12,21 +12,19 @@ }, "outputs": [], "source": [ + "from __future__ import annotations\n", + "\n", "import astropy.coordinates as coord\n", "import astropy.table as at\n", "import astropy.units as u\n", - "import matplotlib as mpl\n", - "import matplotlib.pyplot as plt\n", "\n", "%matplotlib inline\n", - "import numpy as np\n", - "import scipy.interpolate as sci\n", "\n", - "import gala.coordinates as gc\n", - "from pyia import GaiaData\n", - "import galstreams\n", "import sys\n", "\n", + "import galstreams\n", + "from pyia import GaiaData\n", + "\n", "sys.path.append(\"../\")\n", "import cats.photometry as phot\n", "from cats.data import make_astro_photo_joined_data" diff --git a/notebooks/Stream-subset-Gaia-data.ipynb b/notebooks/Stream-subset-Gaia-data.ipynb index 8e67cee..d657c6c 100644 --- a/notebooks/Stream-subset-Gaia-data.ipynb +++ b/notebooks/Stream-subset-Gaia-data.ipynb @@ -26,24 +26,23 @@ } ], "source": [ + "from __future__ import annotations\n", + "\n", "import pathlib\n", "import warnings\n", "\n", "import astropy.coordinates as coord\n", "import astropy.table as at\n", - "from astropy.io import fits\n", "import astropy.units as u\n", - "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", + "from astropy.io import fits\n", "\n", "%matplotlib inline\n", - "from tqdm import tqdm\n", - "from scipy.interpolate import InterpolatedUnivariateSpline\n", - "\n", "import galstreams\n", + "from astroquery.gaia import Gaia\n", "from pyia import GaiaData\n", - "from astroquery.gaia import Gaia" + "from scipy.interpolate import InterpolatedUnivariateSpline" ] }, { diff --git a/notebooks/Testing_Isochrones.ipynb b/notebooks/Testing_Isochrones.ipynb index ab9538e..74ff34f 100644 --- a/notebooks/Testing_Isochrones.ipynb +++ b/notebooks/Testing_Isochrones.ipynb @@ -15,13 +15,16 @@ "metadata": {}, "outputs": [], "source": [ + "from __future__ import annotations\n", + "\n", "try:\n", + " from urllib.error import URLError\n", " from urllib.parse import urlencode\n", " from urllib.request import urlopen\n", - " from urllib.error import URLError\n", "except ImportError:\n", " from urllib import urlencode\n", - " from urllib2 import urlopen, URLError" + "\n", + " from urllib2 import URLError, urlopen" ] }, { @@ -31,34 +34,28 @@ "metadata": {}, "outputs": [], "source": [ - "from urllib.parse import urlencode\n", - "from urllib.request import urlopen\n", - "from urllib.error import URLError\n", - "\n", - "import os\n", - "import sys\n", - "import glob\n", "import copy\n", "from collections import OrderedDict as odict\n", + "from urllib.error import URLError\n", + "from urllib.parse import urlencode\n", + "from urllib.request import urlopen\n", "\n", "# For downloading isochrones...\n", "try:\n", + " from urllib.error import URLError\n", " from urllib.parse import urlencode\n", " from urllib.request import urlopen\n", - " from urllib.error import URLError\n", "except ImportError:\n", " from urllib import urlencode\n", - " from urllib2 import urlopen, URLError\n", "\n", - "import subprocess\n", + " from urllib2 import urlopen\n", + "\n", "import re\n", + "import subprocess\n", "\n", "import numpy as np\n", "import scipy.spatial\n", - "\n", - "from ugali.utils.logger import logger\n", - "from ugali.isochrone.model import Isochrone\n", - "from ugali.isochrone.model import get_iso_dir" + "from ugali.utils.logger import logger" ] }, { @@ -317,7 +314,7 @@ "metadata": {}, "outputs": [], "source": [ - "out = \"{0}/tmp/{1}.dat\".format(server, fname[0])\n", + "out = f\"{server}/tmp/{fname[0]}.dat\"\n", "\n", "cmd = \"wget --progress dot:binary %s -O %s\" % (out, outfile)\n", "logger.debug(cmd)\n", @@ -475,9 +472,7 @@ "id": "179f7696", "metadata": {}, "outputs": [], - "source": [ - "import isochrones" - ] + "source": [] }, { "cell_type": "code", @@ -1013,7 +1008,6 @@ "source": [ "import numpy as np\n", "import scipy\n", - "from scipy.interpolate import interp1d\n", "\n", "age, feh, eep, dist = [10, -1.4, None, 10]\n", "\n",