Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/tango/tangoattr.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3from daiquiri.core.hardware.abstract import HardwareProperty 

4from daiquiri.core.hardware.abstract.tangoattr import TangoAttr as AbstractTangoAttr 

5from daiquiri.core.hardware.tango.object import ( 

6 TangoObject, 

7 TangoStateProperty, 

8 TangoAttrProperty, 

9) 

10 

11import logging 

12 

13logger = logging.getLogger(__name__) 

14 

15 

16class TangoAttr(TangoObject, AbstractTangoAttr): 

17 def __init__(self, attrname: str, **kwargs): 

18 self.__attrname = attrname 

19 TangoObject.__init__(self, **kwargs) 

20 

21 def _get_attrname(self): 

22 return self.__attrname 

23 

24 PROPERTY_MAP = { 

25 "state": TangoStateProperty("state"), 

26 "status": HardwareProperty("status"), 

27 "value": TangoAttrProperty("value", attrname=_get_attrname), 

28 "quality": TangoAttrProperty("quality", attrname=_get_attrname), 

29 "name": TangoAttrProperty("name", attrname=_get_attrname), 

30 "label": TangoAttrProperty("label", attrname=_get_attrname), 

31 "description": TangoAttrProperty("description", attrname=_get_attrname), 

32 "unit": TangoAttrProperty("unit", attrname=_get_attrname), 

33 "display_unit": TangoAttrProperty("display_unit", attrname=_get_attrname), 

34 "format": TangoAttrProperty("format", attrname=_get_attrname), 

35 "data_type": TangoAttrProperty("data_type", attrname=_get_attrname), 

36 } 

37 

38 

39Tangoattr = TangoAttr