diff --git a/pyproject.toml b/pyproject.toml index bcafe650..5557c31b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "royalnet" -version = "6.2.0" +version = "6.2.1" description = "A multipurpose bot framework" authors = ["Stefano Pigozzi "] license = "AGPL-3.0-or-later" diff --git a/royalnet/engineer/pda/base.py b/royalnet/engineer/pda/base.py index c6d3f4df..1af64662 100644 --- a/royalnet/engineer/pda/base.py +++ b/royalnet/engineer/pda/base.py @@ -2,7 +2,7 @@ This module contains the base :class:`.PDA` class. """ -import abc +import asyncio import royalnet.royaltyping as t if t.TYPE_CHECKING: @@ -10,7 +10,7 @@ if t.TYPE_CHECKING: DispenserKey = t.TypeVar("DispenserKey") -class PDA(metaclass=abc.ABCMeta): +class PDA: """ .. todo:: Document this. """ @@ -27,6 +27,9 @@ class PDA(metaclass=abc.ABCMeta): def __len__(self): return len(self.implementations) + def run(self): + asyncio.run(asyncio.gather(*[implementation.run() for implementation in self.implementations.values()])) + __all__ = ( "PDA", diff --git a/royalnet/engineer/pda/implementations/base.py b/royalnet/engineer/pda/implementations/base.py index 682fbaf4..be1bda21 100644 --- a/royalnet/engineer/pda/implementations/base.py +++ b/royalnet/engineer/pda/implementations/base.py @@ -63,6 +63,10 @@ class PDAImplementation(metaclass=abc.ABCMeta): raise NotImplementedError() + @abc.abstractmethod + async def run(self): + raise NotImplementedError() + class ImplementationException(Exception): """