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

Code before:
    def update(self, left=None, bottom=None, right=None, top=None,
               wspace=None, hspace=None):
        """
        Update the dimensions of the passed parameters. *None* means unchanged.
        """
        if ((left if left is not None else self.left)
                >= (right if right is not None else self.right)):
            raise ValueError('left cannot be >= right')
        if ((bottom if bottom is not None else self.bottom)
                >= (top if top is not None else self.top)):
            raise ValueError('bottom cannot be >= top')
        if left is not None:
            self.left = left
        if right is not None:
            self.right = right
        if bottom is not None:
            self.bottom = bottom
        if top is not None:
            self.top = top
        if wspace is not None:
            self.wspace = wspace
        if hspace is not None:
            self.hspace = hspace

    def reset(self):
        """Restore the positioning parameters to the default values"""
        for key in self.to_dict():
            setattr(self, key, mpl.rcParams[f'figure.subplot.{key}'])

    def to_dict(self):
        """Return the subplot parameters as a dict."""
        return self.__dict__.copy()


Review comment (suggestion):
```suggestion
        """Restore the subplot positioning parameters to the default rcParams values"""
```

Code after:
            The width of the padding between subplots,
            as a fraction of the average Axes width.
        hspace : float, optional
            The height of the padding between subplots,
            as a fraction of the average Axes height.
        """
        for key in ["left", "bottom", "right", "top", "wspace", "hspace"]:
            setattr(self, key, mpl.rcParams[f"figure.subplot.{key}"])
        self.update(left, bottom, right, top, wspace, hspace)

    def update(self, left=None, bottom=None, right=None, top=None,
               wspace=None, hspace=None):
        """
        Update the dimensions of the passed parameters. *None* means unchanged.
        """
        if ((left if left is not None else self.left)
                >= (right if right is not None else self.right)):
            raise ValueError('left cannot be >= right')
        if ((bottom if bottom is not None else self.bottom)
                >= (top if top is not None else self.top)):
            raise ValueError('bottom cannot be >= top')
        if left is not None:
            self.left = left
        if right is not None:
            self.right = right
        if bottom is not None:
            self.bottom = bottom
        if top is not None:
            self.top = top
        if wspace is not None:
            self.wspace = wspace
        if hspace is not None:
            self.hspace = hspace

    def reset(self):
        """Restore the subplot positioning parameters to the default rcParams values"""
        for key in self.to_dict():
            setattr(self, key, mpl.rcParams[f'figure.subplot.{key}'])

    def to_dict(self):
        """Return a copy of the subplot parameters as a dict."""
        return self.__dict__.copy()