[pytango] 96/122: Clean up device_proxy module

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:18:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to tag v9.2.1
in repository pytango.

commit fd02a8ca8f85c4cdcf2f0406affd9a6ff26aa824
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date:   Wed Dec 14 16:54:02 2016 +0100

    Clean up device_proxy module
---
 tango/device_proxy.py | 75 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 58 insertions(+), 17 deletions(-)

diff --git a/tango/device_proxy.py b/tango/device_proxy.py
index a3ff3de..255ba56 100644
--- a/tango/device_proxy.py
+++ b/tango/device_proxy.py
@@ -9,24 +9,19 @@
 # See LICENSE.txt for more info.
 # ------------------------------------------------------------------------------
 
-"""
-This is an internal PyTango module.
-"""
+"""Define python methods for DeviceProxy object."""
 
 from __future__ import with_statement
 
-__all__ = ["device_proxy_init", "get_device_proxy"]
-
-__docformat__ = "restructuredtext"
-
 import time
 import threading
 import collections
 
-from ._tango import StdStringVector, DbData, DbDatum, AttributeInfo, \
-    AttributeInfoEx, AttributeInfoList, AttributeInfoListEx, DeviceProxy, \
-    __CallBackAutoDie, __CallBackPushEvent, EventType, DevFailed, Except, \
-    ExtractAs, GreenMode, constants
+from ._tango import StdStringVector, DbData, DbDatum, AttributeInfo
+from ._tango import AttributeInfoEx, AttributeInfoList, AttributeInfoListEx
+from ._tango import DeviceProxy, __CallBackAutoDie, __CallBackPushEvent
+from ._tango import EventType, DevFailed, Except, ExtractAs, GreenMode
+from ._tango import constants
 
 from .utils import is_pure_str, is_non_str_seq, is_integer
 from .utils import seq_2_StdStringVector, StdStringVector_2_seq
@@ -37,8 +32,15 @@ from .utils import dir2
 from .green import result, submit, green, green_cb
 from .green import get_green_mode, get_event_loop, get_wait_default_value
 
+
+__all__ = ["device_proxy_init", "get_device_proxy"]
+
+__docformat__ = "restructuredtext"
+
+
 _UNSUBSCRIBE_LIFETIME = 60
 
+
 def get_device_proxy(*args, **kwargs):
     """get_device_proxy(self, dev_name, green_mode=None, wait=True, timeout=True) -> DeviceProxy
     get_device_proxy(self, dev_name, need_check_acc, green_mode=None, wait=True, timeout=None) -> DeviceProxy
@@ -337,22 +339,28 @@ def __DeviceProxy__dir(self):
 def __DeviceProxy__getitem(self, key):
     return self.read_attribute(key)
 
+
 def __DeviceProxy__setitem(self, key, value):
     return self.write_attribute(key, value)
 
+
 def __DeviceProxy__contains(self, key):
     return key.lower() in map(str.lower, self.get_attribute_list())
 
+
 def __DeviceProxy__read_attribute(self, value, extract_as=ExtractAs.Numpy):
     return __check_read_attribute(self._read_attribute(value, extract_as))
 
-#def __DeviceProxy__read_attribute(self, value, extract_as=ExtractAs.Numpy,
-#                                  green_mode=None, wait=True, timeout=None):
-#    green_mode, submit = submitable(green_mode)
-#    result = submit(__DeviceProxy__read_attribute_raw, self, value, extract_as=extract_as)
-#    return get_result(result, green_mode, wait=wait, timeout=timeout)
 
-def __DeviceProxy__read_attributes_asynch(self, attr_names, cb=None, extract_as=ExtractAs.Numpy):
+# def __DeviceProxy__read_attribute(self, value, extract_as=ExtractAs.Numpy,
+#                                   green_mode=None, wait=True, timeout=None):
+#     green_mode, submit = submitable(green_mode)
+#     result = submit(__DeviceProxy__read_attribute_raw, self, value, extract_as=extract_as)
+#     return get_result(result, green_mode, wait=wait, timeout=timeout)
+
+
+def __DeviceProxy__read_attributes_asynch(self, attr_names, cb=None,
+                                          extract_as=ExtractAs.Numpy):
     """
     read_attributes_asynch( self, attr_names) -> int
 
