From 8ff0731aa5bd167a59f342472bfe2d7e74daf1ca Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 30 Nov 2019 14:50:37 +0100 Subject: [PATCH] some small improvements --- pyproject.toml | 2 +- royalnet/commands/event.py | 18 ++++++++++++++---- royalnet/serf/serf.py | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ed8fed64..fec54f75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ alchemy_easy = ["sqlalchemy", "psycopg2_binary"] alchemy_hard = ["sqlalchemy", "psycopg2"] bard = ["ffmpeg_python", "youtube_dl"] - constellation = ["starlette", "uvicorn"] + constellation = ["starlette", "uvicorn", "python-multipart"] sentry = ["sentry_sdk"] herald = ["websockets"] coloredlogs = ["coloredlogs"] diff --git a/royalnet/commands/event.py b/royalnet/commands/event.py index af77a1ae..761bccbf 100644 --- a/royalnet/commands/event.py +++ b/royalnet/commands/event.py @@ -15,15 +15,25 @@ class Event: self.interface: CommandInterface = interface """The :class:`CommandInterface` available to this :class:`Event`.""" + @property + def serf(self): + """A shortcut for :attr:`.interface.serf`.""" + return self.interface.serf + @property def alchemy(self): - """A shortcut for :attr:`.interface.serf.alchemy`.""" - return self.interface.serf.alchemy + """A shortcut for :attr:`.interface.alchemy`.""" + return self.interface.alchemy @property def loop(self): - """A shortcut for :attr:`.interface.serf.loop`""" - return self.interface.serf.loop + """A shortcut for :attr:`.interface.loop`.""" + return self.interface.loop + + @property + def config(self): + """A shortcut for :attr:`.interface.config`.""" + return self.interface.config async def run(self, **kwargs): raise NotImplementedError() diff --git a/royalnet/serf/serf.py b/royalnet/serf/serf.py index c5655512..9265ce64 100644 --- a/royalnet/serf/serf.py +++ b/royalnet/serf/serf.py @@ -166,7 +166,7 @@ class Serf: response: rh.Response = await self.herald.request(destination=destination, request=request) if isinstance(response, rh.ResponseFailure): if response.name == "no_event": - raise CommandError(f"There is no event named {event_name} in {destination}.") + raise ProgramError(f"There is no event named {event_name} in {destination}.") elif response.name == "error_in_event": if response.extra_info["type"] == "CommandError": raise CommandError(response.extra_info["message"])