Skip to content

Commit d81a790

Browse files
committed
change from function attributes to properties
1 parent 9bab4c0 commit d81a790

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

packages/toolbox-core/src/toolbox_core/sync_tool.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
import asyncio
1616
from asyncio import AbstractEventLoop
17+
from inspect import Signature
1718
from threading import Thread
18-
from typing import Any, Awaitable, Callable, Mapping, TypeVar, Union
19+
from typing import Any, Callable, Mapping, TypeVar, Union
1920

2021
from .tool import ToolboxTool
2122

@@ -54,14 +55,24 @@ def __init__(
5455
self.__async_tool = async_tool
5556
self.__loop = loop
5657
self.__thread = thread
57-
58-
# Delegate introspection attributes to the wrapped async tool
59-
self.__name__ = self.__async_tool.__name__
60-
self.__doc__ = self.__async_tool.__doc__
61-
self.__signature__ = self.__async_tool.__signature__
62-
self.__annotations__ = self.__async_tool.__annotations__
6358
# TODO: self.__qualname__ ?? (Consider if needed)
6459

60+
@property
61+
def __name__(self) -> str:
62+
return self.__async_tool.__name__
63+
64+
@property
65+
def __doc__(self) -> str | None: # Docstring can be None
66+
return self.__async_tool.__doc__
67+
68+
@property
69+
def __signature__(self) -> Signature:
70+
return self.__async_tool.__signature__
71+
72+
@property
73+
def __annotations__(self) -> dict[str, Any]:
74+
return self.__async_tool.__annotations__
75+
6576
def __call__(self, *args: Any, **kwargs: Any) -> str:
6677
"""
6778
Synchronously calls the remote tool with the provided arguments.

0 commit comments

Comments
 (0)