Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.10
hooks:
- id: ruff
- id: ruff-check
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
# This mypy step is not perfect; in the interest of not reproducing
Expand All @@ -28,11 +29,6 @@ repos:
- id: mypy
additional_dependencies: [attrs]

- repo: https://github.com/psf/black
rev: "25.1.0"
hooks:
- id: black

- repo: https://github.com/hukkin/mdformat
rev: 0.7.22 # Use the ref you want to point at
hooks:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ tag_regex = '^python-(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'
lint.extend-select = ["I"]
target-version = "py39"
fix = true
preview = true # enables "beta" rules: https://docs.astral.sh/ruff/preview/
line-length = 120

[tool.ruff.lint.isort]
force-single-line = true
Expand Down
1 change: 0 additions & 1 deletion python-spec/requirements-py3.12-lint.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
anndata==0.11.3
array_api_compat==1.11.1
attrs==25.1.0
black==25.1.0
cfgv==3.4.0
click==8.1.8
distlib==0.3.9
Expand Down
1 change: 0 additions & 1 deletion python-spec/src/somacore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"GeometryDataFrame",
"PointCloudDataFrame",
"BatchSize",
"IOfN",
"ResultOrder",
"AxisColumnNames",
"AxisQuery",
Expand Down
4 changes: 1 addition & 3 deletions python-spec/src/somacore/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ def __setitem__(self, key: str, value: _Elem) -> None:
"""Sets an entry into this collection. See :meth:`set` for details."""
self.set(key, value)

def set(
self, key: str, value: _Elem, *, use_relative_uri: bool | None = None
) -> Self:
def set(self, key: str, value: _Elem, *, use_relative_uri: bool | None = None) -> Self:
"""Sets an entry of this collection.

Important note: Because parent objects may need to share
Expand Down
4 changes: 1 addition & 3 deletions python-spec/src/somacore/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ def create(
"""
...

def resize(
self, newshape: Sequence[int | None], check_only: bool = False
) -> StatusAndReason:
def resize(self, newshape: Sequence[int | None], check_only: bool = False) -> StatusAndReason:
"""Increases the shape of the array as specified.

Lifecycle: maturing
Expand Down
8 changes: 2 additions & 6 deletions python-spec/src/somacore/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ class IOfN(ReadPartitions):
def _validate(self, _, __):
del _, __ # Unused.
if not 0 <= self.i < self.n:
raise ValueError(
f"Partition index {self.i} must be in the range [0, {self.n})"
)
raise ValueError(f"Partition index {self.i} must be in the range [0, {self.n})")


@attrs.define(frozen=True)
Expand Down Expand Up @@ -187,7 +185,5 @@ class ResultOrder(enum.Enum):
SparseNDCoords = Sequence[SparseNDCoord]
"""A sequence of coordinate ranges for reading sparse ndarrays."""

SpatialRegion = Union[
Sequence[int], Sequence[float], shapely.geometry.base.BaseGeometry
]
SpatialRegion = Union[Sequence[int], Sequence[float], shapely.geometry.base.BaseGeometry]
"""A spatial region used for reading spatial dataframes and multiscale images."""
7 changes: 2 additions & 5 deletions python-spec/src/somacore/query/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ def _canonicalize_coords(
return tuple(_canonicalize_coord(c) for c in in_coords)
if isinstance(in_coords, (str, bytes)):
raise TypeError(
"Query coordinates must be a normal sequence, not `str` or `bytes`."
f" Did you mean {(in_coords,)}?"
f"Query coordinates must be a normal sequence, not `str` or `bytes`. Did you mean {(in_coords,)}?"
)
raise TypeError(
f"Query coordinates must be a sequence, not a single {type(in_coords)}"
)
raise TypeError(f"Query coordinates must be a sequence, not a single {type(in_coords)}")


def _canonicalize_coord(coord: options.SparseDFCoord) -> options.SparseDFCoord:
Expand Down
8 changes: 2 additions & 6 deletions python-spec/src/somacore/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,18 +663,14 @@ def data_axis_order(self) -> tuple[str, ...]:
"""
...

def get_transform_from_level(
self, level: int | str
) -> coordinates.CoordinateTransform:
def get_transform_from_level(self, level: int | str) -> coordinates.CoordinateTransform:
"""Returns the transformation from user requested level to image reference level.

Lifecycle: experimental
"""
...

def get_transform_to_level(
self, level: int | str
) -> coordinates.CoordinateTransform:
def get_transform_to_level(self, level: int | str) -> coordinates.CoordinateTransform:
"""Returns the transformation from the image reference level to the user
requested level.

Expand Down
Loading