A community-maintained Python framework for creating mathematical animations.
Type hinting images.py (#2194)
David Yang911ea4bd0941
diff --git a/manim/utils/images.py b/manim/utils/images.pyindex 0daf9b995..fade65a17 100644--- a/manim/utils/images.py+++ b/manim/utils/images.py@@ -3,6 +3,8 @@__all__ = ["get_full_raster_image_path", "drag_pixels", "invert_image"]+from typing import List+import numpy as npfrom PIL import Image@@ -10,7 +12,7 @@ from .. import configfrom ..utils.file_ops import seek_full_path_from_defaults-def get_full_raster_image_path(image_file_name):+def get_full_raster_image_path(image_file_name: str) -> str:return seek_full_path_from_defaults(image_file_name,default_dir=config.get_dir("assets_dir"),@@ -18,7 +20,7 @@ def get_full_raster_image_path(image_file_name):)-def drag_pixels(frames):+def drag_pixels(frames: List[np.array]) -> List[np.array]:curr = frames[0]new_frames = []for frame in frames:@@ -27,7 +29,7 @@ def drag_pixels(frames):return new_frames-def invert_image(image):+def invert_image(image: np.array) -> Image:arr = np.array(image)arr = (255 * np.ones(arr.shape)).astype(arr.dtype) - arrreturn Image.fromarray(arr)