Skip to content

All devices should have __repr__ method summary strings #17

Description

@kabanaty

When inspecting individual Device objects or sets of Device objects, they fill the terminal with pyepics nonsense. By including a __repr__ method, pertinent user information can be displayed cleanly.

Example:

>>> from slac_devices.reader import create_magnet
>>> QVM2 = create_magnet(name="QVM2", area="LTUH")
>>> QVM2
Magnet(name='QVM2', controls_information=MagnetControlInformation(control_name='QUAD:LTUH:120', PVs=MagnetPVSet(bctrl=<PV 'QUAD:LTUH:120:BCTRL', count=1, type=time_double, access=read/write>, bact=<PV 'QUAD:LTUH:120:BACT', count=1, type=time_double, access=read/write>, bdes=<PV 'QUAD:LTUH:120:BDES', count=1, type=time_double, access=read/write>, bcon=<PV 'QUAD:LTUH:120:BCON', count=1, type=time_double, access=read/write>, ctrl=<PV 'QUAD:LTUH:120:CTRL', count=1, type=time_enum, access=read/write>, bmin=<PV 'QUAD:LTUH:120:BMIN', count=1, type=time_double, access=read/write>, bmax=<PV 'QUAD:LTUH:120:BMAX', count=1, type=time_double, access=read/write>)), metadata=MagnetMetadata(area='LTUH', beam_path=['CU_HTXI', 'CU_HXR', 'CU_HXTES', 'CU_SFTH', 'SC_HXR'], sum_l_meters=1211.288, type='QUAD', safe_level=None, read_tolerance=None, hardware=None, l_eff=0.461, b_tolerance=None))
>>> 

Desired behavior:

>>> from slac_devices.reader import create_wire
>>> WS28144 = create_wire(name="WS28144", area="L3")
>>> WS28144
Wire(name='WS28144', area='L3', planes=X[32000-36000], Y[41000-44000], U[18000-22000])
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions