Added type hints by radarhere · Pull Request #8125 · python-pillow/Pillow

src/PIL/IcnsImagePlugin.py:358: error: Generator has incompatible item type "object"; expected "bool"  [misc]
        file_length += sum(entry["size"] for entry in entries)
                           ^~~~~~~~~~~~~
src/PIL/IcnsImagePlugin.py:365: error: No overload variant of "write" of "IO" matches argument type "object"  [call-overload]
            fp.write(entry["type"])
            ^~~~~~~~~~~~~~~~~~~~~~~
src/PIL/IcnsImagePlugin.py:365: note: Possible overload variants:
src/PIL/IcnsImagePlugin.py:365: note:     def write(self, Buffer, /) -> int
src/PIL/IcnsImagePlugin.py:365: note:     def write(self, bytes, /) -> int
src/PIL/IcnsImagePlugin.py:370: error: No overload variant of "write" of "IO" matches argument type "object"  [call-overload]
            fp.write(entry["type"])
            ^~~~~~~~~~~~~~~~~~~~~~~
src/PIL/IcnsImagePlugin.py:370: note: Possible overload variants:
src/PIL/IcnsImagePlugin.py:370: note:     def write(self, Buffer, /) -> int
src/PIL/IcnsImagePlugin.py:370: note:     def write(self, bytes, /) -> int
src/PIL/IcnsImagePlugin.py:372: error: No overload variant of "write" of "IO" matches argument type "object"  [call-overload]
            fp.write(entry["stream"])
            ^~~~~~~~~~~~~~~~~~~~~~~~~
src/PIL/IcnsImagePlugin.py:372: note: Possible overload variants:
src/PIL/IcnsImagePlugin.py:372: note:     def write(self, Buffer, /) -> int
src/PIL/IcnsImagePlugin.py:372: note:     def write(self, bytes, /) -> int
Found 4 errors in 1 file (checked 1 source file)

This change fixes it. I can use a named tuple or something if you prefer.