1818import asyncio
1919import threading
2020import inspect
21- import typing
22- import logging
21+ from typing import Generator , Any
2322
2423from chaski .streamer import ChaskiStreamer
2524
@@ -75,7 +74,7 @@ def __init__(self, *args, **kwargs):
7574 # This function sets the given event loop as the current event loop and starts it to run indefinitely, enabling asynchronous tasks.
7675 asyncio .set_event_loop (self .loop )
7776
78- self .streamer = ChaskiStreamer (* args , ** kwargs , run = False , sync = True )
77+ self .streamer = ChaskiStreamer (* args , ** kwargs , sync = True , run = False )
7978
8079 # Start a new thread that runs the event loop, allowing for asynchronous operations to occur in parallel.
8180 self .thread = threading .Thread (target = self ._start_loop , args = (self .loop ,))
@@ -94,8 +93,8 @@ def __repr__(self):
9493 such as the IP address and port. If the instance is a root node, it prepends an
9594 asterisk (*) to the string.
9695 """
97- h = '*' if self .paired else ''
98- return h + self .address .replace (' ChaskiStreamer' , ' ChaskiStreamerSync' )
96+ h = "*" if self .paired else ""
97+ return h + self .address .replace (" ChaskiStreamer" , " ChaskiStreamerSync" )
9998
10099 # ----------------------------------------------------------------------
101100 def _start_loop (self , loop : asyncio .AbstractEventLoop ) -> None :
@@ -148,7 +147,7 @@ def close(self) -> None:
148147 self .thread .join ()
149148
150149 # ----------------------------------------------------------------------
151- def __getattr__ (self , attr : str ) -> typing . Any :
150+ def __getattr__ (self , attr : str ) -> Any :
152151 """Retrieve an attribute from the ChaskiStreamer instance.
153152
154153 This method overrides the default behavior of attribute access,
@@ -190,7 +189,7 @@ def wrapp(*args, **kwargs):
190189 return object_
191190
192191 # ----------------------------------------------------------------------
193- def message_stream (self , timeout = None ) -> typing . Generator [ 'Message' , None , None ] :
192+ def message_stream (self , timeout = None ) -> Generator :
194193 """
195194 Generator to yield messages from the streamer's message queue.
196195
@@ -206,7 +205,7 @@ def message_stream(self, timeout=None) -> typing.Generator['Message', None, None
206205
207206 Returns
208207 -------
209- None
208+ Generator
210209 If the queue times out or an exception occurs.
211210 """
212211 while True :
0 commit comments