Consumption#

class council.contexts.Consumption(value: float, unit: str, kind: str)[source]#

Bases: object

A class representing a consumption measurement with value, unit, and kind information.

_value#

The numeric value of the consumption measurement.

Type:

float

_unit#

The unit of measurement for the consumption (e.g., tokens, api_calls, etc.).

Type:

str

_kind#

The kind or category of the consumption.

Type:

str

__init__(value

float, unit: str, kind: str): Initializes a Consumption instance with the provided value, unit, and kind.

__init__(value: float, unit: str, kind: str) None[source]#

Initializes a Consumption instance.

Parameters:
  • value (float) – The numeric value of the consumption measurement.

  • unit (str) – The unit of measurement for the consumption (e.g., liters, watts, etc.).

  • kind (str) – The kind or category of the consumption (e.g., water, electricity, etc.).

add(value: float) Consumption[source]#

Returns a new Consumption instance with the value incremented by the specified value.

add_value(value: float) None[source]#

Increments the value of the consumption by the specified value.

subtract(value: float) Consumption[source]#

Returns a new Consumption instance with the value decremented by the specified value.

subtract_value(value: float) None[source]#

Decrements the value of the consumption by the specified value.