import threading
import time

class FieldMeta(type):
    def __new__(cls, name, parents, attrs):
        return super(FieldMeta, cls).__new__(cls, name, parents, attrs)

    def __call__(self, *args, **kwargs):
        obj = super(FieldMeta, self).__call__(*args, **kwargs)
        cls = type(obj)

        if not hasattr(cls, 'field_name'):
            setattr(obj, 'field_name', cls.__name__)
        else:
            setattr(obj, 'field_name', cls.field_name)

        return obj

class Base(threading.Thread):
    __metaclass__ = FieldMeta

    # field_name = 'Field'
    update_rate = 1

    def __init__(self):
        super(Base, self).__init__()
        self.old_time = 0
        self.running = False

    def _acquire_value(self):
        '''
        Function called during a data acquisition.
        This method is automatically called at every loop's turns of the
        thread.
        Return None if there is nothing to acquire.
        '''
        return None

    def _set_value(self, t, value):
        '''
        Add a new value *value* at time *t*.
        It's the job of the persistant mixins to manage how to save the new
        value.
        The integrity of the value is done by the type mixins.
        Return True if the add is done. Else False.
        '''
        return False

    def _get_value(self):
        return None

    def _get_value_at(self, t):
        return None

    def _get_value_from_to(self, fr, to):
        return []

    def _close(self):
        '''
        Method close when the thread is finishing.
        Let the mixins override this to garantee a good shutting of the field.
        '''
        pass

    def read(self, **kwargs):
        raise NotImplementedError

    def write(self, value):
        raise NotImplementedError

    def start(self):
        '''
        Start the thread of this Field.
        '''
        self.running = True
        super(Base, self).start()

    def stop(self):
        '''
        Ask for a stop of this thread. The thread will stop at the end of the
        loop's turn.
        You may use the join method to be sure the thread is done.
        '''
        self.running = False

    def run(self):
        '''
        Main function of the thread. Every *update_rate* time, try to acquire a value and to
        add this one.
        '''
        while self.running:
            if time.time() - self.old_time >= type(self).update_rate:
                self.old_time = time.time()
                self._set_value(time.time(), self._acquire_value())
            time.sleep(0.1)
        self._close()

@@ -1,24 +1,19 @@
 import t
-hreading
+ime
 %0Aimport 
@@ -13,19 +13,24 @@
 import t
-ime
+hreading
 %0A%0Aclass 
@@ -543,35 +543,8 @@
 ta%0A%0A
-    # field_name = 'Field'%0A
     
@@ -707,35 +707,35 @@
 (self):%0A        
-'''
+%22%22%22
 %0A        Functio
@@ -911,35 +911,35 @@
 cquire.%0A        
-'''
+%22%22%22
 %0A        return 
@@ -980,35 +980,35 @@
 value):%0A        
-'''
+%22%22%22
 %0A        Add a n
@@ -1210,13 +1210,8 @@
 urn 
-True 
 if t
@@ -1229,20 +1229,8 @@
 one.
- Else False.
 %0A   
@@ -1226,35 +1226,35 @@
 s done.%0A        
-'''
+%22%22%22
 %0A        return 
@@ -1443,35 +1443,35 @@
 (self):%0A        
-'''
+%22%22%22
 %0A        Method 
@@ -1585,35 +1585,35 @@
  field.%0A        
-'''
+%22%22%22
 %0A        pass%0A%0A 
@@ -1760,35 +1760,35 @@
 (self):%0A        
-'''
+%22%22%22
 %0A        Start t
@@ -1812,35 +1812,35 @@
  Field.%0A        
-'''
+%22%22%22
 %0A        self.ru
@@ -1907,35 +1907,35 @@
 (self):%0A        
-'''
+%22%22%22
 %0A        Ask for
@@ -2085,35 +2085,35 @@
 s done.%0A        
-'''
+%22%22%22
 %0A        self.ru
@@ -2146,35 +2146,35 @@
 (self):%0A        
-'''
+%22%22%22
 %0A        Main fu
@@ -2285,11 +2285,11 @@
     
-'''
+%22%22%22
 %0A   

Update __init__.py