From 1814615336e4b44ba14779a5137e74b21c40c56a Mon Sep 17 00:00:00 2001 From: Shroominic Date: Fri, 17 May 2024 13:31:33 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20rm=20need=20of=20PIL=20dep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/funcchain/syntax/input_types.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/funcchain/syntax/input_types.py b/src/funcchain/syntax/input_types.py index 9833718..ebf95f8 100644 --- a/src/funcchain/syntax/input_types.py +++ b/src/funcchain/syntax/input_types.py @@ -8,8 +8,10 @@ if TYPE_CHECKING: from PIL.Image import Image as PImage + from PIL.Image import open as pil_open else: PImage = type("PImage") + pil_open = lambda x: x # noqa class Image: @@ -63,10 +65,10 @@ def to_bytes(self) -> bytes: return base64.b64decode(base64_str) def to_pillow(self) -> PImage: - from io import BytesIO # type: ignore + from io import BytesIO image_bytes = self.to_bytes() - return PImage.open(BytesIO(image_bytes)) + return pil_open(BytesIO(image_bytes)) def to_file(self, path: str) -> None: open(path, "wb").write(self.to_bytes())