Skip to content

Commit d1d56dd

Browse files
committed
fix ruff issues
1 parent cdcf9bb commit d1d56dd

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/scportrait/pipeline/_utils/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
T = TypeVar("T")
44

55

6-
def flatten(nested_list: list[list[T]]) -> list[T]:
6+
def flatten(nested_list: list[list[T]]) -> list[T | tuple[T]]:
77
"""Flatten a list of lists into a single list.
88
99
Args:

src/scportrait/pipeline/selection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def _get_coords_multi(self, width: int, arg: tuple[list[int], np.ndarray]) -> li
148148

149149
def _get_coords(
150150
self, cell_ids: list, centers: list[tuple[int, int]], width: int = 60, batch_size: int = 100, threads: int = 10
151-
) -> dict:
151+
) -> dict[int, np.ndarray]:
152152
# create batches
153153
n_batches = int(np.ceil(len(cell_ids) / batch_size))
154154
slices = [(i * batch_size, i * batch_size + batch_size) for i in range(n_batches - 1)]
@@ -174,8 +174,8 @@ def _get_coords(
174174
pool.close()
175175
pool.join()
176176

177-
results = flatten(results)
178-
return dict(results)
177+
results = flatten(results) # type: ignore
178+
return dict(results) # type: ignore
179179

180180
def _get_cell_ids(self, cell_sets: list[dict]) -> list[int]:
181181
cell_ids = []

src/scportrait/tools/stitch/_stitch.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from scportrait.tools.stitch._utils.ashlar_plotting import plot_edge_quality, plot_edge_scatter
2424
from scportrait.tools.stitch._utils.filewriters import write_ome_zarr, write_spatialdata, write_tif, write_xml
2525

26-
2726
class Stitcher:
2827
"""
2928
Class for stitching of image tiles to assemble a mosaic.
@@ -107,10 +106,6 @@ def __init__(
107106
"""
108107
self._lazy_imports()
109108

110-
# workaround for lazy imports of module
111-
if self.reader_type == "FilePatternReaderRescale":
112-
self.reader_type = self.FilePatternReaderRescale
113-
114109
if orientation is None:
115110
orientation = {"flip_x": False, "flip_y": True}
116111

@@ -139,6 +134,10 @@ def __init__(
139134
self.orientation = orientation
140135
self.reader_type = reader_type
141136

137+
# workaround for lazy imports of module
138+
if self.reader_type == "FilePatternReaderRescale":
139+
self.reader_type = self.FilePatternReaderRescale
140+
142141
# workflow setup
143142
self.plot_QC = plot_QC
144143
self.overwrite = overwrite

0 commit comments

Comments
 (0)