Skip to content

Commit

Permalink
Force use of "iamc:" genno config handler during migration
Browse files Browse the repository at this point in the history
- Remove deprecated Key.from_str_or_key().
  • Loading branch information
khaeru committed Aug 31, 2023
1 parent 57702fb commit cc0d054
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion message_ix_models/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def iamc(c: Reporter, info):
from message_ix_models.report.util import collapse

# Common
base_key = Key.from_str_or_key(info["base"])
base_key = Key(info["base"])

# Use message_ix_models custom collapse() method
info.setdefault("collapse", {})
Expand Down Expand Up @@ -376,6 +376,13 @@ def prepare_reporter(
except ModuleNotFoundError:
pass # Currently in message_data

# Force re-installation of the function iamc() in this file as the handler for
# "iamc:" sections in global.yaml. Until message_data.reporting is removed, then
# importing it will cause the iamc() function in *that* file to override the one
# registered above.
# TODO Remove, once message_data.reporting is removed.
genno.config.handles("iamc")(iamc)

# Handle `report/config` setting passed from calling code
context.setdefault("report", dict())
context.report.setdefault("config", dict())
Expand Down

0 comments on commit cc0d054

Please sign in to comment.