From 537047c44517c02c49b00e406eb98c1fb79e5abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Wi=C5=9Bniewski?= Date: Tue, 2 Jan 2024 01:09:13 +0100 Subject: [PATCH] Fix type issue for np.zeros --- src/pygerber/backend/rasterized_2d/backend_cls.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pygerber/backend/rasterized_2d/backend_cls.py b/src/pygerber/backend/rasterized_2d/backend_cls.py index fd0f3da7..5e48bd43 100644 --- a/src/pygerber/backend/rasterized_2d/backend_cls.py +++ b/src/pygerber/backend/rasterized_2d/backend_cls.py @@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, ClassVar, Optional import numpy as np +import numpy.typing as npt from PIL import Image from pygerber.backend.abstract.backend_cls import Backend, BackendOptions @@ -170,7 +171,10 @@ def _replace_image_colors(self) -> None: np_img = np.array(img) # Create an empty RGBA image with the same size as the original image - rgba_img = np.zeros((img.height, img.width, 4), dtype=np.uint8) + rgba_img: npt.NDArray[np.uint8] = np.zeros( + (img.height, img.width, 4), + dtype=np.uint8, + ) # For each grayscale value, set the corresponding RGBA value in the new image for gray_value, rgba in color_map.items():