[pytango] 345/483: fix filter error in setup.py. Improved server documentation

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


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

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit 456272585f666603ebf2dc85c39868579e721b19
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Fri Dec 13 08:49:27 2013 +0000

    fix filter error in setup.py. Improved server documentation
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@24565 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 doc/server/server.rst      |  68 ++++++------
 setup.py                   |  40 +++----
 src/boost/python/server.py | 259 +++++++++++++++++++++++++--------------------
 3 files changed, 202 insertions(+), 165 deletions(-)

diff --git a/doc/server/server.rst b/doc/server/server.rst
index 801b18e..86cfd81 100644
--- a/doc/server/server.rst
+++ b/doc/server/server.rst
@@ -21,14 +21,15 @@ high level API::
     class Clock(Device):
         __metaclass__ = DeviceMeta
 
-	time = attribute()
+        time = attribute()
 
-	def read_time(self):
-	    return time.time()
+        def read_time(self):
+            return time.time()
+
+        @command(din_type=str, dout_type=str)
+        def strftime(self, format):
+            return time.strftime(format)
 
-	@command(din_type=str, dout_type=str)
-	def strftime(self, format):
-	    return time.strftime(format)
 
     if __name__ == "__main__":
         server_run((Clock,))
@@ -58,47 +59,54 @@ using the high level API. The example contains:
 
         voltage = attribute()
 
-        current = attribute(label="Current",
-                            dtype=float,
+        current = attribute(label="Current", dtype=float,
                             display_level=DispLevel.EXPERT,
                             access=AttrWriteType.READ_WRITE,
-                            unit="A",
-                            format="8.4f",
-			    min_value=0.0, max_value=8.5,
-			    min_alarm=0.1, max_alarm=8.4,
-			    min_warning=0.5, max_warning=8.0,
-                            fget="get_current",
-                            fset="set_current",
+                            unit="A", format="8.4f",
+                            min_value=0.0, max_value=8.5,
+                            min_alarm=0.1, max_alarm=8.4,
+                            min_warning=0.5, max_warning=8.0,
+                            fget="get_current", fset="set_current",
                             doc="the power supply current")
-	
-	noise = attribute(label="Noise",
-			  dtype=((float,),),
-			  max_dim_x=1024, max_dim_y=1024,
-			  fget="get_noise")
+    
+        noise = attribute(label="Noise", dtype=((float,),),
+                          max_dim_x=1024, max_dim_y=1024,
+                          fget="get_noise")
  
         host = device_property(dtype=str)
         port = class_property(dtype=int, default_value=9788)
 
         def read_voltage(self):
-            self.info_stream("get voltage(%s, %d)" %(self.host, self.port))
+            self.info_stream("get voltage(%s, %d)" % (self.host, self.port))
             return 10.0
 
         def get_current(self):
             return 2.3456, time(), AttrQuality.ATTR_WARNING
-	
-	def set_current(self, current):
-	    print("Current set to %f" % current)
-	
-	def get_noise(self):
-	    return random_sample((1024, 1024))
+    
+        def set_current(self, current):
+            print("Current set to %f" % current)
+    
+        def get_noise(self):
+            return random_sample((1024, 1024))
 
-	@command(dtype_in=float)
-	def ramp(self, value):
-	    print("Ramping up...")
+        @command(dtype_in=float)
+        def ramp(self, value):
+            print("Ramping up...")
 
+    if __name__ == "__main__":
+        server_run((PowerSupply,))
 
 *Pretty cool, uh?*
 
+.. note::
+    the ``__metaclass__`` statement is mandatory due to a limitation in the
+    *boost-python* library used by PyTango.
+    
+    If you are using python 3 you can write instead::
+        
+        class PowerSupply(Device, metaclass=DeviceMeta)
+            pass
+
 API
 ---
 
diff --git a/setup.py b/setup.py
index bec1911..95e2efb 100644
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,7 @@ try:
         import IPython.genutils
         get_ipython_dir = IPython.genutils.get_ipython_dir
     _IPY_LOCAL = str(get_ipython_dir())
-except ImportError:
+except:
     IPython = None
 
 try:
@@ -67,8 +67,8 @@ def pkg_config(*packages, **config):
         if value not in config_values:
             config_values.append(value)
     return config
-        
-        
+
+
 def abspath(*path):
     """A method to determine absolute path for a given relative path to the
     directory where this setup.py script is located"""
@@ -105,7 +105,7 @@ def get_c_numpy():
         if os.path.isdir(inc):
             return inc
 
-        
+
 def has_c_numpy():
     return get_c_numpy() is not None
 
@@ -119,11 +119,11 @@ def has_numpy(with_src=True):
 
 def get_script_files():
 
-    FILTER_OUT = [],  # "winpostinstall.py",
+    FILTER_OUT = []  # "winpostinstall.py",
 
     if os.name != "nt":
         FILTER_OUT.append("pytango_winpostinstall.py")
-    
+
     scripts_dir = abspath("scripts")
     scripts = []
     items = os.listdir(scripts_dir)
@@ -164,14 +164,14 @@ def add_lib(name, dirs, sys_libs, env_name=None, lib_name=None, inc_suffix=None)
             lib64_dir = os.path.join(ENV, 'lib64')
             if os.path.isdir(lib64_dir):
                 lib_dirs.insert(0, lib64_dir)
-        
+
         if lib_name.startswith('lib'):
             lib_name = lib_name[3:]
         dirs['include_dirs'].append(inc_dir)
         dirs['library_dirs'].extend(lib_dirs)
         dirs['libraries'].append(lib_name)
 
-        
+
 class build(dftbuild):
 
     user_options = dftbuild.user_options + \
@@ -263,7 +263,7 @@ class build_ext(dftbuild_ext):
             ext.define_macros += [ ('PYTANGO_HAS_UNIQUE_PTR', '1') ]
         dftbuild_ext.build_extension(self, ext)
 
-        
+
 if sphinx:
     class build_doc(BuildDoc):
 
@@ -326,10 +326,10 @@ class install(dftinstall):
     sub_commands = list(dftinstall.sub_commands)
     sub_commands.append(('install_html', has_html))
 
-    
+
 def setup_args():
     macros = []
-    
+
     directories = {
         'include_dirs': [],
         'library_dirs': [],
@@ -337,7 +337,7 @@ def setup_args():
                          'omniDynamic4', 'COS4', 'omniORB4', 'omnithread'],
     }
     sys_libs = []
