From 946f07e7e9b5c506b4c507be6349a01ac0ffd05d Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Thu, 1 Aug 2024 11:47:21 +0200 Subject: [PATCH] Type hint .transport.{CHN_IND,roadmap} (#210) --- message_ix_models/model/transport/CHN_IND.py | 8 ++++---- message_ix_models/model/transport/roadmap.py | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/message_ix_models/model/transport/CHN_IND.py b/message_ix_models/model/transport/CHN_IND.py index 92107219fd..de50fe7d79 100644 --- a/message_ix_models/model/transport/CHN_IND.py +++ b/message_ix_models/model/transport/CHN_IND.py @@ -67,7 +67,7 @@ def _convert(group_df): return group_df.assign(Value=qty.magnitude, Units=qty.units) -def split_variable(s): +def split_variable(s) -> pd.DataFrame: """Split strings in :class:`pandas.Series` *s* into Variable and Mode. Parameters @@ -97,7 +97,7 @@ def split_variable(s): return df -def get_ind_item_data(): +def get_ind_item_data() -> pd.DataFrame: """Retrieve activity data for rail and road transport for India from iTEM. Data is obtained from iTEM database's file ``T000.csv`` and filtered for the @@ -134,7 +134,7 @@ def get_ind_item_data(): return all_data -def get_chn_ind_pop(): +def get_chn_ind_pop() -> pd.DataFrame: """Retrieve population data for China and India. The dataset is a ``.csv`` file in */data* and was retrieved from `OECD @@ -157,7 +157,7 @@ def get_chn_ind_pop(): return pop -def get_chn_ind_data(private_vehicles=False): +def get_chn_ind_data(private_vehicles=False) -> pd.DataFrame: """Read transport activity and vehicle stock data for China and India. The data is read from ``data/transport`` folder (data for China from NBSC) and diff --git a/message_ix_models/model/transport/roadmap.py b/message_ix_models/model/transport/roadmap.py index a4d1a8d73d..ca5a066e36 100644 --- a/message_ix_models/model/transport/roadmap.py +++ b/message_ix_models/model/transport/roadmap.py @@ -83,7 +83,9 @@ ) -def get_roadmap_data(context, region=("Africa", "R11_AFR"), years=None, plot=False): +def get_roadmap_data( + context, region=("Africa", "R11_AFR"), years=None, plot=False +) -> pd.DataFrame: """Read transport activity data for Africa. The data is read from ``RoadmapResults_2017.xlsx``, which is already aggregated