interval#

Class for working with bounds.

Classes

Interval(bounds[, inclusive])

Class representing a range of numeric values.

class data_morph.bounds.interval.Interval(bounds: Iterable[Number], inclusive: bool = False)[source]#

Bases: object

Class representing a range of numeric values.

Parameters:
  • bounds (Iterable[numbers.Number]) – A 2-dimensional numeric iterable.

  • inclusive (bool, default False) – Whether the bounds include the endpoints. Default is exclusive.

adjust_bounds(value: Number) None[source]#

Adjust bound range.

Parameters:

value (numbers.Number) – The amount to change the range by (half will be applied to each end).

clone() Interval[source]#

Clone this instance.

Returns:

A new Interval instance with the same bounds.

Return type:

Interval

property range: Number#

Calculate the range (width) of the interval.

Returns:

The range covered by the interval.

Return type:

numbers.Number