-    
+
     add_lib('omni', directories, sys_libs, lib_name='omniORB4')
     add_lib('zmq', directories, sys_libs, lib_name='libzmq')
     add_lib('tango', directories, sys_libs, inc_suffix='tango')
@@ -366,11 +366,11 @@ def setup_args():
 
         directories['include_dirs'].append(inc_dir)
         directories['library_dirs'].extend(lib_dirs)
-                
+
     directories['libraries'].append(boost_library_name)
 
     # special numpy configuration
-    
+
     numpy_c_include = get_c_numpy()
     if numpy_c_include is not None:
         directories['include_dirs'].append(numpy_c_include)
@@ -382,7 +382,7 @@ def setup_args():
 
     if 'posix' in os.name:
         directories = pkg_config(*sys_libs, **directories)
-    
+
     Release = get_release_info()
 
     author = Release.authors['Coutinho']
@@ -394,7 +394,7 @@ def setup_args():
         'PyTango.ipython',
         'PyTango.ipython.ipython_00_10',
         'PyTango.ipython.ipython_00_11',
-        'PyTango.ipython.ipython_10_00',        
+        'PyTango.ipython.ipython_10_00',
     ]
 
     py_modules = []
@@ -417,7 +417,7 @@ def setup_args():
     data_files = []
     if os.name == 'nt':
         data_files.append(('scripts', ['doc/_static/itango.ico']))
