Skip to content

Commit

Permalink
Narrow some ImageSlide property types
Browse files Browse the repository at this point in the history
ImageSlide is hardcoded to a single level, and the level_count property
and get_best_level_for_downsample() return types already reflect this.
Reduce the level_dimensions() and level_downsamples() return types to
1-tuples.  In the latter case we can't reduce to a Literal because literal
floats are disallowed.

Signed-off-by: Benjamin Gilbert <[email protected]>
  • Loading branch information
bgilbert committed Oct 19, 2024
1 parent f1d02fc commit 0efc25b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openslide/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def level_count(self) -> Literal[1]:
return 1

@property
def level_dimensions(self) -> tuple[tuple[int, int], ...]:
def level_dimensions(self) -> tuple[tuple[int, int]]:
"""A list of (width, height) tuples, one for each level of the image.
level_dimensions[n] contains the dimensions of level n."""
Expand All @@ -411,7 +411,7 @@ def level_dimensions(self) -> tuple[tuple[int, int], ...]:
return (self._image.size,)

@property
def level_downsamples(self) -> tuple[float, ...]:
def level_downsamples(self) -> tuple[float]:
"""A list of downsampling factors for each level of the image.
level_downsample[n] contains the downsample factor of level n."""
Expand Down

0 comments on commit 0efc25b

Please sign in to comment.