Skip to content

Commit 3e773e3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4727e83 commit 3e773e3

File tree

11 files changed

+37
-33
lines changed

11 files changed

+37
-33
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ Marconato, L., Palla, G., Yamauchi, K.A. et al. SpatialData: an open and univers
111111
[link-docs]: https://spatialdata.scverse.org/projects/io/en/latest/
112112
[link-api]: https://spatialdata.scverse.org/projects/io/en/latest/api.html
113113
[link-cli]: https://spatialdata.scverse.org/projects/io/en/latest/cli.html
114-
115-
[//]: # (numfocus-fiscal-sponsor-attribution)
114+
[//]: # "numfocus-fiscal-sponsor-attribution"
116115

117116
spatialdata-io is part of the scverse® project ([website](https://scverse.org), [governance](https://scverse.org/about/roles)) and is fiscally sponsored by [NumFOCUS](https://numfocus.org/).
118117
If you like scverse® and want to support our mission, please consider making a tax-deductible [donation](https://numfocus.org/donate-to-scverse) to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.

docs/extensions/typed_returns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def _process_return(lines):
1111
m = re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
1212
if m:
1313
# Once this is in scanpydoc, we can use the fancy hover stuff
14-
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
14+
yield f"-{m['param']} (:class:`~{m['type']}`)"
1515
else:
1616
yield line
1717

src/spatialdata_io/_constants/_enum.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def wrapper(*args: Any, **kwargs: Any) -> "ErrorFormatterABC":
4242
class ABCEnumMeta(EnumMeta, ABCMeta):
4343
def __call__(cls, *args: Any, **kwargs: Any) -> Any:
4444
if getattr(cls, "__error_format__", None) is None:
45-
raise TypeError(f"Can't instantiate class `{cls.__name__}` " f"without `__error_format__` class attribute.")
45+
raise TypeError(f"Can't instantiate class `{cls.__name__}` without `__error_format__` class attribute.")
4646
return super().__call__(*args, **kwargs)
4747

4848
def __new__(cls, clsname: str, superclasses: tuple[type], attributedict: dict[str, Any]) -> "ABCEnumMeta":
@@ -59,7 +59,9 @@ class ErrorFormatterABC(ABC):
5959
@classmethod
6060
def _format(cls, value: Enum) -> str:
6161
return cls.__error_format__.format(
62-
value, cls.__name__, [m.value for m in cls.__members__.values()] # type: ignore[attr-defined]
62+
value,
63+
cls.__name__,
64+
[m.value for m in cls.__members__.values()], # type: ignore[attr-defined]
6365
)
6466

6567

src/spatialdata_io/converters/legacy_anndata.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def to_legacy_anndata(
113113
assert len(css) == 1, "The SpatialData object has more than one coordinate system. Please specify one."
114114
coordinate_system = css[0]
115115
else:
116-
assert (
117-
coordinate_system in css
118-
), f"The SpatialData object does not have the coordinate system {coordinate_system}."
116+
assert coordinate_system in css, (
117+
f"The SpatialData object does not have the coordinate system {coordinate_system}."
118+
)
119119
sdata = sdata.filter_by_coordinate_system(coordinate_system)
120120

121121
if table_name is None:
@@ -288,9 +288,9 @@ def from_legacy_anndata(adata: AnnData) -> SpatialData:
288288
# construct the spatialdata elements
289289
if hires is not None:
290290
# prepare the hires image
291-
assert (
292-
tissue_hires_scalef is not None
293-
), "tissue_hires_scalef is required when an the hires image is present"
291+
assert tissue_hires_scalef is not None, (
292+
"tissue_hires_scalef is required when an the hires image is present"
293+
)
294294
hires_image = Image2DModel.parse(
295295
hires, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_hires": Identity()}
296296
)
@@ -301,9 +301,9 @@ def from_legacy_anndata(adata: AnnData) -> SpatialData:
301301
shapes_transformations[f"{dataset_id}_downscaled_hires"] = scale_hires
302302
if lowres is not None:
303303
# prepare the lowres image
304-
assert (
305-
tissue_lowres_scalef is not None
306-
), "tissue_lowres_scalef is required when an the lowres image is present"
304+
assert tissue_lowres_scalef is not None, (
305+
"tissue_lowres_scalef is required when an the lowres image is present"
306+
)
307307
lowres_image = Image2DModel.parse(
308308
lowres, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_lowres": Identity()}
309309
)

src/spatialdata_io/readers/_utils/_read_10x_h5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _read_10x_h5(
8484
if genome not in adata.var["genome"].values:
8585
raise ValueError(
8686
f"Could not find data corresponding to genome `{genome}` in `{filename}`. "
87-
f'Available genomes are: {list(adata.var["genome"].unique())}.'
87+
f"Available genomes are: {list(adata.var['genome'].unique())}."
8888
)
8989
adata = adata[:, adata.var["genome"] == genome]
9090
if gex_only:

src/spatialdata_io/readers/dbit.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,16 @@ def dbit(
279279

280280
# search for files paths. Gives priority to files matching the pattern found in path.
281281
anndata_path_checked = _check_path(
282-
path=path, path_specific=anndata_path, pattern=patt_h5ad, key=DbitKeys.COUNTS_FILE # type: ignore
282+
path=path,
283+
path_specific=anndata_path,
284+
pattern=patt_h5ad,
285+
key=DbitKeys.COUNTS_FILE, # type: ignore
283286
)[0]
284287
barcode_position_checked = _check_path(
285-
path=path, path_specific=barcode_position, pattern=patt_barcode, key=DbitKeys.BARCODE_POSITION # type: ignore
288+
path=path,
289+
path_specific=barcode_position,
290+
pattern=patt_barcode,
291+
key=DbitKeys.BARCODE_POSITION, # type: ignore
286292
)[0]
287293
image_path_checked, hasimage = _check_path(
288294
path=path, # type: ignore

src/spatialdata_io/readers/merscope.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def _get_file_paths(path: Path, vpt_outputs: Path | str | dict[str, Any] | None)
5858
]
5959
valid_boundaries = [path for path in plausible_boundaries if path.exists()]
6060

61-
assert (
62-
valid_boundaries
63-
), f"Boundary file not found - expected to find one of these files: {', '.join(map(str, plausible_boundaries))}"
61+
assert valid_boundaries, (
62+
f"Boundary file not found - expected to find one of these files: {', '.join(map(str, plausible_boundaries))}"
63+
)
6464

6565
return (
6666
vpt_outputs / MerscopeKeys.COUNTS_FILE,
@@ -160,9 +160,9 @@ def merscope(
160160
assert isinstance(image_models_kwargs, dict)
161161
image_models_kwargs["scale_factors"] = [2, 2, 2, 2]
162162

163-
assert (
164-
backend is None or backend in SUPPORTED_BACKENDS
165-
), f"Backend '{backend} not supported. Should be one of: {', '.join(SUPPORTED_BACKENDS)}"
163+
assert backend is None or backend in SUPPORTED_BACKENDS, (
164+
f"Backend '{backend} not supported. Should be one of: {', '.join(SUPPORTED_BACKENDS)}"
165+
)
166166

167167
path = Path(path).absolute()
168168
count_path, obs_path, boundaries_path = _get_file_paths(path, vpt_outputs)

src/spatialdata_io/readers/seqfish.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ def get_transcript_file(roi: str) -> str:
200200
points = {}
201201
if load_points:
202202
for x in rois_str:
203-
204203
# prepare data
205204
name = f"{os.path.splitext(get_transcript_file(x))[0]}"
206205
p = pd.read_csv(path / get_transcript_file(x), delimiter=",")

src/spatialdata_io/readers/steinbock.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def steinbock(
5858
labels = {}
5959
if len(set(samples).difference(set(samples_labels))):
6060
logger.warning(
61-
f"Samples {set(samples).difference(set(samples_labels))} have images but no labels. "
62-
"They will be ignored."
61+
f"Samples {set(samples).difference(set(samples_labels))} have images but no labels. They will be ignored."
6362
)
6463
for sample in samples:
6564
images[f"{sample}_image"] = _get_images(

src/spatialdata_io/readers/visium_hd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ def _load_image(
479479
if data.shape[-1] == 3: # HE image in RGB format
480480
data = data.transpose(2, 0, 1)
481481
else:
482-
assert data.shape[0] == min(
483-
data.shape
484-
), "When the image is not in RGB, the first dimension should be the number of channels."
482+
assert data.shape[0] == min(data.shape), (
483+
"When the image is not in RGB, the first dimension should be the number of channels."
484+
)
485485

486486
image = DataArray(data, dims=("c", "y", "x"))
487487
parsed = Image2DModel.parse(image, scale_factors=scale_factors, rgb=None, **image_models_kwargs)

src/spatialdata_io/readers/xenium.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ def filter(self, record: logging.LogRecord) -> bool:
324324
logger = tifffile.logger()
325325
logger.addFilter(IgnoreSpecificMessage())
326326
image_models_kwargs = dict(image_models_kwargs)
327-
assert (
328-
"c_coords" not in image_models_kwargs
329-
), "The channel names for the morphology focus images are handled internally"
327+
assert "c_coords" not in image_models_kwargs, (
328+
"The channel names for the morphology focus images are handled internally"
329+
)
330330
image_models_kwargs["c_coords"] = list(channel_names.values())
331331
images["morphology_focus"] = _get_images(
332332
morphology_focus_dir,
@@ -731,7 +731,6 @@ def _parse_version_of_xenium_analyzer(
731731
specs: dict[str, Any],
732732
hide_warning: bool = True,
733733
) -> packaging.version.Version | None:
734-
735734
# After using xeniumranger (e.g. 3.0.1.1) to resegment data from previous versions (e.g. xenium-1.6.0.7), a new dict is added to
736735
# `specs`, named 'xenium_ranger', which contains the key 'version' and whose value specifies the version of xeniumranger used to
737736
# resegment the data (e.g. 'xenium-3.0.1.1').

0 commit comments

Comments
 (0)