Skip to content

Conversation

@YooSunYoung
Copy link
Collaborator

The configuration per McStas version seems to be used in a few places so I turned it into a dataclass.
In this way, we don't have to always pass the default dictionary to make a new one.
We can simply add a new field with default value in the dataclass.

_get_mcstas_version_settings makes sure the registry is sorted before it tries to find the matching setting so now we don't have to worry about the registry being sorted.

I made both registry (mapping, dict) object and the dataclass to be read-only so that we can't accidentally mess it up.
In case you want to keep it editable, I added the keyword-only argument that you can pass a registry your self.

@mads-bertelsen
Copy link
Contributor

Those updates make the structure neater and safer, thanks!

@mads-bertelsen mads-bertelsen merged commit 8098b79 into main Jun 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants