diff --git a/packages/service-library/src/servicelib/rabbitmq.py b/packages/service-library/src/servicelib/rabbitmq.py index 01393039aea..2650cb76ebb 100644 --- a/packages/service-library/src/servicelib/rabbitmq.py +++ b/packages/service-library/src/servicelib/rabbitmq.py @@ -1,7 +1,8 @@ import asyncio import logging +from collections.abc import Awaitable, Callable from dataclasses import dataclass, field -from typing import Any, Awaitable, Callable, Final, Protocol +from typing import Any, Final, Protocol import aio_pika import aiormq @@ -313,7 +314,7 @@ async def rpc_request( method_name: RPCMethodName, *, timeout_s: PositiveInt | None = 5, - **kwargs: dict[str, Any], + **kwargs, ) -> Any: """ Call a remote registered `handler` by providing it's `namespace`, `method_name` @@ -327,7 +328,7 @@ async def rpc_request( """ if not self._rpc: - raise RPCNotInitializedError() + raise RPCNotInitializedError namespaced_method_name = RPCNamespacedMethodName.from_namespace_and_method( namespace, method_name @@ -362,7 +363,7 @@ async def rpc_register_handler( """ if self._rpc is None: - raise RPCNotInitializedError() + raise RPCNotInitializedError await self._rpc.register( RPCNamespacedMethodName.from_namespace_and_method(namespace, method_name), @@ -374,6 +375,6 @@ async def rpc_unregister_handler(self, handler: Callable[..., Any]) -> None: """Unbind a locally added `handler`""" if self._rpc is None: - raise RPCNotInitializedError() + raise RPCNotInitializedError await self._rpc.unregister(handler)