From c54c9f1604a06e6f679b742bed2996467109e2ce Mon Sep 17 00:00:00 2001 From: "panxuchen.pxc" Date: Thu, 12 Sep 2024 19:25:27 +0800 Subject: [PATCH] fix pre-commit --- src/agentscope/rpc/rpc_object.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/agentscope/rpc/rpc_object.py b/src/agentscope/rpc/rpc_object.py index 6d7e18d7c..4ff01123b 100644 --- a/src/agentscope/rpc/rpc_object.py +++ b/src/agentscope/rpc/rpc_object.py @@ -28,16 +28,16 @@ def get_public_methods(cls: type) -> list[str]: ] -def _call_func_in_thread(func: Callable, *args, **kwargs) -> Any: +def _call_func_in_thread(func: Callable, *args: Any, **kwargs: Any) -> Any: """Call a function in a sub-thread.""" future = Future() - def wrapper(*args, **kwargs) -> None: + def wrapper(*args: Any, **kwargs: Any) -> None: try: result = func(*args, **kwargs) future.set_result(result) - except Exception as e: - future.set_exception(e) + except Exception as ex: + future.set_exception(ex) thread = threading.Thread(target=wrapper, args=args, kwargs=kwargs) thread.start()