tango.pyaml.attribute_read_only#

Read-only scalar Tango attribute.

Classes

AttributeReadOnly(attribute[, unit, range, ...])

Read-only Tango attribute.

AttributeReadOnlyConfig(*, attribute[, ...])

Configuration model for a read-only Tango attribute.

class tango.pyaml.attribute_read_only.AttributeReadOnly(attribute, unit='', range=None, index=None)#

Bases: Attribute, DynamicValidation

Read-only Tango attribute.

Behaves like Attribute but rejects every write and never checks the Tango attribute writability on initialization. get() returns the readback value instead of the last written value.

Parameters:
  • attribute (str) – Full path of the Tango attribute (e.g., ‘my/ps/device/current’).

  • unit (str, optional) – The unit of the attribute.

  • range (tuple(min, max), optional) – Range of valid values. Use null for -∞ or +∞.

  • index (int, optional) – Zero-based index into a SPECTRUM attribute. When set, the instance behaves as a read-only scalar view of one vector element; writes are always rejected and a SPECTRUM data_format is enforced on init.

_attribute#

Full path of the Tango attribute.

Type:

str

_unit#

Unit of the attribute.

Type:

str

_range#

Configured range, or None to query Tango.

Type:

tuple of (float or None, float or None) or None

_index#

Index into a SPECTRUM attribute, or None for scalar access.

Type:

int or None

set(value)#

Disallowed write operation.

set_and_wait(value)#

Disallowed synchronous write operation.

get()#

Return the current readback value of the attribute.

get()#

Return the current readback value of the attribute.

A read-only attribute has no setpoint, so this is equivalent to readback().value.

Returns:

float – The readback value.

Raises:

pyaml.PyAMLException – If the Tango read fails.

Return type:

float

set(value)#

Disallowed write operation.

Parameters:

value (float) – Ignored.

Raises:

pyaml.PyAMLException – Always raised because the attribute is read-only.

set_and_wait(value)#

Disallowed synchronous write operation.

Parameters:

value (float) – Ignored.

Raises:

pyaml.PyAMLException – Always raised because the attribute is read-only.

class tango.pyaml.attribute_read_only.AttributeReadOnlyConfig(*, attribute, unit='', range=None, index=None)#

Bases: AttributeConfig

Configuration model for a read-only Tango attribute.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].