Conversation
gupichon
requested review from
JeanLucPons,
TeresiaOlsson and
gubaidulinvadim
September 16, 2026 15:12
JeanLucPons
approved these changes
Sep 17, 2026
gupichon
merged commit Sep 17, 2026
280f10a
into
199-elementholder-api-refurbishment
3 checks passed
11 tasks
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
Extends
MagnetsHolderwith aget_cfm()shortcut to fetch all combined-function magnets, and adds dynamic attribute access for configured array names (e.g.magnets.QuadForTuneinstead ofmagnets.get("QuadForTune")) across allGenericArrayHolder-based holders (MagnetsHolder,CombinedFunctionMagnetsHolder,SerializedMagnetsHolder,BPMsHolder).dir()is also extended so interactive completion (IPython/Jupyter) proposes configured array names.Related Issue
Features/issues described there are:
magnets.get_cfm()was added, delegating to the existingcombined_function_magnets.get()— no new array-construction logic.GenericArrayHolder.__getattr__, generalized to the base class (broader scope than requested in the issue) rather than onlyMagnetsHolder, since the same navigation is useful onCombinedFunctionMagnetsHolder/SerializedMagnetsHolder/BPMsHolderand the mechanism is identical.__getattr__only triggers on lookup failure, so it never shadowsget/add/private attributes, and raisesAttributeErrorfor unknown or non-identifier names.Changes to existing functionality
GenericArrayHolder/GenericElementHolderhad no prior__getattr__/__dir__; existing attribute/method resolution is unaffected since__getattr__only runs after normal lookup fails.Testing
The following tests (compatible with pytest) were added:
tests/common/test_array_holder_navigation.py:get(), forMagnetsHolder,CombinedFunctionMagnetsHolder,BPMsHolder, andSerializedMagnetsHolderAttributeErrorget,add)dir()dir()includes configured array names for completionget_cfm()returns aCombinedFunctionMagnetArraymatchingcombined_function_magnets.get()test_issue_373_example: reproduces the issue's example code verbatim against real test-lattice data (tests/config/EBSTune-patterns.yaml)tests/test_load_conf_with_code.py: one extra assertion exercising dynamic attribute access end-to-end (sr.live.bpms.BPM)Verify that your checklist complies with the project
tests/tuning_tools/test_tuning_orm.py, a Windows-onlyNamedTemporaryFiledouble-open issue, unaffected by this change)help())