|
23 | 23 | import sys |
24 | 24 | from enum import IntEnum, IntFlag |
25 | 25 | from functools import reduce |
26 | | -from typing import Any, BinaryIO, Literal, SupportsFloat, SupportsInt, Union |
| 26 | +from typing import Any, Literal, SupportsFloat, SupportsInt, Union |
27 | 27 |
|
28 | 28 | from . import Image, __version__ |
29 | 29 | from ._deprecate import deprecate |
| 30 | +from ._typing import SupportsRead |
30 | 31 |
|
31 | 32 | try: |
32 | 33 | from . import _imagingcms as core |
@@ -236,7 +237,7 @@ def GRIDPOINTS(n: int) -> Flags: |
236 | 237 |
|
237 | 238 |
|
238 | 239 | class ImageCmsProfile: |
239 | | - def __init__(self, profile: str | BinaryIO | core.CmsProfile) -> None: |
| 240 | + def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None: |
240 | 241 | """ |
241 | 242 | :param profile: Either a string representing a filename, |
242 | 243 | a file like object containing a profile or a |
@@ -365,7 +366,9 @@ def get_display_profile(handle: SupportsInt | None = None) -> ImageCmsProfile | |
365 | 366 | # pyCMS compatible layer |
366 | 367 | # --------------------------------------------------------------------. |
367 | 368 |
|
368 | | -_CmsProfileCompatible = Union[str, BinaryIO, core.CmsProfile, ImageCmsProfile] |
| 369 | +_CmsProfileCompatible = Union[ |
| 370 | + str, SupportsRead[bytes], core.CmsProfile, ImageCmsProfile |
| 371 | +] |
369 | 372 |
|
370 | 373 |
|
371 | 374 | class PyCMSError(Exception): |
@@ -472,7 +475,7 @@ def profileToProfile( |
472 | 475 |
|
473 | 476 |
|
474 | 477 | def getOpenProfile( |
475 | | - profileFilename: str | BinaryIO | core.CmsProfile, |
| 478 | + profileFilename: str | SupportsRead[bytes] | core.CmsProfile, |
476 | 479 | ) -> ImageCmsProfile: |
477 | 480 | """ |
478 | 481 | (pyCMS) Opens an ICC profile file. |
|
0 commit comments