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

Code before:
            columns rigthwards. "u" and "l" stand for upwards and leftwards.

        .. note:: If either :code:`rows` or :code:`cols` is not defined, it is set to the length of either
            :code:`row_alignments` / :code:`col_alignments` or :code:`row_heights` / :code:`col_widths` if
            one of those is defined. If only one of :code:`rows` and :code:`cols` can be determined
            like this, the other will be choosen big enough to fit all submobjects.
            If neither :code:`cols` nor :code:`rows` is set implicitly, they will be choosen to be
            about the same, tending towards :code:`cols > rows` (simply because videos are wider
            then they are high).

        .. note:: If both :code:`cell_alignment` and either :code:`row_alignments` or :code:`col_alignments` is
            defined the latter has higher priority in its direction.


        Returns
        -------
        Mobject
            The mobject.

        Raises
        ------
        ValueError
            If rows and cols are choosen to small to fit all submobjetcs.
        ValueError
            :code:`cols`, :code:`col_alignments` and :code:`col_widths` or :code:`rows`,
            :code:`row_alignments` and :code:`row_heights` have mismatching sizes.

        Examples
        --------

        .. manim:: ArrangeInGrid
            :save_last_frame:

            class ArrangeInGrid(Scene):
                def construct(self):
                    #Add some numbered boxes:
                    np.random.seed(3)
                    boxes = VGroup(*[Rectangle(WHITE, np.random.random()+.5, np.random.random()+.5).add(Text(str(i+1)).scale(0.5)) for i in range(22)])
                    self.add(boxes)

                    boxes.arrange_in_grid(
                        buff=(0.25,0.5),
                        col_alignments="lccccr",
                        row_alignments="uccd",
                        col_widths=[2, *[None]*4, 2],
                        flow_order="dr"
                    )


        """
        from manim import Line

Review comment (suggestion):
Just to be consistent with the previous ValueError
```suggestion
        ValueError
            If :code:`cols`, :code:`col_alignments` and :code:`col_widths` or :code:`rows`,
            :code:`row_alignments` and :code:`row_heights` have mismatching sizes.
```

Code after:
        Mobject
            The mobject.

        NOTES
        -----

        If only one of ``cols`` and ``rows`` is set implicitly, the other one will be chosen big
        enough to fit all submobjects. If neither is set, they will be chosen to be about the same,
        tending towards ``cols`` > ``rows`` (simply because videos are wider than they are high).

        If both ``cell_alignment`` and ``row_alignments`` / ``col_alignments`` are
        defined, the latter has higher priority.


        Raises
        ------
        ValueError
            If ``rows`` and ``cols`` are too small to fit all submobjects.
        ValueError
            If :code:`cols`, :code:`col_alignments` and :code:`col_widths` or :code:`rows`,
            :code:`row_alignments` and :code:`row_heights` have mismatching sizes.

        Examples
        --------

        .. manim:: ArrangeInGrid
            :save_last_frame:

            class ArrangeInGrid(Scene):
                def construct(self):
                    #Add some numbered boxes:
                    np.random.seed(3)
                    boxes = VGroup(*[
                        Rectangle(WHITE, np.random.random()+.5, np.random.random()+.5).add(Text(str(i+1)).scale(0.5))
                        for i in range(22)
                    ])
                    self.add(boxes)

                    boxes.arrange_in_grid(
                        buff=(0.25,0.5),
                        col_alignments="lccccr",
                        row_alignments="uccd",
                        col_widths=[2, *[None]*4, 2],
                        flow_order="dr"
                    )


        """
        from .geometry import Line

        mobs = self.submobjects.copy()