mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
use SupportsRead instead of BinaryIO
This commit is contained in:
parent
d3665ea0ea
commit
aef7ccda3a
|
@ -23,10 +23,11 @@ import operator
|
||||||
import sys
|
import sys
|
||||||
from enum import IntEnum, IntFlag
|
from enum import IntEnum, IntFlag
|
||||||
from functools import reduce
|
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 . import Image, __version__
|
||||||
from ._deprecate import deprecate
|
from ._deprecate import deprecate
|
||||||
|
from ._typing import SupportsRead
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from . import _imagingcms as core
|
from . import _imagingcms as core
|
||||||
|
@ -236,7 +237,7 @@ _FLAGS = {
|
||||||
|
|
||||||
|
|
||||||
class ImageCmsProfile:
|
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,
|
:param profile: Either a string representing a filename,
|
||||||
a file like object containing a profile or a
|
a file like object containing a profile or a
|
||||||
|
@ -365,7 +366,9 @@ def get_display_profile(handle: SupportsInt | None = None) -> ImageCmsProfile |
|
||||||
# pyCMS compatible layer
|
# pyCMS compatible layer
|
||||||
# --------------------------------------------------------------------.
|
# --------------------------------------------------------------------.
|
||||||
|
|
||||||
_CmsProfileCompatible = Union[str, BinaryIO, core.CmsProfile, ImageCmsProfile]
|
_CmsProfileCompatible = Union[
|
||||||
|
str, SupportsRead[bytes], core.CmsProfile, ImageCmsProfile
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class PyCMSError(Exception):
|
class PyCMSError(Exception):
|
||||||
|
@ -472,7 +475,7 @@ def profileToProfile(
|
||||||
|
|
||||||
|
|
||||||
def getOpenProfile(
|
def getOpenProfile(
|
||||||
profileFilename: str | BinaryIO | core.CmsProfile,
|
profileFilename: str | SupportsRead[bytes] | core.CmsProfile,
|
||||||
) -> ImageCmsProfile:
|
) -> ImageCmsProfile:
|
||||||
"""
|
"""
|
||||||
(pyCMS) Opens an ICC profile file.
|
(pyCMS) Opens an ICC profile file.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user