@@ -400,6 +408,7 @@ def __DeviceProxy__read_attributes_asynch(self, attr_names, cb=None, extract_as=
         cb2.attr_read = cb.attr_read
     return self.__read_attributes_asynch(attr_names, cb2, extract_as)
 
+
 def __DeviceProxy__read_attribute_asynch(self, attr_name, cb=None):
     """
     read_attribute_asynch( self, attr_name) -> int
@@ -411,6 +420,7 @@ def __DeviceProxy__read_attribute_asynch(self, attr_name, cb=None):
     """
     return self.read_attributes_asynch([attr_name], cb)
 
+
 def __DeviceProxy__read_attribute_reply(self, *args, **kwds):
     """
     read_attribute_reply( self, id, extract_as) -> int
@@ -422,6 +432,7 @@ def __DeviceProxy__read_attribute_reply(self, *args, **kwds):
     """
     return __check_read_attribute(self.read_attributes_reply(*args, **kwds)[0])
 
+
 def __DeviceProxy__write_attributes_asynch(self, attr_values, cb=None):
     """
     write_attributes_asynch( self, values) -> int
@@ -468,6 +479,7 @@ def __DeviceProxy__write_attributes_asynch(self, attr_values, cb=None):
         cb2.attr_write = cb.attr_write
     return self.__write_attributes_asynch(attr_values, cb2)
 
+
 def __DeviceProxy__write_attribute_asynch(self, attr_name, value, cb=None):
     """
     write_attributes_asynch( self, values) -> int
@@ -479,17 +491,20 @@ def __DeviceProxy__write_attribute_asynch(self, attr_name, value, cb=None):
     """
     return self.write_attributes_asynch([(attr_name, value)], cb)
 
+
 def __DeviceProxy__write_read_attribute(self, attr_name, value,
                                         extract_as=ExtractAs.Numpy):
     result = self._write_read_attribute(attr_name, value, extract_as)
     return __check_read_attribute(result)
 
+
 def __DeviceProxy__write_read_attributes(self, name_val,
                                          attr_read_names,
                                          extract_as=ExtractAs.Numpy):
     return self._write_read_attributes(name_val, attr_read_names,
                                        extract_as)
 
+
 def __DeviceProxy__get_property(self, propname, value=None):
     """
     get_property(propname, value=None) -> tango.DbData
@@ -553,6 +568,7 @@ def __DeviceProxy__get_property(self, propname, value=None):
             self._get_property(new_value)
             return DbData_2_dict(new_value)
 
+
 def __DeviceProxy__put_property(self, value):
     """
     put_property(self, value) -> None
@@ -606,6 +622,7 @@ def __DeviceProxy__put_property(self, value):
                         'a sequence<DbDatum> or a dictionary')
     return self._put_property(value)
 
+
 def __DeviceProxy__delete_property(self, value):
     """
     delete_property(self, value)
@@ -663,6 +680,7 @@ def __DeviceProxy__delete_property(self, value):
 
     return self._delete_property(new_value)
 
+
 def __DeviceProxy__get_property_list(self, filter, array=None):
     """
     get_property_list(self, filter, array=None) -> obj
@@ -744,6 +762,7 @@ def __DeviceProxy__get_attribute_config(self, value):
 
     raise TypeError('value must be a string or a sequence<string>')
 
+
 def __DeviceProxy__get_attribute_config_ex(self, value):
     """
     get_attribute_config_ex( self, name) -> AttributeInfoListEx :
@@ -784,6 +803,7 @@ def __DeviceProxy__get_attribute_config_ex(self, value):
 
     raise TypeError('value must be a string or a sequence<string>')
 
+
 def __DeviceProxy__get_command_config(self, value=(constants.AllCmd,)):
     """
     get_command_config( self) -> CommandInfoList
@@ -828,6 +848,7 @@ def __DeviceProxy__get_command_config(self, value=(constants.AllCmd,)):
 
     raise TypeError('value must be a string or a sequence<string>')
 
+
 def __DeviceProxy__get_pipe_config(self, value=None):
     """
     get_pipe_config( self) -> PipeInfoList
@@ -879,6 +900,7 @@ def __DeviceProxy__get_pipe_config(self, value=None):
 
     raise TypeError('value must be a string or a sequence<string>')
 
+
 def __DeviceProxy__set_attribute_config(self, value):
     """
     set_attribute_config( self, attr_info) -> None
@@ -953,6 +975,7 @@ def __DeviceProxy__set_attribute_config(self, value):
 
     return self._set_attribute_config(v)
 
+
 def __DeviceProxy__set_pipe_config(self, value):
     """
     set_pipe_config( self, pipe_info) -> None
@@ -998,6 +1021,7 @@ def __DeviceProxy__set_pipe_config(self, value):
 
     return self._set_pipe_config(v)
 
+
 def __DeviceProxy__get_event_map_lock(self):
     """
     Internal helper method"""
@@ -1007,6 +1031,7 @@ def __DeviceProxy__get_event_map_lock(self):
         self.__dict__['_subscribed_events_lock'] = threading.Lock()
     return self._subscribed_events_lock
 
+
 def __DeviceProxy__get_event_map(self):
     """
     Internal helper method"""
@@ -1016,6 +1041,7 @@ def __DeviceProxy__get_event_map(self):
         self.__dict__['_subscribed_events'] = dict()
     return self._subscribed_events
 
+
 def __DeviceProxy__subscribe_event (self, attr_name, event_type, cb_or_queuesize, filters=[], stateless=False, extract_as=ExtractAs.Numpy):
     """
     subscribe_event(self, attr_name, event, callback, filters=[], stateless=False, extract_as=Numpy) -> int
@@ -1107,6 +1133,7 @@ def __DeviceProxy__subscribe_event (self, attr_name, event_type, cb_or_queuesize
         se[event_id] = (cb, event_type, attr_name)
     return event_id
 
+
 def __DeviceProxy__unsubscribe_event(self, event_id):
     """
     unsubscribe_event(self, event_id) -> None
@@ -1144,6 +1171,7 @@ def __DeviceProxy__unsubscribe_event(self, event_id):
         self._pending_unsubscribe[event_id] = evt_info[0], timestamp + _UNSUBSCRIBE_LIFETIME
     self.__unsubscribe_event(event_id)
 
+
 def __DeviceProxy__unsubscribe_event_all(self):
     with self.__get_event_map_lock():
         se = self.__get_event_map()
@@ -1152,6 +1180,7 @@ def __DeviceProxy__unsubscribe_event_all(self):
     for event_id in event_ids:
         self.__unsubscribe_event(event_id)
 
+
 def __DeviceProxy__get_events(self, event_id, callback=None, extract_as=ExtractAs.Numpy):
     """
     get_events( event_id, callback=None, extract_as=Numpy) -> None
@@ -1214,6 +1243,7 @@ def __DeviceProxy__get_events(self, event_id, callback=None, extract_as=ExtractA
     else:
         raise TypeError("Parameter 'callback' should be None, a callable object or an object with a 'push_event' method.")
 
+
 def __DeviceProxy___get_info_(self):
     """Protected method that gets device info once and stores it in cache"""
     if not hasattr(self, '_dev_info'):
@@ -1223,33 +1253,42 @@ def __DeviceProxy___get_info_(self):
             return __TangoInfo()
     return self._dev_info
 
+
 def __DeviceProxy__str(self):
     info = self._get_info_()
     return "%s(%s)" % (info.dev_class, self.dev_name())
 
+
 def __DeviceProxy__str(self):
     info = self._get_info_()
     return "%s(%s)" % (info.dev_class, self.dev_name())
 
+
 def __DeviceProxy__read_pipe(self, pipe_name, extract_as=ExtractAs.Numpy):
     r = self.__read_pipe(pipe_name)
     return r.extract(extract_as)
 
+
 def __DeviceProxy__write_pipe(*args, **kwargs):
     raise NotImplementedError('writtable pipes not implemented in 9.2.0a')
 
+
 def __DeviceProxy__read_attributes(self, *args, **kwargs):
     return self._read_attributes(*args, **kwargs)
 
+
 def __DeviceProxy__write_attribute(self, *args, **kwargs):
     return self._write_attribute(*args, **kwargs)
 
+
 def __DeviceProxy__write_attributes(self, *args, **kwargs):
     return self._write_attributes(*args, **kwargs)
 
+
 def __DeviceProxy__ping(self, *args, **kwargs):
     return self._ping(*args, **kwargs)
 
+
 def __DeviceProxy__state(self, *args, **kwargs):
     """state(self) -> DevState
 
@@ -1273,6 +1312,7 @@ def __DeviceProxy__status(self, *args, **kwargs):
     """
     return self._status(*args, **kwargs)
 
+
 def __DeviceProxy__write_attribute_reply(self, *args, **kwargs):
     """
     write_attribute_reply(self, id) -> None
@@ -1314,6 +1354,7 @@ def __DeviceProxy__write_attribute_reply(self, *args, **kwargs):
     """
     return self.write_attributes_reply(*args, **kwargs)
 
+
 def __init_DeviceProxy():
     DeviceProxy.__init_orig__ = DeviceProxy.__init__
     DeviceProxy.__init__ = __DeviceProxy__init__

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list