diff --git a/src/appstract/asyncs.py b/src/appstract/asyncs.py index a5c28cd..a854f25 100644 --- a/src/appstract/asyncs.py +++ b/src/appstract/asyncs.py @@ -151,8 +151,8 @@ async def send_message_async(self, message: MessageProtocol) -> None: await asyncio.sleep(0) -class Application(LogMixin): - """Application class. +class AsyncApplication(LogMixin): + """Asynchronous Application class. Main Responsibilities: - Create/retrieve event loop if needed. @@ -258,7 +258,7 @@ def _handle_keyboard_interrupt(self): self.info("Received a keyboard interrupt. Exiting...") self.info("Press Ctrl+C one more time to kill immediately.") self.message_router.message_pipe.put_nowait( - Application.Stop(content=None) + AsyncApplication.Stop(content=None) ) else: raise e diff --git a/src/appstract/script.py b/src/appstract/script.py index 53e6e09..989c80d 100644 --- a/src/appstract/script.py +++ b/src/appstract/script.py @@ -7,7 +7,7 @@ from importlib.metadata import entry_points from typing import Protocol, TypeVar -from .asyncs import Application, MessageProtocol, MessageRouter +from .asyncs import AsyncApplication, MessageProtocol, MessageRouter from .constructors import ( Factory, ProviderGroup, @@ -80,7 +80,7 @@ async def shout(self) -> AsyncGenerator[MessageProtocol, None]: yield HelloWorldMessage(msg) await asyncio.sleep(1) - yield Application.Stop(content=None) + yield AsyncApplication.Stop(content=None) def run_helloworld(): @@ -90,7 +90,7 @@ def run_helloworld(): factory = Factory( log_providers, ProviderGroup( - SingletonProvider(Application), + SingletonProvider(AsyncApplication), SingletonProvider(MessageRouter), Echo, Narc, @@ -99,7 +99,7 @@ def run_helloworld(): with multiple_constant_providers(factory, parameters): factory[AppLogger].setLevel(arg_name_space.log_level.upper()) - app = factory[Application] + app = factory[AsyncApplication] echo = factory[Echo] narc = factory[Narc]