-    
+
     classifiers = [
         'Development Status :: 5 - Production/Stable',
         'Environment :: Other Environment',
@@ -434,7 +434,7 @@ def setup_args():
         'Topic :: Scientific/Engineering',
         'Topic :: Software Development :: Libraries',
     ]
-    
+
     # Note for PyTango developers:
     # Compilation time can be greatly reduced by compiling the file
     # src/precompiled_header.hpp as src/precompiled_header.hpp.gch
@@ -451,7 +451,7 @@ def setup_args():
 
     if please_debug:
         extra_compile_args += ['-g', '-O0']
-        extra_link_args += ['-g' , '-O0'] 
+        extra_link_args += ['-g' , '-O0']
 
     src_dir = abspath('src', 'boost', 'cpp')
     client_dir = src_dir
@@ -514,7 +514,7 @@ def setup_args():
         ext_package='PyTango',
         ext_modules=[_pytango],
         cmdclass=cmdclass)
-    
+
     return opts
 
 def main():
diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index 5c9b885..ce61449 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -50,102 +50,129 @@ Below is the complete table of equivalences.
 ========================================  ========================================
  type                                      tango type                             
 ========================================  ========================================
- ``None``                                  ``DevVoid``                            
- ``DevVoid``                               ``DevVoid``                            
- ``DevBoolean``                            ``DevBoolean``                         
- ``DevShort``                              ``DevShort``                           
- ``DevLong``                               ``DevLong``                            
- ``DevFloat``                              ``DevFloat``                           
- ``DevDouble``                             ``DevDouble``                          
- ``DevUShort``                             ``DevUShort``                          
- ``DevULong``                              ``DevULong``                           
- ``DevString``                             ``DevString``                          
- ``DevVarCharArray``                       ``DevVarCharArray``                    
- ``DevVarShortArray``                      ``DevVarShortArray``                   
- ``DevVarLongArray``                       ``DevVarLongArray``                    
- ``DevVarFloatArray``                      ``DevVarFloatArray``                   
- ``DevVarDoubleArray``                     ``DevVarDoubleArray``                  
- ``DevVarUShortArray``                     ``DevVarUShortArray``                  
- ``DevVarULongArray``                      ``DevVarULongArray``                   
- ``DevVarStringArray``                     ``DevVarStringArray``                  
- ``DevVarLongStringArray``                 ``DevVarLongStringArray``              
- ``DevVarDoubleStringArray``               ``DevVarDoubleStringArray``            
+ ``None``                                  ``DevVoid``
+ ``'None'``                                ``DevVoid``
+ ``DevVoid``                               ``DevVoid``
+ ``'DevVoid'``                             ``DevVoid``
+
  ``DevState``                              ``DevState``                           
