Skip to content

Commit 2954964

Browse files
radarherelukegb
andauthored
Removed ImageCmsProfile._set method (#9032)
Co-authored-by: Luke Granger-Brown <[email protected]>
1 parent ae02518 commit 2954964

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/PIL/ImageCms.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None
248248
low-level profile object
249249
250250
"""
251+
self.filename = None
252+
self.product_name = None # profile.product_name
253+
self.product_info = None # profile.product_info
251254

252255
if isinstance(profile, str):
253256
if sys.platform == "win32":
@@ -256,23 +259,18 @@ def __init__(self, profile: str | SupportsRead[bytes] | core.CmsProfile) -> None
256259
profile_bytes_path.decode("ascii")
257260
except UnicodeDecodeError:
258261
with open(profile, "rb") as f:
259-
self._set(core.profile_frombytes(f.read()))
262+
self.profile = core.profile_frombytes(f.read())
260263
return
261-
self._set(core.profile_open(profile), profile)
264+
self.filename = profile
265+
self.profile = core.profile_open(profile)
262266
elif hasattr(profile, "read"):
263-
self._set(core.profile_frombytes(profile.read()))
267+
self.profile = core.profile_frombytes(profile.read())
264268
elif isinstance(profile, core.CmsProfile):
265-
self._set(profile)
269+
self.profile = profile
266270
else:
267271
msg = "Invalid type for Profile" # type: ignore[unreachable]
268272
raise TypeError(msg)
269273

270-
def _set(self, profile: core.CmsProfile, filename: str | None = None) -> None:
271-
self.profile = profile
272-
self.filename = filename
273-
self.product_name = None # profile.product_name
274-
self.product_info = None # profile.product_info
275-
276274
def tobytes(self) -> bytes:
277275
"""
278276
Returns the profile in a format suitable for embedding in

0 commit comments

Comments
 (0)