Add a public tuning and measurement tool holder - #432
Merged
gupichon merged 1 commit intoSep 17, 2026
Conversation
gupichon
requested review from
GamelinAl,
JeanLucPons,
TeresiaOlsson,
gubaidulinvadim and
kparasch
and removed request for
JeanLucPons and
kparasch
September 17, 2026 12:18
GamelinAl
approved these changes
Sep 17, 2026
JeanLucPons
approved these changes
Sep 17, 2026
gupichon
merged commit Sep 17, 2026
6e3aa86
into
199-elementholder-api-refurbishment
3 checks passed
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.
Description
Adds a public
toolproperty (ToolHolder) onElementHolder, mirroringRFHolder. It exposestool.get(name)/tool.get()for name-based/untyped access to all configured tuning and measurement tools, plus typed convenience properties (tune,trm,orbit,orm,chromaticity,crm,dispersion) that resolve theirDEFAULT_...name and validate the resolved object's type, raising a clearPyAMLExceptionwhen it's missing or of the wrong type. Something the previous flat_TOOLSdict never checked.Related Issue
Features/issues described there are:
ToolHolderwas added (pyaml/common/holders/tool_holder.py) and wired up asElementHolder.tool, because tools were only reachable through ad-hocget_xxx_tuning(name)methods and 7 hardcoded default-name properties directly onElementHolder, with no type validation.tool.get(name=None)returns a named tool or, when no name is given, all configured tools as anElementArray, because the epic (ElementHolder API refurbishment #199) wants a consistentget()-based API across all sub-holders.Changes to existing functionality
ElementHolder.tune/.trm/.orbit/.orm/.chromaticity/.crm/.dispersion: reimplemented as aliases delegating toself.tool.<name>, because the epic wants these hardcoded-default properties centralized undertoolwhile keeping the existing public API unchanged. The underlyingget_xxx_tuning(name)methods (named lookup) are untouched. Behavior is unchanged for correctly-typed configurations; a configuration where aDEFAULT_...name pointed to the wrong tool type would previously return that (wrong) object silently and now raisesPyAMLExceptioninstead.Testing
The following tests (compatible with pytest) were added to
tests/tuning_tools/test_tool_accessors.py:Verify that your checklist complies with the project
tests/tuning_tools/test_tuning_orm.py::test_tuning_orm, a Windows-onlyNamedTemporaryFiledouble-open issue)ToolHolderclass docstring sotooland its properties are discoverable viahelp())