[pytango] 16/26: add a run_server class method to Device

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


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

sbodomerle-guest pushed a commit to annotated tag v8.1.8
in repository pytango.

commit 660a141fa0fc7ac5ff1085fbdd933de58de1ce7e
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date:   Tue Oct 6 17:13:21 2015 +0200

    add a run_server class method to Device
---
 src/boost/python/server.py | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index 59f7faf..e0cd148 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -444,7 +444,7 @@ class Device(LatestDeviceImpl):
     def get_device_properties(self, ds_class = None):
         if ds_class is None:
             try:
-                # Call this method in a try/except in case this is called during 
+                # Call this method in a try/except in case this is called during
                 # the DS shutdown sequence
                 ds_class = self.get_device_class()
             except:
@@ -458,7 +458,7 @@ class Device(LatestDeviceImpl):
                 value = pu.get_property_values(prop_name, class_prop)
                 self._tango_properties[prop_name] = value
             for prop_name in self.device_property_list:
-                value = self.prop_util.get_property_values(prop_name, 
+                value = self.prop_util.get_property_values(prop_name,
                                                            self.device_property_list)
                 self._tango_properties[prop_name] = value
         except DevFailed as df:
@@ -481,6 +481,26 @@ class Device(LatestDeviceImpl):
         """
         pass
 
+    @classmethod
+    def run_server(cls, args=None, **kwargs):
+        """Run the class as a device server.
+        It is based on the PyTango.server.run method.
+
+        The difference is that the device class
+        and server name are automatically given.
+
+        Args:
+            args (iterable): args as given in the PyTango.server.run method
+                             without the server name. If None, the sys.argv
+                             list is used
+            kwargs: the other keywords argument are as given
+                    in the PyTango.server.run method.
+        """
+        if args is None:
+            args = sys.argv[1:]
+        args = [cls.__name__] + list(args)
+        return run((cls,), args, **kwargs)
+
 
 class attribute(AttrData):
     '''

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