Repository navigation
Use one accessor per element family with get/get_array (#531) - #535
Conversation
Plural holders, .all() and get_cfm() are removed, get returns one element and get_array an array everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gupichon-soleil
requested review from
GamelinAl,
JeanLucPons,
TeresiaOlsson and
gubaidulinvadim
November 27, 2026 12:49
gupichon-soleil
marked this pull request as ready for review
November 27, 2026 13:02
GamelinAl
requested changes
Dec 1, 2026
GamelinAl
left a comment
Member
There was a problem hiding this comment.
It looks good to me, just two minor points:
serialized_magnet.add_arrayskips the series checks thatmagnet.add_arraymakes, but saves into the same array list.
magnet.add_array("X4", ["QF1A", "~QF1A-C05"]) -> PyAMLException: QF1A-C05 cannot be excluded, it is driven by QF1A ...
serialized_magnet.add_array("X3", ["QF1A", "~QF1A-C05"]) -> accepted without error
serialized_magnet.add_array("X1", ["QF1E-C04"]) -> "Serialized magnet QF1E-C04 not defined"
I think they should have the same behaviour.
- The root holder still uses
fill_element_array(arrayName, elementNames), while every family now usesadd_array(array_name, element_names). Maybe just rename it?
This branch has not been deployed
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
Each element family now has one accessor, named in the singular, and the method decides what comes back:
get(name)returns one element,get_array(name)(or attribute access) returns a configured array,get_array()returns every element of the family. The same rule applies at the root of the holder and onrf,toolanddiagnostic.Related Issue
magnet/magnets,bpm/bpms, …) #468)Features/issues described there are:
GenericElementHolderandGenericArrayHolderare merged intoGenericHolder(pyaml/common/holders/generic_holder.py), and eachXHolder/XsHolderpair insub_holders.pyis merged into one class.get/get_array/ attribute /[key]on every family holder. Element names and array names stay in separate namespaces.ElementHolder.get(name)returns one element,get_array(name=None)is public (it replaces_get_array, also used by YellowPages).rf,rf.transmitter,toolanddiagnosticgainget_array(), and theirgetrequires a name.Changes to existing functionality
This is a breaking change, no deprecated alias is kept.
magnets,combined_function_magnets,serialized_magnets,diagnostic.bpms,.all(),magnets.get_cfm().holder.<family>.add_array(name, element_names), adding an element staysadd(element).sr.design.get("ArrayName")becomessr.design.get_array("ArrayName"),sr.design.get()becomessr.design.get_array(). Same fortool.get()anddiagnostic.get()without a name.magnetkeeps its scope:get,[]andget_array()see individual magnets. Serialized family names are still accepted in configured magnet arrays, and a family is obtained withserialized_magnet.get(name).serialized_magnet.get_array(name)shares the magnet arrays.diagnostic.bpm,magnet,combined_function_magnet, and the printed access line usesget_array("<name>")for arrays.pySC_interface, examples (scripts and notebooks) and docstrings are migrated.Testing
The following tests (compatible with pytest) were added or adapted:
test_get_returns_one_element_and_get_array_returns_a_configured_arraytest_element_names_and_array_names_live_in_separate_namespacestest_get_array_without_name_returns_every_element_of_the_familytest_serialized_magnet_holder_shares_the_magnet_arraystest_get_returns_one_element_whatever_its_family(root holder)test_rf_holders_get_array_return_every_plant_and_transmitterget_array()andget()without a name ontoolanddiagnosticVerify that your checklist complies with the project
test_tuning_ormfails on Windows only,PermissionErroron a temp file, same as on the base branch)🤖 Generated with Claude Code