From 1f74a1be34fe1ec6f98ee128d6847c6c4c39986d Mon Sep 17 00:00:00 2001 From: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:06:19 -0400 Subject: [PATCH] refactor: apply suggestions from code review Co-authored-by: antazoey --- silverback/application.py | 12 ++++++------ silverback/runner.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/silverback/application.py b/silverback/application.py index a78054c1..169ecc10 100644 --- a/silverback/application.py +++ b/silverback/application.py @@ -18,7 +18,7 @@ class SilverbackApp(ManagerAccessMixin): """ The application singleton. Must be initialized prior to use. - Usages example:: + Usage example:: from silverback import SilverbackApp @@ -32,7 +32,7 @@ def __init__(self, settings: Optional[Settings] = None): Create app Args: - settings (Optional[silverback.settings:Settings]): Settings override. + settings (Optional[~:class:`silverback.settings.Settings`]): Settings override. Defaults to environment settings. """ if not settings: @@ -77,7 +77,7 @@ def on_startup(self) -> Callable: """ Code to execute on worker startup / restart after an error. - Usages example:: + Usage example:: @app.on_startup() def do_something_on_startup(state): @@ -89,7 +89,7 @@ def on_shutdown(self) -> Callable: """ Code to execute on normal worker shutdown. - Usages example:: + Usage example:: @app.on_shutdown() def do_something_on_shutdown(state): @@ -114,7 +114,7 @@ def get_event_handler( Args: event_target (AddressType): The contract address of the target. - event_name: (str): The name of the event emitted by `event_target`. + event_name: (str): The name of the event emitted by ``event_target``. Returns: Optional[AsyncTaskiqDecoratedTask]: Returns decorated task, if one has been created. @@ -138,7 +138,7 @@ def on_( Defaults to whatever the latest block is. Raises: - InvalidContainerType: If the type of `container` is not configurable for the app. + :class:`~silverback.exceptions.InvalidContainerType`: If the type of `container` is not configurable for the app. """ if isinstance(container, BlockContainer): if self.get_block_handler(): diff --git a/silverback/runner.py b/silverback/runner.py index 42c66663..1d05e72f 100644 --- a/silverback/runner.py +++ b/silverback/runner.py @@ -47,13 +47,13 @@ async def _event_task( async def run(self): """ - Run the task broker client for the assembled `SilverbackApp` application. + Run the task broker client for the assembled ``SilverbackApp`` application. Will listen for events against the connected provider (using `ManagerAccessMixin` context), and process them by kicking events over to the configured broker. Raises: - SilverbackException: If there are no configured tasks to execute. + :class:`~silverback.exceptions.SilverbackException`: If there are no configured tasks to execute. """ await self.app.broker.startup()