Skip to content

Commit dccce62

Browse files
committed
Drop _OpenSlideCacheWrapper
We don't want to encourage library users to duck-type a replacement for OpenSlideCache, since any replacement would inherently need to make assumptions about our implementation details. Signed-off-by: Benjamin Gilbert <[email protected]>
1 parent 076e96f commit dccce62

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

openslide/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from io import BytesIO
2929
from pathlib import Path
3030
from types import TracebackType
31-
from typing import Iterator, Literal, Mapping, Protocol, TypeVar
31+
from typing import Iterator, Literal, Mapping, TypeVar
3232

3333
from PIL import Image, ImageCms
3434

@@ -63,10 +63,6 @@
6363
_T = TypeVar('_T')
6464

6565

66-
class _OpenSlideCacheWrapper(Protocol):
67-
_openslide_cache: lowlevel._OpenSlideCache
68-
69-
7066
class AbstractSlide:
7167
"""The base class of a slide object."""
7268

@@ -156,7 +152,7 @@ def read_region(
156152
size: (width, height) tuple giving the region size."""
157153
raise NotImplementedError
158154

159-
def set_cache(self, cache: _OpenSlideCacheWrapper) -> None:
155+
def set_cache(self, cache: OpenSlideCache) -> None:
160156
"""Use the specified cache to store recently decoded slide tiles.
161157
162158
cache: an OpenSlideCache object."""
@@ -278,7 +274,7 @@ def read_region(
278274
region.info['icc_profile'] = self._profile
279275
return region
280276

281-
def set_cache(self, cache: _OpenSlideCacheWrapper) -> None:
277+
def set_cache(self, cache: OpenSlideCache) -> None:
282278
"""Use the specified cache to store recently decoded slide tiles.
283279
284280
By default, the object has a private cache with a default size.
@@ -480,7 +476,7 @@ def read_region(
480476
tile.info['icc_profile'] = self._profile
481477
return tile
482478

483-
def set_cache(self, cache: _OpenSlideCacheWrapper) -> None:
479+
def set_cache(self, cache: OpenSlideCache) -> None:
484480
"""Use the specified cache to store recently decoded slide tiles.
485481
486482
ImageSlide does not support caching, so this method does nothing.

0 commit comments

Comments
 (0)