Skip to main content

Python function

upper_bounded_default

upper_bounded_default()​

max.pipelines.upper_bounded_default(upper_bound, default)

source

Returns a value not exceeding the upper bound.

Given an upper bound and an optional default value, returns the default if it is within bound, otherwise the upper bound (or raises if default exceeds the bound).

Parameters:

  • upper_bound (int) – The upper bound to use.
  • default (int | None) – The default value to use, or None to use the upper bound.

Raises:

ValueError – If the provided default value exceeds the upper bound.

Returns:

The final value.

Return type:

int