mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-02 19:03:24 +03:00
Removed ImageCmsProfile._set method (#9032)
Co-authored-by: Luke Granger-Brown <git@lukegb.com>
This commit is contained in:
parent
ae02518314
commit
2954964cd2
|
@ -248,6 +248,9 @@ class ImageCmsProfile:
|
|||
low-level profile object
|
||||
|
||||
"""
|
||||
self.filename = None
|
||||
self.product_name = None # profile.product_name
|
||||
self.product_info = None # profile.product_info
|
||||
|
||||
if isinstance(profile, str):
|
||||
if sys.platform == "win32":
|
||||
|
@ -256,23 +259,18 @@ class ImageCmsProfile:
|
|||
profile_bytes_path.decode("ascii")
|
||||
except UnicodeDecodeError:
|
||||
with open(profile, "rb") as f:
|
||||
self._set(core.profile_frombytes(f.read()))
|
||||
self.profile = core.profile_frombytes(f.read())
|
||||
return
|
||||
self._set(core.profile_open(profile), profile)
|
||||
self.filename = profile
|
||||
self.profile = core.profile_open(profile)
|
||||
elif hasattr(profile, "read"):
|
||||
self._set(core.profile_frombytes(profile.read()))
|
||||
self.profile = core.profile_frombytes(profile.read())
|
||||
elif isinstance(profile, core.CmsProfile):
|
||||
self._set(profile)
|
||||
self.profile = profile
|
||||
else:
|
||||
msg = "Invalid type for Profile" # type: ignore[unreachable]
|
||||
raise TypeError(msg)
|
||||
|
||||
def _set(self, profile: core.CmsProfile, filename: str | None = None) -> None:
|
||||
self.profile = profile
|
||||
self.filename = filename
|
||||
self.product_name = None # profile.product_name
|
||||
self.product_info = None # profile.product_info
|
||||
|
||||
def tobytes(self) -> bytes:
|
||||
"""
|
||||
Returns the profile in a format suitable for embedding in
|
||||
|
|
Loading…
Reference in New Issue
Block a user