Repository: matplotlib/matplotlib
File: lib/matplotlib/axis.py (Python)

Code before:
                zorder = mlines.Line2D.zorder + 0.01
            else:
                zorder = mlines.Line2D.zorder
        self._zorder = zorder

        grid_color = (
            mpl._val_or_rc(
                grid_color,
                f"grid.{major_minor}.color",
                "grid.color",
            )
        )
        grid_linestyle = (
            mpl._val_or_rc(
                grid_linestyle,
                f"grid.{major_minor}.linestyle",
                "grid.linestyle",
            )
        )
        grid_linewidth = (
            mpl._val_or_rc(
                grid_linewidth,
                f"grid.{major_minor}.linewidth",
                "grid.linewidth",
            )
        )
        if grid_alpha is None and not mcolors._has_alpha_channel(grid_color):
            # alpha precedence: kwarg > color alpha > rcParams['grid.alpha']
            # Note: only resolve to rcParams if the color does not have alpha
            # otherwise `grid(color=(1, 1, 1, 0.5))` would work like
            #   grid(color=(1, 1, 1, 0.5), alpha=rcParams['grid.alpha'])
            # so the that the rcParams default would override color alpha.
            grid_alpha = (
                # grid_alpha is None so we can use the first key
                mpl._val_or_rc(
                    mpl.rcParams[f"grid.{major_minor}.alpha"],
                    "grid.alpha",
                )
            )

        grid_kw = {k[5:]: v for k, v in kwargs.items() if k != "rotation_mode"}

        self.tick1line = mlines.Line2D(
            [], [],
            color=color, linestyle="none", zorder=zorder, visible=tick1On,
            markeredgecolor=color, markersize=self._size, markeredgewidth=self._width,
        )
        self.tick2line = mlines.Line2D(
            [], [],
            color=color, linestyle="none", zorder=zorder, visible=tick2On,
            markeredgecolor=color, markersize=self._size, markeredgewidth=self._width,

Review comment (suggestion):
Outer parentheses are not necessary:
```suggestion
        grid_color = mpl._val_or_rc(
            grid_color,
            f"grid.{major_minor}.color",
            "grid.color",
        )
        grid_linestyle = mpl._val_or_rc(
            grid_linestyle,
            f"grid.{major_minor}.linestyle",
            "grid.linestyle",
        )
        grid_linewidth = mpl._val_or_rc(
            grid_linewidth,
            f"grid.{major_minor}.linewidth",
            "grid.linewidth",
        )
```

Code after:
                zorder = mlines.Line2D.zorder + 0.01
            else:
                zorder = mlines.Line2D.zorder
        self._zorder = zorder

        grid_color = mpl._val_or_rc(
            grid_color,
            f"grid.{major_minor}.color",
            "grid.color",
        )
        grid_linestyle = mpl._val_or_rc(
            grid_linestyle,
            f"grid.{major_minor}.linestyle",
            "grid.linestyle",
        )
        grid_linewidth = mpl._val_or_rc(
            grid_linewidth,
            f"grid.{major_minor}.linewidth",
            "grid.linewidth",
        )
        if grid_alpha is None and not mcolors._has_alpha_channel(grid_color):
            # alpha precedence: kwarg > color alpha > rcParams['grid.alpha']
            # Note: only resolve to rcParams if the color does not have alpha
            # otherwise `grid(color=(1, 1, 1, 0.5))` would work like
            #   grid(color=(1, 1, 1, 0.5), alpha=rcParams['grid.alpha'])
            # so the that the rcParams default would override color alpha.
            grid_alpha = mpl._val_or_rc(
                # grid_alpha is None so we can use the first key
                mpl.rcParams[f"grid.{major_minor}.alpha"],
                "grid.alpha",
            )

        grid_kw = {k[5:]: v for k, v in kwargs.items() if k != "rotation_mode"}

        self.tick1line = mlines.Line2D(
            [], [],
            color=color, linestyle="none", zorder=zorder, visible=tick1On,
            markeredgecolor=color, markersize=self._size, markeredgewidth=self._width,
        )
        self.tick2line = mlines.Line2D(
            [], [],
            color=color, linestyle="none", zorder=zorder, visible=tick2On,
            markeredgecolor=color, markersize=self._size, markeredgewidth=self._width,
        )
        self.gridline = mlines.Line2D(
            [], [],
            color=grid_color, alpha=grid_alpha, visible=gridOn,
            linestyle=grid_linestyle, linewidth=grid_linewidth, marker="",
            **grid_kw,
        )
        self.gridline.get_path()._interpolation_steps = \