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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
# SPDX-FileCopyrightText: All Contributors to the PyTango project
# SPDX-License-Identifier: LGPL-3.0-or-later
"""
This is an internal PyTango module.
"""
__all__ = ("group_reply_init",)
__docformat__ = "restructuredtext"
from tango.utils import document_method as __document_method
from tango._tango import GroupReply, GroupCmdReply, GroupAttrReply, ExtractAs
def __GroupCmdReply__get_data(self):
return self.get_data_raw().extract()
def __GroupAttrReply__get_data(self, extract_as=ExtractAs.Numpy):
# GroupAttrReply.__get_data() extracts the data from the object, so
# two successive calls to get_data() result in the second one returning
# an empty value, which is an unexpected behaviour.
# That's why we cache the result of the first call.
try:
data, orig_extract_as = self.__dataCache
except AttributeError:
data = self.__get_data(extract_as)
self.__dataCache = data, extract_as
return data
if extract_as != orig_extract_as:
raise Exception(
"Successive calls to get_data() must receive the same"
" parameters as the first one."
)
return data
def __init_GroupReply():
GroupCmdReply.get_data = __GroupCmdReply__get_data
GroupAttrReply.get_data = __GroupAttrReply__get_data
def __doc_GroupReply():
def document_method(method_name, desc, append=True):
return __document_method(GroupReply, method_name, desc, append)
GroupReply.__doc__ = """
This is the base class for the result of an operation on a
PyTangoGroup, being it a write attribute, read attribute, or
command inout operation.
It has some trivial common operations:
- has_failed(self) -> bool
- group_element_enabled(self) ->bool
- dev_name(self) -> str
- obj_name(self) -> str
- get_err_stack(self) -> DevErrorList
"""
__document_method(
GroupCmdReply,
"get_data",
"""
get_data(self) -> any
Get the actual value stored in the GroupCmdRply, the command
output value.
It's the same as self.get_data_raw().extract()
Parameters : None
Return : (any) Whatever is stored there, or None.
""",
)
__document_method(
GroupCmdReply,
"get_data_raw",
"""
get_data_raw(self) -> any
Get the DeviceData containing the output parameter
of the command.
Parameters : None
Return : (DeviceData) Whatever is stored there, or None.
""",
)
__document_method(
GroupAttrReply,
"get_data",
"""
get_data(self, extract_as=ExtractAs.Numpy) -> DeviceAttribute
Get the DeviceAttribute.
Parameters :
- extract_as : (ExtractAs)
Return : (DeviceAttribute) Whatever is stored there, or None.
""",
)
def group_reply_init(doc=True):
__init_GroupReply()
if doc:
__doc_GroupReply()
|