File: device_attribute.py

package info (click to toggle)
pytango 10.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,304 kB
  • sloc: python: 27,795; cpp: 16,150; sql: 252; sh: 152; makefile: 43
file content (46 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# SPDX-FileCopyrightText: All Contributors to the PyTango project
# SPDX-License-Identifier: LGPL-3.0-or-later

"""
This is an internal PyTango module.
"""

__all__ = ("device_attribute_init",)

__docformat__ = "restructuredtext"

import copy

from tango import DeviceAttribute, ExtractAs


def __DeviceAttribute__get_data(self):
    return self.get_data_raw().extract()


def __DeviceAttribute__init(self, da=None):
    if da is None:
        DeviceAttribute.__init_orig(self)
    else:
        DeviceAttribute.__init_orig(self, da)
        try:
            self.value = copy.deepcopy(da.value)
        except Exception:
            pass
        try:
            self.w_value = copy.deepcopy(da.w_value)
        except Exception:
            pass
        try:
            self.scalar_w_value = da.scalar_w_value
        except Exception:
            pass
        self.type = da.type
        self.is_empty = da.is_empty
        self.has_failed = da.has_failed


def device_attribute_init():
    DeviceAttribute.__init_orig = DeviceAttribute.__init__
    DeviceAttribute.__init__ = __DeviceAttribute__init
    DeviceAttribute.ExtractAs = ExtractAs