-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor/energy
- Loading branch information
Showing
6 changed files
with
122 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ __pycache__/ | |
# C extensions | ||
*.so | ||
|
||
#.vscode | ||
settings.json | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Generic collection of util functions and maps.""" | ||
|
||
from co2calculator.constants import TransportationMode | ||
from co2calculator.mobility.calculate_mobility import ( | ||
calc_co2_bicycle, | ||
calc_co2_bus, | ||
calc_co2_car, | ||
calc_co2_ferry, | ||
calc_co2_motorbike, | ||
calc_co2_pedelec, | ||
calc_co2_train, | ||
calc_co2_tram, | ||
) | ||
|
||
|
||
def get_calc_function_from_transport_mode( | ||
transport_mode: TransportationMode, | ||
) -> callable: | ||
transportation_mode_calc_function_map = { | ||
TransportationMode.CAR: calc_co2_car, | ||
TransportationMode.MOTORBIKE: calc_co2_motorbike, | ||
TransportationMode.BUS: calc_co2_bus, | ||
TransportationMode.TRAIN: calc_co2_train, | ||
TransportationMode.BICYCLE: calc_co2_bicycle, | ||
TransportationMode.TRAM: calc_co2_tram, | ||
TransportationMode.FERRY: calc_co2_ferry, | ||
TransportationMode.PEDELEC: calc_co2_pedelec, | ||
} | ||
return transportation_mode_calc_function_map[transport_mode] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.