UT330BUI/model/UT330.py
def buffer_safety(func):

    """There can be timing errors where a read takes place when the buffer
    is either partially written or not written at all. These errors can be
    removed by a short pause of 10ms. This function decorator makes sure
    there's at least 10ms between calls."""

    def buffer_protection(self, argument=None):

        # If we're less than 10ms since the last call, wait 10ms
        if datetime.datetime.now() - self.last_op_time \
           < datetime.timedelta(0, 0, 10000):
            time.sleep(0.01)

        # Read functions have no arguments, write functions have one
        if argument is None:

            data = func(self)

        else:

            data = func(self, argument)

        # We don't know how long the operation took, so use the current time
        # as the last op time
        self.last_op_time = datetime.datetime.now()

        return data

    return buffer_protection
There can be timing errors where a read takes place when the buffer
    is either partially written or not written at all. These errors can be
    removed by a short pause of 10ms. This function decorator makes sure
    there's at least 10ms between calls.
There can be timing errors where a read takes place when the buffer
is either partially written or not written at all. These errors can be
removed by a short pause of 10ms. This function decorator makes sure
there's at least 10ms between calls.
There can be timing errors where a read takes place when the buffer is either partially written or not written at all . These errors can be removed by a short pause of 10ms . This function decorator makes sure there ' s at least 10ms between calls .
def buffer_safety(func):
    def buffer_protection(self, argument=None):
        if datetime.datetime.now() - self.last_op_time \
           < datetime.timedelta(0, 0, 10000):
            time.sleep(0.01)
        if argument is None:
            data = func(self)
        else:
            data = func(self, argument)
        self.last_op_time = datetime.datetime.now()
        return data
    return buffer_protection
def buffer_safety ( func ) : def buffer_protection ( self , argument = None ) : if datetime . datetime . now ( ) - self . last_op_time < datetime . timedelta ( 0 , 0 , 10000 ) : time . sleep ( 0.01 ) if argument is None : data = func ( self ) else : data = func ( self , argument ) self . last_op_time = datetime . datetime . now ( ) return data return buffer_protection
There can be timing errors where a read takes place when the buffer
is either partially written or not written at all.
There can be timing errors where a read takes place when the buffer is either partially written or not written at all .
"""There can be timing errors where a read takes place when the buffer
    is either partially written or not written at all. These errors can be
    removed by a short pause of 10ms. This function decorator makes sure
    there's at least 10ms between calls.""" # If we're less than 10ms since the last call, wait 10ms # Read functions have no arguments, write functions have one # We don't know how long the operation took, so use the current time # as the last op time
func