diff --git a/tomodachi/container.py b/tomodachi/container.py index 425231d9..d3371922 100644 --- a/tomodachi/container.py +++ b/tomodachi/container.py @@ -556,12 +556,14 @@ def invoker_function_sorter(m: str) -> int: for task in tasks: try: co_filename = ( - task.get_coro().cr_code.co_filename # type: ignore[union-attr] + cast(Any, task.get_coro()).cr_code.co_filename if hasattr(task, "get_coro") - else task._coro.cr_code.co_filename # type: ignore[attr-defined] + else cast(Any, task)._coro.cr_code.co_filename ) co_name = ( - task.get_coro().cr_code.co_name if hasattr(task, "get_coro") else task._coro.cr_code.co_name # type: ignore[union-attr, attr-defined] + cast(Any, task.get_coro()).cr_code.co_name + if hasattr(task, "get_coro") + else cast(Any, task).cr_code.co_name ) if "/tomodachi/watcher.py" in co_filename and co_name == "_watch_loop":