moved branches into the class

This commit is contained in:
isidorajovanovic 2024-06-27 12:20:05 +02:00
parent d73ce6aa55
commit 5b375becfb

View File

@ -40,10 +40,6 @@ from typing import IO
from . import Image, ImageFile
branches = {
"1": False,
"2": False,
}
class Format(IntEnum):
JPEG = 0
@ -290,11 +286,11 @@ class _BLPBaseDecoder(ImageFile.PyDecoder):
def decode(self, buffer: bytes) -> tuple[int, int]:
try:
branches["1"] = True
_BLPBaseDecoder.branches["1"] = True
self._read_blp_header()
self._load()
except struct.error as e:
branches["2"] = True
_BLPBaseDecoder.branches["2"] = True
msg = "Truncated BLP file"
raise OSError(msg) from e
return -1, 0