- ``DevVarBooleanArray``                    ``DevVarBooleanArray``                 
- ``DevUChar``                              ``DevUChar``                           
- ``DevLong64``                             ``DevLong64``                          
- ``DevULong64``                            ``DevULong64``                         
- ``DevVarLong64Array``                     ``DevVarLong64Array``                  
- ``DevVarULong64Array``                    ``DevVarULong64Array``                 
+ ``'DevState'``                            ``DevState``                           
+
+ :py:obj:`bool`                            ``DevBoolean``
+ ``'bool'``                                ``DevBoolean``
+ ``'boolean'``                             ``DevBoolean``
+ ``DevBoolean``                            ``DevBoolean``
+ ``'DevBoolean'``                          ``DevBoolean``
+ :py:obj:`numpy.bool_`                     ``DevBoolean``
+
+ ``'char'``                                ``DevUChar``
+ ``'chr'``                                 ``DevUChar``
+ ``'byte'``                                ``DevUChar``
+ ``chr``                                   ``DevUChar``
+ ``DevUChar``                              ``DevUChar``
+ ``'DevUChar'``                            ``DevUChar``
+ :py:obj:`numpy.uint8`                     ``DevUChar``
+
+ ``'int16'``                               ``DevShort``
+ ``DevShort``                              ``DevShort``
+ ``'DevShort'``                            ``DevShort``
+ :py:obj:`numpy.int16`                     ``DevShort``
+
+ ``'uint16'``                              ``DevUShort``
+ ``DevUShort``                             ``DevUShort``
+ ``'DevUShort'``                           ``DevUShort``
+ :py:obj:`numpy.uint16`                    ``DevUShort``
+
+ :py:obj:`int`                             ``DevLong``
+ ``'int'``                                 ``DevLong``
+ ``'int32'``                               ``DevLong``
+ ``DevLong``                               ``DevLong``
+ ``'DevLong'``                             ``DevLong``
+ :py:obj:`numpy.int32`                     ``DevLong``
+
+ ``'uint'``                                ``DevULong``
+ ``'uint32'``                              ``DevULong``
+ ``DevULong``                              ``DevULong``
+ ``'DevULong'``                            ``DevULong``
+ :py:obj:`numpy.uint32`                    ``DevULong``
+
+ ``'int64'``                               ``DevLong64``
+ ``DevLong64``                             ``DevLong64``
+ ``'DevLong64'``                           ``DevLong64``
+ :py:obj:`numpy.int64`                     ``DevLong64``
+ 
+ ``'uint64'``                              ``DevULong64``
+ ``DevULong64``                            ``DevULong64``
+ ``'DevULong64'``                          ``DevULong64``
+ :py:obj:`numpy.uint64`                    ``DevULong64``
+
  ``DevInt``                                ``DevInt``                             
- ``DevEncoded``                            ``DevEncoded``                         
- ``chr``                                   ``DevUChar``                           
- ``'DevBoolean'``                          ``DevBoolean``                         
- ``'DevDouble'``                           ``DevDouble``                          
- ``'DevEncoded'``                          ``DevEncoded``                         
- ``'DevFloat'``                            ``DevFloat``                           
  ``'DevInt'``                              ``DevInt``                             
- ``'DevLong'``                             ``DevLong``                            
- ``'DevLong64'``                           ``DevLong64``                          
- ``'DevShort'``                            ``DevShort``                           
- ``'DevState'``                            ``DevState``                           
- ``'DevString'``                           ``DevString``                          
- ``'DevUChar'``                            ``DevUChar``                           
- ``'DevULong'``                            ``DevULong``                           
- ``'DevULong64'``                          ``DevULong64``                         
- ``'DevUShort'``                           ``DevUShort``                          
- ``'DevVarBooleanArray'``                  ``DevVarBooleanArray``                 
- ``'DevVarCharArray'``                     ``DevVarCharArray``                    
- ``'DevVarDoubleArray'``                   ``DevVarDoubleArray``                  
- ``'DevVarDoubleStringArray'``             ``DevVarDoubleStringArray``            
- ``'DevVarFloatArray'``                    ``DevVarFloatArray``                   
- ``'DevVarLong64Array'``                   ``DevVarLong64Array``                  
- ``'DevVarLongArray'``                     ``DevVarLongArray``                    
- ``'DevVarLongStringArray'``               ``DevVarLongStringArray``              
+ 
+ ``'float32'``                             ``DevFloat``
+ ``DevFloat``                              ``DevFloat``
+ ``'DevFloat'``                            ``DevFloat``
+ :py:obj:`numpy.float32`                   ``DevFloat``
+ 
+ :py:obj:`float`                           ``DevDouble``
+ ``'double'``                              ``DevDouble``
+ ``'float'``                               ``DevDouble``
+ ``'float64'``                             ``DevDouble``
+ ``DevDouble``                             ``DevDouble``
+ ``'DevDouble'``                           ``DevDouble``
+ :py:obj:`numpy.float64`                   ``DevDouble``
+ 
+ :py:obj:`str`                             ``DevString``
+ ``'str'``                                 ``DevString``
+ ``'string'``                              ``DevString``
+ ``'text'``                                ``DevString``
+ ``DevString``                             ``DevString``
+ ``'DevString'``                           ``DevString``
+ 
+ :py:obj:`bytearray`                       ``DevEncoded``
+ ``'bytearray'``                           ``DevEncoded``
+ ``'bytes'``                               ``DevEncoded``
+ ``DevEncoded``                            ``DevEncoded``
+ ``'DevEncoded'``                          ``DevEncoded``
+
+ ``DevVarBooleanArray``                    ``DevVarBooleanArray``
+ ``'DevVarBooleanArray'``                  ``DevVarBooleanArray``
+ 
+ ``DevVarCharArray``                       ``DevVarCharArray``
+ ``'DevVarCharArray'``                     ``DevVarCharArray``
+ 
+ ``DevVarShortArray``                      ``DevVarShortArray``
  ``'DevVarShortArray'``                    ``DevVarShortArray``
