diff --git a/ably/executer/eventloop.py b/ably/executer/eventloop.py index 8bf9597c..9ef8073c 100644 --- a/ably/executer/eventloop.py +++ b/ably/executer/eventloop.py @@ -19,13 +19,13 @@ def __init__(self, loop, thread=None): self.__thread = thread self.__is_active = True - @staticmethod + @classmethod def get_global(cls) -> 'AppEventLoop': if cls._global is None or not cls._global.__is_active: cls._global = cls.create(False) return cls._global - @staticmethod + @classmethod def create(cls, background=True) -> 'AppEventLoop': loop = asyncio.new_event_loop() thread = threading.Thread(target=loop.run_forever, daemon=background) diff --git a/ably/executer/eventloop_helper.py b/ably/executer/eventloop_helper.py index 3d03802e..b1c0decf 100644 --- a/ably/executer/eventloop_helper.py +++ b/ably/executer/eventloop_helper.py @@ -4,17 +4,17 @@ class LoopHelper: - @classmethod - def run(cls, loop: events, coro, callback): + @staticmethod + def run(loop: events, coro, callback): raise "not implemented" - @classmethod - def run_safe(cls, loop: events, coro, callback): + @staticmethod + def run_safe(loop: events, coro, callback): raise "not implemented" # - @classmethod - def force_sync(cls, loop: events, coro): + @staticmethod + def force_sync(loop: events, coro): future: Future caller_eventloop = None try: @@ -28,8 +28,8 @@ def force_sync(cls, loop: events, coro): future = asyncio.run_coroutine_threadsafe(coro, loop) return future.result() - @classmethod - def run_safe_async(cls, loop: events, coro): + @staticmethod + def run_safe_async(loop: events, coro): caller_eventloop = None try: caller_eventloop: events = asyncio.get_running_loop() @@ -45,8 +45,8 @@ def run_safe_async(cls, loop: events, coro): # # Run in the default loop's executor # return await loop.run_in_executor(None, blocking_fn, blocking_fn_args) - @classmethod + @staticmethod # Run blocking function in default threadpool executor. - async def run_blocking_fn_async(cls, loop: events, blocking_fn, blocking_fn_args): + async def run_blocking_fn_async(loop: events, blocking_fn, blocking_fn_args): # Run in the default loop's executor return await loop.run_in_executor(None, blocking_fn, blocking_fn_args)