Repository navigation
increase robustness of dataclass from dict; add missing electricity pricing update config - #3541
Merged
Merged
Conversation
…ricing update config
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the configuration migration and dataclass construction utilities to better handle newly added electricity pricing provider config fields and dataclass defaults.
Changes:
- Bump
UpdateConfig.DATASTORE_VERSIONto129and add anupgrade_datastore_129migration to backfill missing tariff-provider config fields (e.g.,update_hours,includes_grid_fee). - Improve
dataclass_from_dictto correctly apply dataclass field defaults, includingdefault_factory, when input dict keys are missing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/helpermodules/update_config.py |
Bumps datastore version and adds migration logic to populate missing electricity pricing provider configuration values. |
packages/dataclass_utils/_dataclass_from_dict.py |
Enhances dict-to-dataclass conversion to honor dataclass defaults/default_factories when constructor args are missing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return {topic: provider} | ||
| return None | ||
| self._loop_all_received_topics(upgrade) | ||
| # self._append_datastore_version(129) |
Comment on lines
+38
to
+44
| if is_dataclass(cls): | ||
| dataclass_field = next((field for field in fields(cls) if field.name == argument_name), None) | ||
| if dataclass_field is not None: | ||
| if dataclass_field.default_factory is not MISSING: | ||
| value = dataclass_field.default_factory() | ||
| elif dataclass_field.default is not MISSING: | ||
| value = dataclass_field.default |
ndrsnhs
pushed a commit
to ndrsnhs/core
that referenced
this pull request
Aug 24, 2026
…ricing update config (openWB#3541) * increase robustness of dataclass from dict; add missing electricity pricing update config * flake8, remove coment * add test
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#3446 (comment)