FEM: reformat codebase

This commit is contained in:
lyphrowny
2024-06-19 14:29:15 +03:00
parent 8675aa87b4
commit 359c1ae2bb
302 changed files with 6702 additions and 9421 deletions

View File

@@ -36,7 +36,7 @@ from . import report
from . import signal
class Task(object):
class Task:
def __init__(self):
self.report = None
@@ -57,15 +57,13 @@ class Task(object):
def stopping():
self.stopTime = time.time()
self.running = False
self.signalStopping.add(stopping)
@property
def time(self):
if self.startTime is not None:
endTime = (
self.stopTime
if self.stopTime is not None
else time.time())
endTime = self.stopTime if self.stopTime is not None else time.time()
return endTime - self.startTime
return None
@@ -124,13 +122,12 @@ class Task(object):
class Thread(Task):
def __init__(self):
super(Thread, self).__init__()
super().__init__()
self._thread = None
def start(self):
super(Thread, self).start()
self._thread = threading.Thread(
target=self.protector)
super().start()
self._thread = threading.Thread(target=self.protector)
self._thread.daemon = True
self._thread.start()
self._attachObserver()
@@ -144,8 +141,10 @@ class Thread(Task):
self._thread.join()
signal.notify(self.signalStopping)
signal.notify(self.signalStopped)
thread = threading.Thread(target=waitForStop)
thread.daemon = True
thread.start()
## @}