InfiniteBudget#

class council.contexts.InfiniteBudget[source]#

Bases: Budget

Helper class representing a budget with no duration and no limits

add_consumption(value: float, unit: str, kind: str)#

adds/registers a consumption into the budget

add_consumptions(consumptions: Iterable[Consumption]) None#

adds/registers many consumptions into the budget

can_consume(value: float, unit: str, kind: str) bool#

returns True if the given consumption is allowed (will not exhaust the budget). False otherwise

property deadline: float#

the deadline of the budget, which when the budget expires

static default() Budget#

Helper function that create a new Budget with a default value.

Returns:

Budget

property duration: float#

the initial duration of the budget

is_expired() bool[source]#

Check if the budget is expired :returns: True is the budget is expired. Otherwise False

property remaining_duration: float#

the remaining duration in the budget