Remove py2 support

Change-Id: Ieeaeb3b8efcae004e94aea6c1d2703c9782a8650
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21320
Tested-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
Enrico Faulhaber
2019-09-25 17:45:26 +02:00
parent 04032079d7
commit 70a9c42a7a
59 changed files with 458 additions and 667 deletions

View File

@ -23,7 +23,6 @@
"""Utilities for modules that require sequenced actions on value change."""
from __future__ import division, print_function
from time import sleep
@ -74,7 +73,7 @@ class SequencerMixin(object):
self._seq_fault_on_error = fault_on_error
self._seq_fault_on_stop = fault_on_stop
self._seq_stopflag = False
self._seq_phase = u''
self._seq_phase = ''
self._seq_error = None
self._seq_stopped = None
@ -116,7 +115,7 @@ class SequencerMixin(object):
the default is to only go into ALARM.
"""
if self.seq_is_alive():
raise IsBusyError(u'move sequence already in progress')
raise IsBusyError('move sequence already in progress')
self._seq_stopflag = False
self._seq_error = self._seq_stopped = None
@ -129,7 +128,7 @@ class SequencerMixin(object):
def read_status(self):
if self.seq_is_alive():
return self.Status.BUSY, u'moving: ' + self._seq_phase
return self.Status.BUSY, 'moving: ' + self._seq_phase
elif self._seq_error:
if self._seq_fault_on_error:
return self.Status.ERROR, self._seq_error
@ -138,9 +137,9 @@ class SequencerMixin(object):
if self._seq_fault_on_stop:
return self.Status.ERROR, self._seq_stopped
return self.Status.WARN, self._seq_stopped
if hasattr(self, u'read_hw_status'):
if hasattr(self, 'read_hw_status'):
return self.read_hw_status()
return self.Status.IDLE, u''
return self.Status.IDLE, ''
def do_stop(self):
if self.seq_is_alive():
@ -150,7 +149,7 @@ class SequencerMixin(object):
try:
self._seq_thread_inner(seq, store_init)
except Exception as e:
self.log.exception(u'unhandled error in sequence thread: %s', e)
self.log.exception('unhandled error in sequence thread: %s', e)
self._seq_error = str(e)
finally:
self._seq_thread = None
@ -159,11 +158,11 @@ class SequencerMixin(object):
def _seq_thread_inner(self, seq, store_init):
store = Namespace()
store.__dict__.update(store_init)
self.log.debug(u'sequence: starting, values %s', store_init)
self.log.debug('sequence: starting, values %s', store_init)
for step in seq:
self._seq_phase = step.desc
self.log.debug(u'sequence: entering phase: %s', step.desc)
self.log.debug('sequence: entering phase: %s', step.desc)
try:
i = 0
while True:
@ -171,10 +170,10 @@ class SequencerMixin(object):
result = step.func(store, *step.args)
if self._seq_stopflag:
if result:
self._seq_stopped = u'stopped while %s' % step.desc
self._seq_stopped = 'stopped while %s' % step.desc
else:
self._seq_stopped = u'stopped after %s' % step.desc
cleanup_func = step.kwds.get(u'cleanup', None)
self._seq_stopped = 'stopped after %s' % step.desc
cleanup_func = step.kwds.get('cleanup', None)
if callable(cleanup_func):
try:
cleanup_func(store, result, *step.args)
@ -188,6 +187,6 @@ class SequencerMixin(object):
i += 1
except Exception as e:
self.log.exception(
u'error in sequence step %r: %s', step.desc, e)
self._seq_error = u'during %s: %s' % (step.desc, e)
'error in sequence step %r: %s', step.desc, e)
self._seq_error = 'during %s: %s' % (step.desc, e)
break