Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (scverse#450)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.2.1](astral-sh/ruff-pre-commit@v0.1.14...v0.2.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed pre-commit

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Luca Marconato <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and LucaMarconato authored Feb 13, 2024
1 parent bf2a545 commit dfb000e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
additional_dependencies: [numpy, types-requests]
exclude: tests/|docs/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.2.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
13 changes: 9 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ exclude = [
"dist",
"setup.py",
]
line-length = 120
target-version = "py39"

[tool.ruff.lint]
ignore = [
# Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
"E731",
Expand All @@ -154,7 +158,6 @@ ignore = [
# Missing docstring in magic method
"D105",
]
line-length = 120
select = [
"D", # flake8-docstrings
"I", # isort
Expand All @@ -175,7 +178,10 @@ select = [
"PGH", # pygrep-hooks
]
unfixable = ["B", "C4", "UP", "BLE", "T20", "RET"]
target-version = "py39"

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.per-file-ignores]
"tests/*" = ["D", "PT", "B024"]
"*/__init__.py" = ["F401", "D104", "D107", "E402"]
Expand All @@ -188,8 +194,7 @@ target-version = "py39"
"src/spatialdata/dataloader/datasets.py" = ["D101"]
"tests/test_models/test_models.py" = ["NPY002"]
"tests/conftest.py"= ["E402"]
[tool.ruff.pydocstyle]
convention = "numpy"


# pyupgrade typing rewrite TODO: remove at some point from per-file ignore
# "UP006", "UP007"
2 changes: 1 addition & 1 deletion src/spatialdata/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
try:
from numpy.typing import DTypeLike, NDArray

ArrayLike = NDArray[np.float_]
ArrayLike = NDArray[np.float64]
except (ImportError, TypeError):
ArrayLike = np.ndarray # type: ignore[misc]
DTypeLike = np.dtype # type: ignore[misc]
Expand Down
6 changes: 2 additions & 4 deletions src/spatialdata/transformations/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ def _(e: MultiscaleSpatialImage, transformations: MappingToCoordinateSystem_t) -
dims = get_axes_names(e)
from spatialdata.transformations.transformations import Scale, Sequence

i = 0
old_shape: Optional[ArrayLike] = None
for scale, node in dict(e).items():
for i, (scale, node) in enumerate(dict(e).items()):
# this is to be sure that the pyramid levels are listed here in the correct order
assert scale == f"scale{i}"
assert len(dict(node)) == 1
Expand All @@ -135,7 +134,6 @@ def _(e: MultiscaleSpatialImage, transformations: MappingToCoordinateSystem_t) -
else:
_set_transformations_xarray(xdata, transformations)
old_shape = new_shape
i += 1


@_set_transformations.register(GeoDataFrame)
Expand Down Expand Up @@ -195,7 +193,7 @@ def _get_scale(transforms: dict[str, Any]) -> Scale:
@compute_coordinates.register(SpatialImage)
def _(data: SpatialImage) -> SpatialImage:
coords: dict[str, ArrayLike] = {
d: np.arange(data.sizes[d], dtype=np.float_) + 0.5 for d in data.sizes if d in ["x", "y", "z"]
d: np.arange(data.sizes[d], dtype=np.float64) + 0.5 for d in data.sizes if d in ["x", "y", "z"]
}
return data.assign_coords(coords)

Expand Down

0 comments on commit dfb000e

Please sign in to comment.