We need proper string representations for pyAML objects, implementing both __repr__ and __str__ methods.
Here is some proposal for key elements:
For example for pyaml.lattice.magnet
__repr__ Method:
- Should include both the
name and the control_mode (e.g., simulated vs. live) to avoid confusion.
__str__ Method:
- Should print detailed information about the magnet, e.g.:
Sextupole(name='SXF2', strength=809.008, currents=[140,...], hardware_name='AN01-AR/EM/SCF.02', control_mode='live', ...)
For pyaml.instrument.Instrument
__repr__ Method:
- Should include the instrument name (given in the configuration).
__str__ Method:
- Should include the instrument name (given in the configuration) and the name of the configuration file read (if any).
For tango.pyaml.controlsystem
__repr__ Method:
- Should include the instrument name and the control system type.
__str__ Method:
- Should include all of the above plus tango_host (for
tango.pyaml.controlsystem.TangoControlSystem).
For pyaml.lattice.simulator.Simulator
__repr__ Method:
- Should include the instrument name, the control system type.
__str__ Method:
- Should include all of the above plus the lattice name and energy.
For RWStrengthScalar and similar classes
__repr__ Method:
- Should include the linked property name (corresponding to
model.get_devices()[0].name()) and unit.
We need proper string representations for pyAML objects, implementing both
__repr__and__str__methods.Here is some proposal for key elements:
For example for
pyaml.lattice.magnet__repr__Method:nameand thecontrol_mode(e.g.,simulatedvs.live) to avoid confusion.__str__Method:For
pyaml.instrument.Instrument__repr__Method:__str__Method:For
tango.pyaml.controlsystem__repr__Method:__str__Method:tango.pyaml.controlsystem.TangoControlSystem).For
pyaml.lattice.simulator.Simulator__repr__Method:__str__Method:For
RWStrengthScalarand similar classes__repr__Method:model.get_devices()[0].name()) and unit.