From 0433cd727c4f36e344b9f27b6b0e47584d0f64ea Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Sun, 18 Dec 2022 09:38:46 -0800 Subject: [PATCH] Tweak type hints in matrix.py --- manimlib/mobject/matrix.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/manimlib/mobject/matrix.py b/manimlib/mobject/matrix.py index 14102f88..0dc8e7ec 100644 --- a/manimlib/mobject/matrix.py +++ b/manimlib/mobject/matrix.py @@ -106,10 +106,16 @@ class Matrix(VMobject): self.add_background_rectangle() - def element_to_mobject(self, element: str | float, **config) -> Tex: + def element_to_mobject(self, element: str | float | VMobject, **config) -> VMobject: + if isinstance(element, VMobject): + return element return Tex(str(element), **config) - def matrix_to_mob_matrix(self, matrix: npt.ArrayLike, **config) -> list[list[VMobject]]: + def matrix_to_mob_matrix( + self, + matrix: Sequence[Sequence[str | float | VMobject]], + **config + ) -> list[list[VMobject]]: return [ [ self.element_to_mobject(item, **config) @@ -120,7 +126,7 @@ class Matrix(VMobject): def organize_mob_matrix( self, - matrix: list[list[Mobject]], + matrix: list[list[VMobject]], v_buff: float, h_buff: float, aligned_corner: Vect3,