[pytango] 76/98: Fix Group.get_device method (issue #21)

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


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

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

commit 234da4583dea0c0f4cbe0b6339e845902ae8979c
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date:   Tue Aug 9 15:03:01 2016 +0200

    Fix Group.get_device method (issue #21)
---
 tango/group.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tango/group.py b/tango/group.py
index d4159d7..e5f5f63 100644
--- a/tango/group.py
+++ b/tango/group.py
@@ -47,8 +47,10 @@ def _get_one_item(group, key):
 # The proxy is useful for add(group). In this case the parameter 'group'
 # becomes useless. With the proxy we make that parameter come to live
 # again before returning.
-# The other function that needs to be adapted to this is get_group because
+# Another function that needs to be adapted to this is get_group because
 # we want to return a Group, not a __Group!
+# The get_device method also needs to be adapted in order to properly
+# initialize the returned proxy with its python attributes.
 class Group:
     """A Tango Group represents a hierarchy of tango devices. The hierarchy
     may have more than one level. The main goal is to group devices with
@@ -91,6 +93,11 @@ class Group:
         else:
             raise TypeError('Parameter patterns: Should be a str or a sequence of str.')
 
+    def get_device(self, name_or_index):
+        proxy = self.__group.get_device(name_or_index)
+        proxy.__init__(proxy)
+        return proxy
+
     def get_group(self, group_name):
         internal = self.__group.get_group(group_name)
         if internal is None:
@@ -133,16 +140,16 @@ class Group:
 
 def __init_proxy_Group():
     proxy_methods = [
-        # 'add',
+        # 'add',  # Needs to be adapted
         'command_inout_asynch',
         'command_inout_reply',
         'contains',
         'disable',
         'enable',
-        'get_device',
+        # 'get_device',  # Needs to be adapted
         'get_device_list',
         'get_fully_qualified_name',
-        # 'get_group',
+        # 'get_group',   # Needs to be adapted
         'get_name',
         'get_size',
         'is_enabled',

-- 
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