Skip to content

Commit

Permalink
use SupportsRead instead of BinaryIO
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Mar 28, 2024
1 parent d3665ea commit aef7ccd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/PIL/ImageCms.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
import sys
from enum import IntEnum, IntFlag
from functools import reduce
from typing import Any, BinaryIO, Literal, SupportsFloat, SupportsInt, Union
from typing import Any, Literal, SupportsFloat, SupportsInt, Union

from . import Image, __version__
from ._deprecate import deprecate
from ._typing import SupportsRead

try:
from . import _imagingcms as core
Expand Down Expand Up @@ -236,7 +237,7 @@ def GRIDPOINTS(n: int) -> Flags:


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

_CmsProfileCompatible = Union[str, BinaryIO, core.CmsProfile, ImageCmsProfile]
_CmsProfileCompatible = Union[
str, SupportsRead[bytes], core.CmsProfile, ImageCmsProfile
]


class PyCMSError(Exception):
Expand Down Expand Up @@ -472,7 +475,7 @@ def profileToProfile(


def getOpenProfile(
profileFilename: str | BinaryIO | core.CmsProfile,
profileFilename: str | SupportsRead[bytes] | core.CmsProfile,
) -> ImageCmsProfile:
"""
(pyCMS) Opens an ICC profile file.
Expand Down

0 comments on commit aef7ccd

Please sign in to comment.