diff --git a/aiosched/context.py b/aiosched/context.py index 56b758e..3edea10 100644 --- a/aiosched/context.py +++ b/aiosched/context.py @@ -28,8 +28,6 @@ class TaskContext(Task): inside the event loop """ - name: str = "" - def __init__(self) -> None: """ Object constructor @@ -39,10 +37,10 @@ class TaskContext(Task): # includes any inner contexts contained within this # one self.tasks: list[Task | "TaskContext"] = [] - self.name = object.__repr__(self) # Whether we have been cancelled or not self.cancelled: bool = False - + super().__init__(f"TaskContext object at {hex(id(self))}", None) + async def spawn( self, func: Callable[..., Coroutine[Any, Any, Any]], *args, **kwargs ) -> Task: @@ -111,4 +109,4 @@ class TaskContext(Task): Implements repr(self) """ - return object.__repr__(self) + return f"TaskContext({self.tasks})"