diff --git a/src/PIL/ImageMode.py b/src/PIL/ImageMode.py index f6524f44b..5e05c5f43 100644 --- a/src/PIL/ImageMode.py +++ b/src/PIL/ImageMode.py @@ -16,24 +16,17 @@ from __future__ import annotations import sys from functools import lru_cache +from typing import NamedTuple -class ModeDescriptor: +class ModeDescriptor(NamedTuple): """Wrapper for mode strings.""" - def __init__( - self, - mode: str, - bands: tuple[str, ...], - basemode: str, - basetype: str, - typestr: str, - ) -> None: - self.mode = mode - self.bands = bands - self.basemode = basemode - self.basetype = basetype - self.typestr = typestr + mode: str + bands: tuple[str, ...] + basemode: str + basetype: str + typestr: str def __str__(self) -> str: return self.mode