Is there a way to indicate a "valid range" in a Python docstring using Sphinx? For example, consider the following linear function.
def f(m, x, b):
"""
Returns the `y` value of a linear function using slope-intercept form.
:param x: The x-axis value.
:type x: float
:param m: The slope of the linear function.
:type m: float
:param b: The y-intercept.
:type b: float
"""
if x < 0:
raise ValueError('The min "x" value of this function is 0')
return m * x + b
Is there a way to indicate the domain of x
to be something like "x must be greater than zero"? Or in interval notation, [0, infinity]
.
Specifically, is there a way to document this in a Python docstring using Sphinx?