Skip to content

Commit aef7ccd

Browse files
committed
use SupportsRead instead of BinaryIO
1 parent d3665ea commit aef7ccd

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/PIL/ImageCms.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
import sys
2424
from enum import IntEnum, IntFlag
2525
from functools import reduce
26-
from typing import Any, BinaryIO, Literal, SupportsFloat, SupportsInt, Union
26+
from typing import Any, Literal, SupportsFloat, SupportsInt, Union
2727

2828
from . import Image, __version__
2929
from ._deprecate import deprecate
30+
from ._typing import SupportsRead
3031

3132
try:
3233
from . import _imagingcms as core
@@ -236,7 +237,7 @@ def GRIDPOINTS(n: int) -> Flags:
236237

237238

238239
class ImageCmsProfile:
239-
def __init__(self, profile: str | BinaryIO | core.CmsProfile) -> None:
240+
def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None:
240241
"""
241242
:param profile: Either a string representing a filename,
242243
a file like object containing a profile or a
@@ -365,7 +366,9 @@ def get_display_profile(handle: SupportsInt | None = None) -> ImageCmsProfile |
365366
# pyCMS compatible layer
366367
# --------------------------------------------------------------------.
367368

368-
_CmsProfileCompatible = Union[str, BinaryIO, core.CmsProfile, ImageCmsProfile]
369+
_CmsProfileCompatible = Union[
370+
str, SupportsRead[bytes], core.CmsProfile, ImageCmsProfile
371+
]
369372

370373

371374
class PyCMSError(Exception):
@@ -472,7 +475,7 @@ def profileToProfile(
472475

473476

474477
def getOpenProfile(
475-
profileFilename: str | BinaryIO | core.CmsProfile,
478+
profileFilename: str | SupportsRead[bytes] | core.CmsProfile,
476479
) -> ImageCmsProfile:
477480
"""
478481
(pyCMS) Opens an ICC profile file.

0 commit comments

Comments
 (0)