- ``'DevVarStringArray'``                   ``DevVarStringArray``                  
- ``'DevVarULong64Array'``                  ``DevVarULong64Array``                 
- ``'DevVarULongArray'``                    ``DevVarULongArray``                   
- ``'DevVarUShortArray'``                   ``DevVarUShortArray``                  
- ``'DevVoid'``                             ``DevVoid``                            
- ``'None'``                                ``DevVoid``                            
- ``'bool'``                                ``DevBoolean``                         
- ``'boolean'``                             ``DevBoolean``                         
- ``'byte'``                                ``DevUChar``                           
- ``'bytearray'``                           ``DevEncoded``                         
- ``'bytes'``                               ``DevEncoded``                         
- ``'char'``                                ``DevUChar``                           
- ``'chr'``                                 ``DevUChar``                           
- ``'double'``                              ``DevDouble``                          
- ``'float'``                               ``DevDouble``                          
- ``'float32'``                             ``DevFloat``                           
- ``'float64'``                             ``DevDouble``                          
- ``'int'``                                 ``DevLong``                            
- ``'int16'``                               ``DevShort``                           
- ``'int32'``                               ``DevLong``                            
- ``'int64'``                               ``DevLong64``                          
- ``'str'``                                 ``DevString``                          
- ``'string'``                              ``DevString``                          
- ``'text'``                                ``DevString``                          
- ``'uint'``                                ``DevULong``                           
- ``'uint16'``                              ``DevUShort``                          
- ``'uint32'``                              ``DevULong``                           
- ``'uint64'``                              ``DevULong64``                         
- :py:obj:`float`                           ``DevDouble``                          
- :py:obj:`int`                             ``DevLong``                            
- :py:obj:`str`                             ``DevString``                          
- :py:obj:`bool`                            ``DevBoolean``                         
- :py:obj:`bytearray`                       ``DevEncoded``                         
- :py:obj:`numpy.bool_`                     ``DevBoolean``                         
- :py:obj:`numpy.int16`                     ``DevShort``                           
- :py:obj:`numpy.int32`                     ``DevLong``                            
- :py:obj:`numpy.int64`                     ``DevLong64``                          
- :py:obj:`numpy.uint8`                     ``DevUChar``                           
- :py:obj:`numpy.uint16`                    ``DevUShort``                          
- :py:obj:`numpy.uint32`                    ``DevULong``                           
- :py:obj:`numpy.uint64`                    ``DevULong64``                         
- :py:obj:`numpy.float32`                   ``DevFloat``                           
- :py:obj:`numpy.float64`                   ``DevDouble``                          
+ 
+ ``DevVarLongArray``                       ``DevVarLongArray``
+ ``'DevVarLongArray'``                     ``DevVarLongArray``
+ 
+ ``DevVarLong64Array``                     ``DevVarLong64Array``
+ ``'DevVarLong64Array'``                   ``DevVarLong64Array``
+ 
+ ``DevVarULong64Array``                    ``DevVarULong64Array``
+ ``'DevVarULong64Array'``                  ``DevVarULong64Array``
+ 
+ ``DevVarFloatArray``                      ``DevVarFloatArray``
+ ``'DevVarFloatArray'``                    ``DevVarFloatArray``
+ 
+ ``DevVarDoubleArray``                     ``DevVarDoubleArray``
+ ``'DevVarDoubleArray'``                   ``DevVarDoubleArray``
+ 
+ ``DevVarUShortArray``                     ``DevVarUShortArray``
+ ``'DevVarUShortArray'``                   ``DevVarUShortArray``
+ 
+ ``DevVarULongArray``                      ``DevVarULongArray``
+ ``'DevVarULongArray'``                    ``DevVarULongArray``
+ 
+ ``DevVarStringArray``                     ``DevVarStringArray``
+ ``'DevVarStringArray'``                   ``DevVarStringArray``
+ 
+ ``DevVarLongStringArray``                 ``DevVarLongStringArray``
+ ``'DevVarLongStringArray'``               ``DevVarLongStringArray``
+ 
+ ``DevVarDoubleStringArray``               ``DevVarDoubleStringArray``
+ ``'DevVarDoubleStringArray'``             ``DevVarDoubleStringArray``
 ========================================  ========================================
 """
 
@@ -213,7 +240,7 @@ def __build_to_tango_type():
         if key.startswith("Dev"):
             value = getattr(CmdArgType, key)
             ret[key] = ret[value] = value
-            
+
     if constants.NUMPY_SUPPORT:
         import numpy
         FROM_TANGO_TO_NUMPY_TYPE = { \
@@ -230,10 +257,10 @@ def __build_to_tango_type():
                      CmdArgType.DevFloat : numpy.float32,
         }
 
-        for key,value in FROM_TANGO_TO_NUMPY_TYPE.items():
+        for key, value in FROM_TANGO_TO_NUMPY_TYPE.items():
             ret[value] = key
     return ret
-    
+
 TO_TANGO_TYPE = __build_to_tango_type()
 
 
@@ -256,7 +283,7 @@ def from_typeformat_to_type(dtype, dformat):
         raise TypeError("Cannot translate IMAGE to tango type")
     return scalar_to_array_type(dtype)
 
-    
+
 def set_complex_value(attr, value):
     is_tuple = isinstance(value, tuple)
     dtype, fmt = attr.get_data_type(), attr.get_data_format()
@@ -287,7 +314,7 @@ def set_complex_value(attr, value):
         else:
             attr.set_value(value)
 
-            
+
 def check_tango_device_klass_attribute_read_method(tango_device_klass, method_name):
     """Checks if method given by it's name for the given DeviceImpl class has
     the correct signature. If a read/write method doesn't have a parameter
