diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54cbc5314b..0de5ca02cc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ exclude: ^doc/source/ repos: - repo: https://github.com/psf/black - rev: "24.4.2" + rev: "24.10.0" hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.5 + rev: v0.7.4 hooks: - id: ruff args: ["--config=apis/python/pyproject.toml"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.1 + rev: v1.13.0 hooks: - id: mypy additional_dependencies: diff --git a/apis/python/notebooks/tutorial_exp_query.ipynb b/apis/python/notebooks/tutorial_exp_query.ipynb index 69554d2868..53e1e977c6 100644 --- a/apis/python/notebooks/tutorial_exp_query.ipynb +++ b/apis/python/notebooks/tutorial_exp_query.ipynb @@ -53,6 +53,7 @@ "source": [ "import tarfile\n", "import tempfile\n", + "\n", "sparse_uri = tempfile.mktemp()\n", "with tarfile.open(\"data/pbmc3k-sparse.tgz\") as handle:\n", " handle.extractall(sparse_uri)\n", diff --git a/apis/python/notebooks/tutorial_soma_append_mode.ipynb b/apis/python/notebooks/tutorial_soma_append_mode.ipynb index d0117a6e74..ca5afec4f3 100644 --- a/apis/python/notebooks/tutorial_soma_append_mode.ipynb +++ b/apis/python/notebooks/tutorial_soma_append_mode.ipynb @@ -55,6 +55,7 @@ ], "source": [ "import scanpy as sc\n", + "\n", "import tiledbsoma\n", "import tiledbsoma.io\n", "import tiledbsoma.logging\n", diff --git a/apis/python/notebooks/tutorial_soma_objects.ipynb b/apis/python/notebooks/tutorial_soma_objects.ipynb index 31ae4cf3a8..de96490f03 100644 --- a/apis/python/notebooks/tutorial_soma_objects.ipynb +++ b/apis/python/notebooks/tutorial_soma_objects.ipynb @@ -67,6 +67,7 @@ "source": [ "import tarfile\n", "import tempfile\n", + "\n", "dense_uri = tempfile.mktemp()\n", "with tarfile.open(\"data/pbmc3k-dense.tgz\") as handle:\n", " handle.extractall(dense_uri)\n", @@ -1459,6 +1460,7 @@ "source": [ "import tarfile\n", "import tempfile\n", + "\n", "sparse_uri = tempfile.mktemp()\n", "with tarfile.open(\"data/pbmc3k-sparse.tgz\") as handle:\n", " handle.extractall(sparse_uri)\n", diff --git a/apis/python/notebooks/tutorial_soma_reading.ipynb b/apis/python/notebooks/tutorial_soma_reading.ipynb index 8cfe1eb2c9..7a305a0aa8 100644 --- a/apis/python/notebooks/tutorial_soma_reading.ipynb +++ b/apis/python/notebooks/tutorial_soma_reading.ipynb @@ -92,6 +92,7 @@ "source": [ "import tarfile\n", "import tempfile\n", + "\n", "sparse_uri = tempfile.mktemp()\n", "with tarfile.open(\"data/pbmc3k-sparse.tgz\") as handle:\n", " handle.extractall(sparse_uri)\n", diff --git a/apis/python/notebooks/tutorial_soma_shape.ipynb b/apis/python/notebooks/tutorial_soma_shape.ipynb index d308ca6668..80c57c3e5d 100644 --- a/apis/python/notebooks/tutorial_soma_shape.ipynb +++ b/apis/python/notebooks/tutorial_soma_shape.ipynb @@ -646,10 +646,11 @@ "metadata": {}, "outputs": [], "source": [ - "import tiledbsoma.io\n", "import tarfile\n", "import tempfile\n", "\n", + "import tiledbsoma.io\n", + "\n", "uri = tempfile.mktemp()\n", "with tarfile.open(\"data/pbmc3k-sparse-pre-1.15.tgz\") as handle:\n", " handle.extractall(uri)\n", diff --git a/apis/python/notebooks/tutorial_spatial.ipynb b/apis/python/notebooks/tutorial_spatial.ipynb index d4f58a554e..f37c110a2f 100644 --- a/apis/python/notebooks/tutorial_spatial.ipynb +++ b/apis/python/notebooks/tutorial_spatial.ipynb @@ -20,27 +20,25 @@ "metadata": {}, "outputs": [], "source": [ + "import shlex\n", "from functools import partial\n", - "import numpy as np\n", "from os import makedirs, remove\n", - "from os.path import basename, exists, join\n", - "import shlex\n", + "from os.path import exists, join\n", "from shutil import rmtree\n", "from subprocess import check_call\n", "from sys import stderr\n", - "from urllib.parse import urlparse\n", - "err = partial(print, file=stderr)\n", "\n", + "import matplotlib.patches as mplp\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", "import scanpy as sc\n", + "from matplotlib.collections import PatchCollection\n", "\n", - "from tiledbsoma.experimental import from_visium\n", - "from tiledbsoma import Experiment\n", "import tiledbsoma\n", + "from tiledbsoma import Experiment\n", + "from tiledbsoma.experimental import from_visium\n", "\n", - "import matplotlib as mpl\n", - "import matplotlib.pyplot as plt\n", - "import matplotlib.patches as mplp\n", - "from matplotlib.collections import PatchCollection" + "err = partial(print, file=stderr)\n" ] }, { diff --git a/apis/python/src/tiledbsoma/_util.py b/apis/python/src/tiledbsoma/_util.py index 1b2f8dc168..ff0ebc26a0 100644 --- a/apis/python/src/tiledbsoma/_util.py +++ b/apis/python/src/tiledbsoma/_util.py @@ -165,7 +165,8 @@ def slice_to_numeric_range( start = domain_start if slc.start is None else max(slc.start, domain_start) stop = domain_stop if slc.stop is None else min(slc.stop, domain_stop) - if stop < start: + # Lint says the left-hand and right-hand sides are both unions + if stop < start: # type: ignore[operator] # With the above, we have guaranteed that at least one bound will # include the domain. If we get here, that means that the other bound # never included it (e.g. stop == slc.stop < domain_start == start).