Repository: ManimCommunity/manim
File: manim/mobject/matrix.py (Python)

Code before:
        Parameters
        ----------
        matrix : typing.Iterable
            A numpy 2d array or list of lists
        v_buff : float, optional
            vertical buffer, by default 0.8
        h_buff : float, optional
            horizontal buffer, by default 1.3
        bracket_h_buff : float, optional
            bracket horizonal buffer, by default MED_SMALL_BUFF
        bracket_v_buff : float, optional
            bracket veritical buffer, by default MED_SMALL_BUFF
        add_background_rectangles_to_entries : bool, optional
            `True` if should add backgraound rectangles to entries, by default False
        include_background_rectangle : bool, optional
            `True` if should include background rectangle, by default False
        element_to_mobject : Mobject, optional
            element to mobject, by default MathTex
        element_to_mobject_config : dict, optional
            element to mobject config, by default {}
        element_alignment_corner : np.ndarray, optional
            the element alignment corner, by default DR
        left_bracket : str, optional
            the left bracket type, by default "\\\\big["
        right_bracket : str, optional
            the right bracket type, by default "\\\\big]"

        """

        self.v_buff = v_buff
        self.h_buff = h_buff
        self.bracket_h_buff = bracket_h_buff
        self.bracket_v_buff = bracket_v_buff
        self.add_background_rectangles_to_entries = add_background_rectangles_to_entries
        self.include_background_rectangle = include_background_rectangle
        self.element_to_mobject = element_to_mobject
        self.element_to_mobject_config = element_to_mobject_config
        self.element_alignment_corner = element_alignment_corner
        self.left_bracket = left_bracket
        self.right_bracket = right_bracket
        VMobject.__init__(self, **kwargs)
        matrix = np.array(matrix)
        if len(matrix.shape) < 2:
            raise ValueError(
                f"{self.__str__()} class requires a two-dimensional array!"
            )
        mob_matrix = self.matrix_to_mob_matrix(matrix)
        self.organize_mob_matrix(mob_matrix)
        self.elements = VGroup(*mob_matrix.flatten())
        self.add(self.elements)
        self.add_brackets(self.left_bracket, self.right_bracket)

Review comment (suggestion):
```suggestion
        matrix : :class:`typing.Iterable`
            A numpy 2d array or list of lists
        v_buff : :class:`float`, optional
            vertical buffer, by default 0.8
        h_buff : :class:`float`, optional
            horizontal buffer, by default 1.3
        bracket_h_buff : :class:`float`, optional
            bracket horizonal buffer, by default MED_SMALL_BUFF
        bracket_v_buff : :class:`float`, optional
            bracket veritical buffer, by default MED_SMALL_BUFF
        add_background_rectangles_to_entries : :class:`bool`, optional
            `True` if should add backgraound rectangles to entries, by default False
        include_background_rectangle : :class:`bool`, optional
            `True` if should include background rectangle, by default False
        element_to_mobject : :class:`Mobject`, optional
            element to mobject, by default MathTex
        element_to_mobject_config : Dict[:class:`str`, :class:`~.Mobject`], optional
            element to mobject config, by default {}
        element_alignment_corner : :class:`np.ndarray`, optional
            the element alignment corner, by default DR
        left_bracket : :class:`str`, optional
            the left bracket type, by default "\\\\big["
        right_bracket : :class:`str`, optional
            the right bracket type, by default "\\\\big]"
```

Code after:
        Parameters
        ----------
        matrix : :class:`typing.Iterable`
            A numpy 2d array or list of lists
        v_buff : :class:`float`, optional
            vertical buffer, by default 0.8
        h_buff : :class:`float`, optional
            horizontal buffer, by default 1.3
        bracket_h_buff : :class:`float`, optional
            bracket horizonal buffer, by default MED_SMALL_BUFF
        bracket_v_buff : :class:`float`, optional
            bracket veritical buffer, by default MED_SMALL_BUFF
        add_background_rectangles_to_entries : :class:`bool`, optional
            `True` if should add backgraound rectangles to entries, by default False
        include_background_rectangle : :class:`bool`, optional
            `True` if should include background rectangle, by default False
        element_to_mobject : :class:`~.Mobject`, optional
            element to mobject, by default MathTex
        element_to_mobject_config : Dict[:class:`str`, :class:`~.Mobject`], optional
            element to mobject config, by default {}
        element_alignment_corner : :class:`np.ndarray`, optional
            the element alignment corner, by default DR
        left_bracket : :class:`str`, optional
            the left bracket type, by default "\\\\big["
        right_bracket : :class:`str`, optional
            the right bracket type, by default "\\\\big]"

        """

        self.v_buff = v_buff
        self.h_buff = h_buff
        self.bracket_h_buff = bracket_h_buff
        self.bracket_v_buff = bracket_v_buff
        self.add_background_rectangles_to_entries = add_background_rectangles_to_entries
        self.include_background_rectangle = include_background_rectangle
        self.element_to_mobject = element_to_mobject
        self.element_to_mobject_config = element_to_mobject_config
        self.element_alignment_corner = element_alignment_corner
        self.left_bracket = left_bracket
        self.right_bracket = right_bracket
        VMobject.__init__(self, **kwargs)
        matrix = np.array(matrix)
        if len(matrix.shape) < 2:
            raise ValueError(
                f"{self.__str__()} class requires a two-dimensional array!"
            )
        mob_matrix = self.matrix_to_mob_matrix(matrix)
        self.organize_mob_matrix(mob_matrix)
        self.elements = VGroup(*mob_matrix.flatten())
        self.add(self.elements)
        self.add_brackets(self.left_bracket, self.right_bracket)