@@ -308,7 +335,7 @@ def check_tango_device_klass_attribute_read_method(tango_device_klass, method_na
         return ret
     setattr(tango_device_klass, method_name, read_attr)
 
-    
+
 def check_tango_device_klass_attribute_write_method(tango_device_klass, method_name):
     """Checks if method given by it's name for the given DeviceImpl class has
     the correct signature. If a read/write method doesn't have a parameter
@@ -327,7 +354,7 @@ def check_tango_device_klass_attribute_write_method(tango_device_klass, method_n
         return write_method(self, value)
     setattr(tango_device_klass, method_name, write_attr)
 
-    
+
 def check_tango_device_klass_attribute_methods(tango_device_klass, attr_data):
     """Checks if the read and write methods have the correct signature. If a 
     read/write method doesn't have a parameter (the traditional Attribute),
@@ -366,17 +393,17 @@ class _DeviceClass(DeviceClass):
                     import traceback
                     dev.warn_stream("Failed to initialize dynamic attributes")
                     dev.debug_stream("Details: " + traceback.format_exc())
-    
-        
+
+
 def create_tango_deviceclass_klass(tango_device_klass, attrs=None):
     klass_name = tango_device_klass.__name__
     if not issubclass(tango_device_klass, (Device)):
         msg = "{0} device must inherit from PyTango.server.Device".format(klass_name)
         raise Exception(msg)
-    
+
     if attrs is None:
         attrs = tango_device_klass.__dict__
-        
+
     attr_list = {}
     class_property_list = {}
     device_property_list = {}
@@ -395,9 +422,9 @@ def create_tango_deviceclass_klass(tango_device_klass, attrs=None):
             if hasattr(attr_obj, "__tango_command__"):
                 cmd_name, cmd_info = attr_obj.__tango_command__
                 cmd_list[cmd_name] = cmd_info
-    
+
     devclass_name = klass_name + "Class"
-    
+
     devclass_attrs = dict(class_property_list=class_property_list,
                           device_property_list=device_property_list,
                           cmd_list=cmd_list, attr_list=attr_list)
@@ -450,7 +477,7 @@ def DeviceMeta(name, bases, attrs):
 class Device(LatestDeviceImpl):
     """High level DeviceImpl API. All Device specific classes should inherit
     from this class."""
-    
+
     def __init__(self, cl, name):
         LatestDeviceImpl.__init__(self, cl, name)
         self.init_device()
@@ -459,7 +486,7 @@ class Device(LatestDeviceImpl):
         """Tango init_device method. Default implementation calls
         :meth:`get_device_properties`"""
         self.get_device_properties()
-    
+
     def always_executed_hook(self):
         """Tango always_executed_hook. Default implementation does nothing"""
         pass
@@ -477,6 +504,7 @@ scalar, `PyTango.DevDouble`, read-only attribute called *voltage* in a
 *PowerSupply* :class:`Device` do::
 
     class PowerSupply(Device):
+        __metaclass__ = DeviceMeta
         
         voltage = attribute()
         
@@ -537,25 +565,25 @@ archive_period         :obj:`str`                       None
             kwargs['dtype'], kwargs['dformat'] = \
                 get_tango_type_format(kwargs['dtype'], kwargs.get('dformat'))
         self.build_from_dict(kwargs)
-   
+
     def get_attribute(self, obj):
         return obj.get_device_attr().get_attr_by_name(self.attr_name)
 
     # --------------------
     # descriptor interface
     # --------------------
-    
+
     def __get__(self, obj, objtype):
         return self.get_attribute(obj)
 
     def __set__(self, obj, value):
         attr = self.get_attribute(obj)
         set_complex_value(attr, value)
-    
+
     def __delete__(self, obj):
         obj.remove_attribute(self.attr_name)
 
-        
+
 def _attribute(**kwargs):
     if 'dtype' in kwargs:
         kwargs['dtype'], kwargs['dformat'] = \
@@ -571,7 +599,8 @@ def command(f=None, dtype_in=None, dformat_in=None, doc_in="",
     `PyTango.DevDouble` parameter called *current*, do::
 
         class PowerSupply(Device):
-
+            __metaclass__ = DeviceMeta
+            
             @command(dtype_in=float)
             def ramp(self, current):
                 self.info_stream("Ramping on %f..." % current)
@@ -609,7 +638,7 @@ def command(f=None, dtype_in=None, dformat_in=None, doc_in="",
             dtype_in=dtype_in, dformat_in=dformat_in, doc_in=doc_in,
             dtype_out=dtype_out, dformat_out=dformat_out, doc_out=doc_out)
     name = f.__name__
-    
+
     dtype_in, dformat_in = get_tango_type_format(dtype_in, dformat_in)
     dtype_out, dformat_out = get_tango_type_format(dtype_out, dformat_out)
 
@@ -627,13 +656,13 @@ class _property(object):
         self.dtype = dtype
         self.doc = doc
         self.default_value = default_value
-    
+
     def __get__(self, obj, objtype):
         return self.__value
 
     def __set__(self, obj, value):
         self.__value = value
-    
+
     def __delete__(self, obj):
         del self.__value
 

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