From 698643e927b84d45908ecc77520a17528ff2977d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 13 Apr 2021 19:50:28 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=20Bump=20version=20to=206.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- royalnet/engineer/pda/base.py | 7 +++++-- royalnet/engineer/pda/implementations/base.py | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) 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): """