Skip to content

Commit

Permalink
[#31] Add cost computation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stéphane Senart committed Feb 3, 2025
1 parent ba1cb37 commit 4af968f
Show file tree
Hide file tree
Showing 5 changed files with 384 additions and 33 deletions.
4 changes: 3 additions & 1 deletion gazpar2haws/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ def propagates_properties(cls, values):
if price_list in ["consumption_prices", "energy_taxes"]:
prices[0]["base_unit"] = "kWh"
else:
raise ValueError("Missing base_unit in first element of ['transport_prices', 'subscription_prices']")
raise ValueError(
"Missing base_unit in first element of ['transport_prices', 'subscription_prices']"
)

for i in range(len(prices) - 1):
if "end_date" not in prices[i]:
Expand Down
4 changes: 3 additions & 1 deletion gazpar2haws/pricer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def pricing_data(self) -> Pricing:
return self._pricing

# ----------------------------------
def compute(self, quantities: ConsumptionQuantityArray, price_unit: PriceUnit) -> CostArray: # pylint: disable=too-many-branches
def compute( # pylint: disable=too-many-branches
self, quantities: ConsumptionQuantityArray, price_unit: PriceUnit
) -> CostArray:

if quantities is None:
raise ValueError("quantities is None")
Expand Down
Loading

0 comments on commit 4af968f

Please sign in to comment.