Closed tngTUDOR closed 2 years ago
Using the Tuple
class instead of the basic type tuple
should solve the issue:
diff --git a/carculator/energy_consumption.py b/carculator/energy_consumption.py
index b121caa..dfbc23e 100644
--- a/carculator/energy_consumption.py
+++ b/carculator/energy_consumption.py
@@ -4,7 +4,7 @@ one for calculating the auxiliary energy needs, and another one for calculating
energy needs.
"""
-from typing import Any, Union
+from typing import Any, Union, Tuple
import numexpr as ne
import numpy as np
@@ -132,7 +132,7 @@ class EnergyConsumptionModel:
frontal_area: Union[float, np.ndarray, xr.DataArray],
sizes: Union[str, np.ndarray, xr.DataArray],
motor_power: Union[float, np.ndarray, xr.DataArray] = 0,
- ) -> tuple[Union[float, Any], Any, Union[float, Any]]:
+ ) -> Tuple[Union[float, Any], Any, Union[float, Any]]:
"""
Calculate energy used and recuperated for a given vehicle per km driven.
Thanks. Should be fixed now. I also setup github action to run pytest on 3.7, 3.8 and 3.9 https://github.com/romainsacchi/carculator/runs/5467871531?check_suite_focus=true
Current
Tests with python 3.7 and 3.8 don't pass because of:
Expected
The readme of the repo says carculator is compatible with python 3.7 and onwards. If this is still the case, a fix for this bug is necessary.