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

Code before:

    def get_transform(self):
        """
        Return the `.Transform` object associated with this scale.
        """
        raise NotImplementedError()

    def set_default_locators_and_formatters(self, axis):
        """
        Set the locators and formatters of *axis* to instances suitable for
        this scale.
        """
        raise NotImplementedError()

    def limit_range_for_scale(self, vmin, vmax, minpos):
        """
        Return the range *vmin*, *vmax*, restricted to the
        domain supported by this scale (if any).

        *minpos* should be the minimum positive value in the data.
        This is used by log scales to determine a minimum value.
        """
        return vmin, vmax


def handle_axis_parameter(init_func):
    """
    Decorator to handle the optional *axis* parameter in scale constructors.

    This decorator ensures backward compatibility for scale classes that
    previously required an *axis* parameter. It allows constructors to work
    seamlessly with or without the *axis* parameter.

    Parameters
    ----------
    init_func : callable
        The original __init__ method of a scale class.

    Returns
    -------
    callable
        A wrapped version of *init_func* that handles the optional *axis*.

    Notes
    -----
    If the wrapped constructor defines *axis* as its first argument, the
    parameter is preserved when present. Otherwise, the value `None` is injected
    as the first argument.

    Examples
    --------

Review comment (suggestion):
```suggestion
def _make_axis_parameter_optional(init_func):
```
Let's be very explicit about the naming, and keep it internal. I don't expect that possible downstream Child classes will need to support optional axis parameters.

Code after:

    def get_transform(self):
        """
        Return the `.Transform` object associated with this scale.
        """
        raise NotImplementedError()

    def set_default_locators_and_formatters(self, axis):
        """
        Set the locators and formatters of *axis* to instances suitable for
        this scale.
        """
        raise NotImplementedError()

    def limit_range_for_scale(self, vmin, vmax, minpos):
        """
        Return the range *vmin*, *vmax*, restricted to the
        domain supported by this scale (if any).

        *minpos* should be the minimum positive value in the data.
        This is used by log scales to determine a minimum value.
        """
        return vmin, vmax


def _make_axis_parameter_optional(init_func):
    """
    Decorator to allow leaving out the *axis* parameter in scale constructors.

    This decorator ensures backward compatibility for scale classes that
    previously required an *axis* parameter. It allows constructors to be
    callerd with or without the *axis* parameter.

    For simplicity, this does not handle the case when *axis*
    is passed as a keyword. However,
    scanning GitHub, there's no evidence that that is used anywhere.

    Parameters
    ----------
    init_func : callable
        The original __init__ method of a scale class.

    Returns
    -------
    callable
        A wrapped version of *init_func* that handles the optional *axis*.

    Notes
    -----
    If the wrapped constructor defines *axis* as its first argument, the
    parameter is preserved when present. Otherwise, the value `None` is injected