20 lines
494 B
Python
20 lines
494 B
Python
"""
|
|
Common functions that are used all over the package
|
|
"""
|
|
|
|
from .errors import ValueOutOfBoundsError
|
|
|
|
def check_bounds(bounds: tuple[float, float] | tuple[int, int], value: float | int):
|
|
"""
|
|
Checks the whether the given value is within bounds
|
|
|
|
Parameters
|
|
---
|
|
bounds: tuple[float, float]
|
|
The bounds to check within
|
|
value: float
|
|
The value to check
|
|
"""
|
|
if value < bounds[0] or value > bounds[1]:
|
|
raise ValueOutOfBoundsError(bounds, value)
|