diff --git a/dlup/data/dataset.py b/dlup/data/dataset.py index 206d467e..250368de 100644 --- a/dlup/data/dataset.py +++ b/dlup/data/dataset.py @@ -160,12 +160,10 @@ def __len__(self) -> int: return self.cumulative_sizes[-1] @overload - def __getitem__(self, index: int) -> T_co: - ... + def __getitem__(self, index: int) -> T_co: ... @overload - def __getitem__(self, index: slice) -> list[T_co]: - ... + def __getitem__(self, index: slice) -> list[T_co]: ... def __getitem__(self, index: Union[int, slice]) -> T_co | list[T_co]: """Returns the sample at the given index.""" @@ -285,12 +283,10 @@ def slide_image(self) -> "SlideImage": ) @overload - def __getitem__(self, index: int) -> TileSample: - ... + def __getitem__(self, index: int) -> TileSample: ... @overload - def __getitem__(self, index: slice) -> Sequence[TileSample]: - ... + def __getitem__(self, index: slice) -> Sequence[TileSample]: ... def __getitem__(self, index: Union[int, slice]) -> Union[TileSample, Sequence[TileSample]]: if isinstance(index, slice): @@ -553,12 +549,10 @@ def from_standard_tiling( ) @overload - def __getitem__(self, index: int) -> RegionFromWsiDatasetSample: - ... + def __getitem__(self, index: int) -> RegionFromWsiDatasetSample: ... @overload - def __getitem__(self, index: slice) -> list[RegionFromWsiDatasetSample]: - ... + def __getitem__(self, index: slice) -> list[RegionFromWsiDatasetSample]: ... def __getitem__( self, index: Union[int, slice] diff --git a/dlup/tiling.py b/dlup/tiling.py index 06179cb6..07a6784e 100644 --- a/dlup/tiling.py +++ b/dlup/tiling.py @@ -139,12 +139,10 @@ def size(self) -> tuple[int, int]: return len(self.coordinates[0]), len(self.coordinates[1]) @overload - def __getitem__(self, key: int) -> npt.NDArray[np.int_ | np.float_]: - ... + def __getitem__(self, key: int) -> npt.NDArray[np.int_ | np.float_]: ... @overload - def __getitem__(self, key: slice) -> list[npt.NDArray[np.int_ | np.float_]]: - ... + def __getitem__(self, key: slice) -> list[npt.NDArray[np.int_ | np.float_]]: ... def __getitem__( self, key: Union[int, slice] diff --git a/dlup/tools.py b/dlup/tools.py index 96a8af8f..66b5f81c 100644 --- a/dlup/tools.py +++ b/dlup/tools.py @@ -29,12 +29,10 @@ def __len__(self) -> int: return len(self._sequence) @overload - def __getitem__(self, key: int) -> T: - ... + def __getitem__(self, key: int) -> T: ... @overload - def __getitem__(self, key: slice) -> Sequence[T]: - ... + def __getitem__(self, key: slice) -> Sequence[T]: ... def __getitem__(self, key: Union[int, slice]) -> Union[T, Sequence[T]]: if isinstance(key, slice): @@ -61,12 +59,10 @@ def __init__(self, sequences: List[Sequence[T]]) -> None: self._len = cumsum[-1] @overload - def __getitem__(self, key: int) -> T: - ... + def __getitem__(self, key: int) -> T: ... @overload - def __getitem__(self, key: slice) -> Sequence[T]: - ... + def __getitem__(self, key: slice) -> Sequence[T]: ... def __getitem__(self, key: Union[int, slice]) -> Union[T, Sequence[T]]: if isinstance(key, slice): diff --git a/tests/common.py b/tests/common.py index 1d181ac7..f65da94f 100644 --- a/tests/common.py +++ b/tests/common.py @@ -99,9 +99,7 @@ def level_dimensions(self): @property def level_spacings(self): spacing = self.spacing - return tuple( - (spacing[0] * downsample**2, spacing[1] * downsample**2) for downsample in self.level_downsamples - ) + return tuple((spacing[0] * downsample**2, spacing[1] * downsample**2) for downsample in self.level_downsamples) def get_level_image(self, level): return self.image.resize(self.level_dimensions[level])