diff --git a/pyproject.toml b/pyproject.toml index b3f31e2..f1cbbd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,9 +48,7 @@ target-version = "py39" fix = true [tool.ruff.lint.isort] -force-single-line = true known-first-party = ["somacore"] -single-line-exclusions = ["typing", "typing_extensions"] [tool.mypy] check_untyped_defs = true diff --git a/python-spec/src/somacore/__init__.py b/python-spec/src/somacore/__init__.py index a814908..0e20220 100644 --- a/python-spec/src/somacore/__init__.py +++ b/python-spec/src/somacore/__init__.py @@ -16,32 +16,27 @@ from .base import SOMAObject from .collection import Collection -from .coordinates import AffineTransform -from .coordinates import Axis -from .coordinates import CoordinateSpace -from .coordinates import CoordinateTransform -from .coordinates import IdentityTransform -from .coordinates import ScaleTransform -from .coordinates import UniformScaleTransform -from .data import DataFrame -from .data import DenseNDArray -from .data import NDArray -from .data import ReadIter -from .data import SparseNDArray -from .data import SparseRead +from .coordinates import ( + AffineTransform, + Axis, + CoordinateSpace, + CoordinateTransform, + IdentityTransform, + ScaleTransform, + UniformScaleTransform, +) +from .data import DataFrame, DenseNDArray, NDArray, ReadIter, SparseNDArray, SparseRead from .experiment import Experiment from .measurement import Measurement -from .options import BatchSize -from .options import IOfN -from .options import ResultOrder -from .query import AxisColumnNames -from .query import AxisQuery -from .query import ExperimentAxisQuery +from .options import BatchSize, IOfN, ResultOrder +from .query import AxisColumnNames, AxisQuery, ExperimentAxisQuery from .scene import Scene -from .spatial import GeometryDataFrame -from .spatial import MultiscaleImage -from .spatial import PointCloudDataFrame -from .spatial import SpatialRead +from .spatial import ( + GeometryDataFrame, + MultiscaleImage, + PointCloudDataFrame, + SpatialRead, +) from .types import ContextBase try: diff --git a/python-spec/src/somacore/base.py b/python-spec/src/somacore/base.py index 8d6198f..0bca0b5 100644 --- a/python-spec/src/somacore/base.py +++ b/python-spec/src/somacore/base.py @@ -9,8 +9,7 @@ from typing_extensions import LiteralString, Self -from . import options -from . import types +from . import options, types class SOMAObject(metaclass=abc.ABCMeta): diff --git a/python-spec/src/somacore/collection.py b/python-spec/src/somacore/collection.py index 8ff2877..7333bfb 100644 --- a/python-spec/src/somacore/collection.py +++ b/python-spec/src/somacore/collection.py @@ -13,9 +13,7 @@ import pyarrow as pa from typing_extensions import Final, Self -from . import base -from . import data -from . import options +from . import base, data, options _Elem = TypeVar("_Elem", bound=base.SOMAObject) """Element Type for a SOMA collection.""" diff --git a/python-spec/src/somacore/coordinates.py b/python-spec/src/somacore/coordinates.py index bf0d1c7..d58cdf9 100644 --- a/python-spec/src/somacore/coordinates.py +++ b/python-spec/src/somacore/coordinates.py @@ -10,8 +10,7 @@ import numpy.typing as npt from typing_extensions import Self -from .types import str_or_seq_length -from .types import to_string_tuple +from .types import str_or_seq_length, to_string_tuple @attrs.define(frozen=True) diff --git a/python-spec/src/somacore/data.py b/python-spec/src/somacore/data.py index e0220c7..fb02482 100644 --- a/python-spec/src/somacore/data.py +++ b/python-spec/src/somacore/data.py @@ -21,8 +21,7 @@ import pyarrow as pa from typing_extensions import Final, Literal, Self -from . import base -from . import options +from . import base, options _RO_AUTO = options.ResultOrder.AUTO diff --git a/python-spec/src/somacore/ephemeral/__init__.py b/python-spec/src/somacore/ephemeral/__init__.py index 932f63f..17c4f7a 100644 --- a/python-spec/src/somacore/ephemeral/__init__.py +++ b/python-spec/src/somacore/ephemeral/__init__.py @@ -5,10 +5,7 @@ Collection. """ -from .collections import Collection -from .collections import Experiment -from .collections import Measurement -from .collections import Scene +from .collections import Collection, Experiment, Measurement, Scene __all__ = ( "Collection", diff --git a/python-spec/src/somacore/ephemeral/collections.py b/python-spec/src/somacore/ephemeral/collections.py index 68a224d..fe73cac 100644 --- a/python-spec/src/somacore/ephemeral/collections.py +++ b/python-spec/src/somacore/ephemeral/collections.py @@ -9,15 +9,17 @@ from typing_extensions import Literal, Self -from .. import base -from .. import collection -from .. import coordinates -from .. import data -from .. import experiment -from .. import measurement -from .. import options -from .. import scene -from .. import spatial +from .. import ( + base, + collection, + coordinates, + data, + experiment, + measurement, + options, + scene, + spatial, +) _Elem = TypeVar("_Elem", bound=base.SOMAObject) diff --git a/python-spec/src/somacore/experiment.py b/python-spec/src/somacore/experiment.py index fbdcb51..b064de4 100644 --- a/python-spec/src/somacore/experiment.py +++ b/python-spec/src/somacore/experiment.py @@ -2,13 +2,7 @@ from typing_extensions import Final, Self -from . import _mixin -from . import base -from . import collection -from . import data -from . import measurement -from . import query -from . import scene +from . import _mixin, base, collection, data, measurement, query, scene _DF = TypeVar("_DF", bound=data.DataFrame) """An implementation of a DataFrame.""" diff --git a/python-spec/src/somacore/measurement.py b/python-spec/src/somacore/measurement.py index af3c939..4370435 100644 --- a/python-spec/src/somacore/measurement.py +++ b/python-spec/src/somacore/measurement.py @@ -4,10 +4,7 @@ from typing_extensions import Final -from . import _mixin -from . import base -from . import collection -from . import data +from . import _mixin, base, collection, data _DF = TypeVar("_DF", bound=data.DataFrame) """A particular implementation of DataFrame.""" diff --git a/python-spec/src/somacore/query/__init__.py b/python-spec/src/somacore/query/__init__.py index 41598d9..eef0176 100644 --- a/python-spec/src/somacore/query/__init__.py +++ b/python-spec/src/somacore/query/__init__.py @@ -1,5 +1,4 @@ -from . import axis -from . import query +from . import axis, query ExperimentAxisQuery = query.ExperimentAxisQuery AxisColumnNames = query.AxisColumnNames diff --git a/python-spec/src/somacore/query/_fast_csr.py b/python-spec/src/somacore/query/_fast_csr.py index 99a784d..2e4c908 100644 --- a/python-spec/src/somacore/query/_fast_csr.py +++ b/python-spec/src/somacore/query/_fast_csr.py @@ -10,8 +10,7 @@ from scipy import sparse from .. import data as scd -from . import _eager_iter -from . import types +from . import _eager_iter, types def read_csr( diff --git a/python-spec/src/somacore/query/axis.py b/python-spec/src/somacore/query/axis.py index 7ae660e..109bd1f 100644 --- a/python-spec/src/somacore/query/axis.py +++ b/python-spec/src/somacore/query/axis.py @@ -4,8 +4,7 @@ import numpy as np import pyarrow as pa -from .. import options -from .. import types +from .. import options, types def _canonicalize_coords( diff --git a/python-spec/src/somacore/query/query.py b/python-spec/src/somacore/query/query.py index 08d6b6f..7467451 100644 --- a/python-spec/src/somacore/query/query.py +++ b/python-spec/src/somacore/query/query.py @@ -25,13 +25,9 @@ from scipy import sparse from typing_extensions import Literal, Protocol, Self, TypedDict -from .. import data -from .. import measurement -from .. import options +from .. import data, measurement, options from .. import types as base_types -from . import _fast_csr -from . import axis -from . import types +from . import _fast_csr, axis, types _RO_AUTO = options.ResultOrder.AUTO diff --git a/python-spec/src/somacore/scene.py b/python-spec/src/somacore/scene.py index a849bbf..069de18 100644 --- a/python-spec/src/somacore/scene.py +++ b/python-spec/src/somacore/scene.py @@ -5,11 +5,7 @@ from typing_extensions import Final -from . import _mixin -from . import base -from . import collection -from . import coordinates -from . import spatial +from . import _mixin, base, collection, coordinates, spatial _MultiscaleImage = TypeVar("_MultiscaleImage", bound=spatial.MultiscaleImage) """A particular implementation of a multiscale image.""" diff --git a/python-spec/src/somacore/spatial.py b/python-spec/src/somacore/spatial.py index 0373107..727929c 100644 --- a/python-spec/src/somacore/spatial.py +++ b/python-spec/src/somacore/spatial.py @@ -16,10 +16,7 @@ import pyarrow as pa from typing_extensions import Final, Self -from . import base -from . import coordinates -from . import data -from . import options +from . import base, coordinates, data, options _DenseND = TypeVar("_DenseND", bound=data.DenseNDArray) """A particular implementation of a collection of DenseNDArrays.""" diff --git a/python-spec/testing/test_coordinates.py b/python-spec/testing/test_coordinates.py index e2cb2f7..e233641 100644 --- a/python-spec/testing/test_coordinates.py +++ b/python-spec/testing/test_coordinates.py @@ -1,13 +1,15 @@ import numpy as np import pytest -from somacore import AffineTransform -from somacore import Axis -from somacore import CoordinateSpace -from somacore import CoordinateTransform -from somacore import IdentityTransform -from somacore import ScaleTransform -from somacore import UniformScaleTransform +from somacore import ( + AffineTransform, + Axis, + CoordinateSpace, + CoordinateTransform, + IdentityTransform, + ScaleTransform, + UniformScaleTransform, +) def check_transform_is_equal( diff --git a/python-spec/testing/test_mixin.py b/python-spec/testing/test_mixin.py index 6da3b2a..60aa2d5 100644 --- a/python-spec/testing/test_mixin.py +++ b/python-spec/testing/test_mixin.py @@ -1,7 +1,6 @@ import unittest -from somacore import _mixin -from somacore import ephemeral +from somacore import _mixin, ephemeral class TestItem(unittest.TestCase):