Skip to content

Commit

Permalink
fix pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Sep 12, 2024
1 parent 7a3f946 commit c54c9f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/agentscope/rpc/rpc_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c54c9f1

Please sign in to comment.