Repository: ManimCommunity/manim
File: manim/scene/vector_space_scene.py (Python)

Code before:
            raise ValueError("Matrix has bad dimensions")
        return lambda point: np.dot(point, transposed_matrix)

    def get_piece_movement(self, pieces: list | tuple | np.ndarray):
        """
        This method returns an animation that moves an arbitrary
        mobject in "pieces" to its corresponding .target value.
        If self.leave_ghost_vectors is True, ghosts of the original
        positions/mobjects are left on screen

        Parameters
        ----------
        pieces
            The pieces for which the movement must be shown.

        Returns
        -------
        Animation`
            The animation of the movement.
        """

        v_pieces = [piece for piece in pieces if isinstance(piece, VMobject)]
        start = VGroup(*v_pieces)
        target = VGroup(*(mob.target for mob in v_pieces))
        # don't add empty VGroups
        if v_pieces:
            if self.leave_ghost_vectors and start.submobjects:
                # start.copy() gives a VGroup of Vectors
                self.ghost_vectors.add(start.copy().fade(0.7))
                self.add(self.ghost_vectors[-1])
            return Transform(start, target, lag_ratio=0)
        return []

    def get_moving_mobject_movement(self, func: Callable[[np.ndarray], np.ndarray]):
        """
        This method returns an animation that moves a mobject
        in "self.moving_mobjects"  to its corresponding .target value.
        func is a function that determines where the .target goes.

        Parameters
        ----------

        func
            The function that determines where the .target of
            the moving mobject goes.

        Returns
        -------
        Animation
            The animation of the movement.
        """

Review comment (refactor):
i don't think that this is a good option. This might cause another errors in another part of the library. As far as i know during "refactoring" library should make as less changes as it is possible

Code after:
            raise ValueError("Matrix has bad dimensions")
        return lambda point: np.dot(point, transposed_matrix)

    def get_piece_movement(self, pieces: list | tuple | np.ndarray):
        """
        This method returns an animation that moves an arbitrary
        mobject in "pieces" to its corresponding .target value.
        If self.leave_ghost_vectors is True, ghosts of the original
        positions/mobjects are left on screen

        Parameters
        ----------
        pieces
            The pieces for which the movement must be shown.

        Returns
        -------
        Animation
            The animation of the movement.
        """

        v_pieces = [piece for piece in pieces if isinstance(piece, VMobject)]
        start = VGroup(*v_pieces)
        target = VGroup(*(mob.target for mob in v_pieces))

        # don't add empty VGroups
        if self.leave_ghost_vectors and start.submobjects:
            # start.copy() gives a VGroup of Vectors
            self.ghost_vectors.add(start.copy().fade(0.7))
            self.add(self.ghost_vectors[-1])
        return Transform(start, target, lag_ratio=0)

    def get_moving_mobject_movement(self, func: Callable[[np.ndarray], np.ndarray]):
        """
        This method returns an animation that moves a mobject
        in "self.moving_mobjects"  to its corresponding .target value.
        func is a function that determines where the .target goes.

        Parameters
        ----------

        func
            The function that determines where the .target of
            the moving mobject goes.

        Returns
        -------
        Animation
            The animation of the movement.
        """
        for m in self.moving_mobjects: