From cb7039b6c0f94a73c59ba08abca96666dff1d609 Mon Sep 17 00:00:00 2001 From: marc-vdm Date: Wed, 11 Sep 2024 13:52:41 +0200 Subject: [PATCH 1/2] Better communication of scenario processing message --- premise/new_database.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/premise/new_database.py b/premise/new_database.py index b3de7802..4dd11f4b 100644 --- a/premise/new_database.py +++ b/premise/new_database.py @@ -926,11 +926,14 @@ def update(self, sectors: [str, list, None] = None) -> None: } if isinstance(sectors, str): + description = f"Processing scenarios for sector '{sectors}'" sectors = [ sectors, ] - - if sectors is None: + elif isinstance(sectors, list): + description = f"Processing scenarios for {len(sectors)} sectors" + elif sectors is None: + description = "Processing scenarios for all sectors" sectors = [s for s in list(sector_update_methods.keys())] assert isinstance(sectors, list), "sector_name should be a list of strings" @@ -944,7 +947,7 @@ def update(self, sectors: [str, list, None] = None) -> None: ) with tqdm( - total=len(self.scenarios), desc="Processing scenarios", ncols=70 + total=len(self.scenarios), desc=description, ncols=70 ) as pbar_outer: for scenario in self.scenarios: # add database to scenarios From b2d9904bc649325c5a4c209e90f456388296f0d8 Mon Sep 17 00:00:00 2001 From: romainsacchi Date: Wed, 11 Sep 2024 11:53:13 +0000 Subject: [PATCH 2/2] Black reformating --- premise/new_database.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/premise/new_database.py b/premise/new_database.py index 4dd11f4b..4b51d454 100644 --- a/premise/new_database.py +++ b/premise/new_database.py @@ -946,9 +946,7 @@ def update(self, sectors: [str, list, None] = None) -> None: [item for item in sectors if item not in sector_update_methods] ) - with tqdm( - total=len(self.scenarios), desc=description, ncols=70 - ) as pbar_outer: + with tqdm(total=len(self.scenarios), desc=description, ncols=70) as pbar_outer: for scenario in self.scenarios: # add database to scenarios try: