|
28 | 28 | from io import BytesIO
|
29 | 29 | from pathlib import Path
|
30 | 30 | from types import TracebackType
|
31 |
| -from typing import Iterator, Literal, Mapping, Protocol, TypeVar |
| 31 | +from typing import Iterator, Literal, Mapping, TypeVar |
32 | 32 |
|
33 | 33 | from PIL import Image, ImageCms
|
34 | 34 |
|
|
63 | 63 | _T = TypeVar('_T')
|
64 | 64 |
|
65 | 65 |
|
66 |
| -class _OpenSlideCacheWrapper(Protocol): |
67 |
| - _openslide_cache: lowlevel._OpenSlideCache |
68 |
| - |
69 |
| - |
70 | 66 | class AbstractSlide:
|
71 | 67 | """The base class of a slide object."""
|
72 | 68 |
|
@@ -156,7 +152,7 @@ def read_region(
|
156 | 152 | size: (width, height) tuple giving the region size."""
|
157 | 153 | raise NotImplementedError
|
158 | 154 |
|
159 |
| - def set_cache(self, cache: _OpenSlideCacheWrapper) -> None: |
| 155 | + def set_cache(self, cache: OpenSlideCache) -> None: |
160 | 156 | """Use the specified cache to store recently decoded slide tiles.
|
161 | 157 |
|
162 | 158 | cache: an OpenSlideCache object."""
|
@@ -278,7 +274,7 @@ def read_region(
|
278 | 274 | region.info['icc_profile'] = self._profile
|
279 | 275 | return region
|
280 | 276 |
|
281 |
| - def set_cache(self, cache: _OpenSlideCacheWrapper) -> None: |
| 277 | + def set_cache(self, cache: OpenSlideCache) -> None: |
282 | 278 | """Use the specified cache to store recently decoded slide tiles.
|
283 | 279 |
|
284 | 280 | By default, the object has a private cache with a default size.
|
@@ -480,7 +476,7 @@ def read_region(
|
480 | 476 | tile.info['icc_profile'] = self._profile
|
481 | 477 | return tile
|
482 | 478 |
|
483 |
| - def set_cache(self, cache: _OpenSlideCacheWrapper) -> None: |
| 479 | + def set_cache(self, cache: OpenSlideCache) -> None: |
484 | 480 | """Use the specified cache to store recently decoded slide tiles.
|
485 | 481 |
|
486 | 482 | ImageSlide does not support caching, so this method does nothing.
|
|
0 commit comments