[pytango] 106/122: Get rid of the metaclass definitions

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:18:23 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 9fa25051bf2050e874a6ffb3b6610aa281f81299
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date:   Mon Jan 16 16:16:10 2017 +0100

    Get rid of the metaclass definitions
---
 tango/server.py       | 15 ++-------------
 tango/tango_object.py |  1 -
 tango/test_utils.py   | 10 +++-------
 tests/test_server.py  |  8 --------
 4 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/tango/server.py b/tango/server.py
index 38a1035..9a4789d 100644
--- a/tango/server.py
+++ b/tango/server.py
@@ -642,7 +642,6 @@ class attribute(AttrData):
     *voltage* in a *PowerSupply* :class:`Device` do::
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             voltage = attribute()
 
@@ -652,7 +651,6 @@ class attribute(AttrData):
     The same can be achieved with::
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             @attribute
             def voltage(self):
@@ -711,7 +709,6 @@ class attribute(AttrData):
     unit and description::
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             current = attribute(label="Current", unit="mA", dtype=int,
                                 access=AttrWriteType.READ_WRITE,
@@ -730,7 +727,6 @@ class attribute(AttrData):
     The same, but using attribute as a decorator::
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             def init_device(self):
                 Device.init_device(self)
@@ -834,7 +830,6 @@ class pipe(PipeData):
     (for Region Of Interest), in a *Detector* :class:`Device` do::
 
         class Detector(Device):
-            __metaclass__ = DeviceMeta
 
             ROI = pipe()
 
@@ -848,7 +843,6 @@ class pipe(PipeData):
     to pass blob data)::
 
         class Detector(Device):
-            __metaclass__ = DeviceMeta
 
             @pipe
             def ROI(self):
@@ -876,7 +870,6 @@ class pipe(PipeData):
     The same example with a read-write ROI, a customized label and description::
 
         class Detector(Device):
-            __metaclass__ = DeviceMeta
 
             ROI = pipe(label='Region Of Interest', doc='The active region of interest',
                        access=PipeWriteType.PIPE_READ_WRITE)
@@ -895,7 +888,6 @@ class pipe(PipeData):
     The same, but using pipe as a decorator::
 
         class Detector(Device):
-            __metaclass__ = DeviceMeta
 
             def init_device(self):
                 Device.init_device(self)
@@ -1024,7 +1016,6 @@ def command(f=None, dtype_in=None, dformat_in=None, doc_in="",
     ::
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             @command
             def TurnOn(self):
@@ -1154,7 +1145,6 @@ class device_property(_BaseProperty):
         from tango.server import device_property
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             host = device_property(dtype=str)
 
@@ -1182,7 +1172,6 @@ class class_property(_BaseProperty):
         from tango.server import class_property
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
 
             port = class_property(dtype=int, default_value=9788)
 
@@ -1371,7 +1360,7 @@ def run(classes, args=None, msg_stream=sys.stdout,
         from tango.server import Device, DeviceMeta, run
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
+            pass
 
         run((PowerSupply,))
 
@@ -1396,7 +1385,7 @@ def run(classes, args=None, msg_stream=sys.stdout,
         from tango.server import Device, DeviceMeta, run
 
         class PowerSupply(Device):
-            __metaclass__ = DeviceMeta
+            pass
 
         class MyServer(Device_4Impl):
             pass
diff --git a/tango/tango_object.py b/tango/tango_object.py
index 6df4f28..08abb89 100644
--- a/tango/tango_object.py
+++ b/tango/tango_object.py
@@ -85,7 +85,6 @@ def create_tango_class(server, obj, tango_class_name=None, member_filter=None):
         tango_class_name = obj_klass_name
 
     class DeviceDispatcher(Device):
-        __metaclass__ = DeviceMeta
 
         TangoClassName = tango_class_name
 
diff --git a/tango/test_utils.py b/tango/test_utils.py
index 91e7ed3..25092c6 100644
--- a/tango/test_utils.py
+++ b/tango/test_utils.py
@@ -1,14 +1,9 @@
 """Test utilities"""
 
-__all__ = ['DeviceTestContext', 'SimpleDevice']
-
-# Imports
-from six import add_metaclass
-
 # Local imports
 from . import utils
 from . import DevState, CmdArgType, GreenMode
-from .server import Device, DeviceMeta
+from .server import Device
 from .test_context import DeviceTestContext
 
 # Conditional imports
@@ -17,10 +12,11 @@ try:
 except ImportError:
     pytest = None
 
+__all__ = ['DeviceTestContext', 'SimpleDevice']
+
 
 # Test devices
 
- at add_metaclass(DeviceMeta)
 class SimpleDevice(Device):
     def init_device(self):
         self.set_state(DevState.ON)
diff --git a/tests/test_server.py b/tests/test_server.py
index 49f7063..c88a041 100644
--- a/tests/test_server.py
+++ b/tests/test_server.py
@@ -1,9 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import pytest
-from six import add_metaclass
 
-from tango import GreenMode
 from tango import DevState, AttrWriteType
 from tango.server import Device, DeviceMeta
 from tango.server import command, attribute, device_property
@@ -18,7 +16,6 @@ state, typed_values, server_green_mode
 
 def test_empty_device(server_green_mode):
 
-    @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         green_mode = server_green_mode
 
@@ -30,7 +27,6 @@ def test_empty_device(server_green_mode):
 def test_set_state(state, server_green_mode):
     status = 'The device is in {0!s} state.'.format(state)
 
-    @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         green_mode = server_green_mode
 
@@ -49,7 +45,6 @@ def test_set_status(server_green_mode):
         "with special characters such as",
         "Café à la crème"))
 
-    @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         green_mode = server_green_mode
 
@@ -67,7 +62,6 @@ def test_set_status(server_green_mode):
 def test_identity_command(typed_values, server_green_mode):
     dtype, values = typed_values
 
-    @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         green_mode = server_green_mode
 
@@ -86,7 +80,6 @@ def test_identity_command(typed_values, server_green_mode):
 def test_read_write_attribute(typed_values, server_green_mode):
     dtype, values = typed_values
 
-    @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         green_mode = server_green_mode
 
@@ -112,7 +105,6 @@ def test_device_property(typed_values, server_green_mode):
     default = values[0]
     value = values[1]
 
-    @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         green_mode = server_green_mode
 

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