Reformat with black

This commit is contained in:
Mattia Giambirtone 2024-03-23 13:14:12 +01:00
parent 0ef965cc92
commit 73a8f3b8e3
4 changed files with 17 additions and 7 deletions

View File

@ -66,8 +66,8 @@ def run(
)
finally:
# Bunch of cleanup
_signals._sig_handlers.clear() # noqa
_signals._sig_data.clear() # noqa
_signals._sig_handlers.clear() # noqa
_signals._sig_data.clear() # noqa
return result

View File

@ -112,7 +112,13 @@ class DefaultKernel(BaseKernel):
def done(self):
if self.entry_point.done() and not self._shutting_down:
return True
if any([self.policy.has_next_task(), self.policy.has_paused_task(), self.io_manager.pending()]):
if any(
[
self.policy.has_next_task(),
self.policy.has_paused_task(),
self.io_manager.pending(),
]
):
return False
if not self.pool.done():
return False
@ -274,7 +280,8 @@ class DefaultKernel(BaseKernel):
def wakeup(self):
while (
self.policy.has_paused_task()
and self.policy.peek_paused_task().next_deadline <= self.clock.current_time()
and self.policy.peek_paused_task().next_deadline
<= self.clock.current_time()
):
task = self.policy.get_paused_task()
task.next_deadline = 0
@ -302,7 +309,10 @@ class DefaultKernel(BaseKernel):
self._tick()
self._shutting_down = True
# Ensure all system tasks have a chance to spin up
while any(task.is_system_task and task.state == TaskState.INIT for task in self.pool.scope.tasks):
while any(
task.is_system_task and task.state == TaskState.INIT
for task in self.pool.scope.tasks
):
self._tick()
# Cancel the system pool and wait for cancellation
# to be delivered

View File

@ -9,7 +9,8 @@ from structio.abc import (
BaseDebugger,
BaseClock,
SignalManager,
BaseIOManager, SchedulingPolicy,
BaseIOManager,
SchedulingPolicy,
)
from structio.exceptions import StructIOException
from structio.core.task import Task

View File

@ -1,4 +1,3 @@
from enum import Enum, auto
from dataclasses import dataclass, field
from typing import Coroutine, Any, Callable