From 63281543ef28320881d184e564fe39bd5a20781d Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 7 Nov 2024 20:36:42 -0500 Subject: [PATCH] lint: rm `force-single-line` config --- pyproject.toml | 2 - python-spec/src/somacore/__init__.py | 41 ++++++++----------- python-spec/src/somacore/base.py | 3 +- python-spec/src/somacore/collection.py | 4 +- python-spec/src/somacore/coordinates.py | 3 +- python-spec/src/somacore/data.py | 3 +- .../src/somacore/ephemeral/__init__.py | 5 +-- .../src/somacore/ephemeral/collections.py | 20 +++++---- python-spec/src/somacore/experiment.py | 8 +--- python-spec/src/somacore/measurement.py | 5 +-- python-spec/src/somacore/query/__init__.py | 3 +- python-spec/src/somacore/query/_fast_csr.py | 3 +- python-spec/src/somacore/query/axis.py | 3 +- python-spec/src/somacore/query/query.py | 8 +--- python-spec/src/somacore/scene.py | 6 +-- python-spec/src/somacore/spatial.py | 5 +-- python-spec/testing/test_coordinates.py | 16 ++++---- python-spec/testing/test_mixin.py | 3 +- 18 files changed, 53 insertions(+), 88 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b3f31e2a..f1cbbd07 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 a8149086..0e20220a 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 8d6198f4..0bca0b54 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 8ff2877e..7333bfb9 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 bf0d1c79..d58cdf97 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 e0220c7e..fb02482e 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 932f63f1..17c4f7ad 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 68a224d1..fe73cac7 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 fbdcb517..b064de46 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 af3c9392..4370435d 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 41598d9a..eef01769 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 99a784d4..2e4c908f 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 7ae660e8..109bd1fa 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 08d6b6f0..74674511 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 a849bbfb..069de18b 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 03731077..727929c4 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 e2cb2f75..e2336414 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 6da3b2ad..60aa2d54 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):