Skip to content

Commit 954d7d2

Browse files
twishabansalkurtisvganubhav756
authored
Apply suggestions from code review
Co-authored-by: Kurtis Van Gent <[email protected]> Co-authored-by: Anubhav Dhawan <[email protected]>
1 parent 9c0d0db commit 954d7d2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def __start_session() -> None:
6565

6666
coro = __start_session()
6767

68-
asyncio.run_coroutine_threadsafe(coro, ToolboxSyncClient.__loop).result()
68+
asyncio.run_coroutine_threadsafe(__start_session(), ToolboxSyncClient.__loop).result()
6969

7070
if not ToolboxSyncClient.__session:
7171
raise ValueError("Session cannot be None.")
@@ -114,6 +114,7 @@ def load_tool(
114114
Returns:
115115
ToolboxSyncTool: A synchronous callable object representing the loaded tool.
116116
"""
117+
117118
async_tool = self.__run_as_sync(
118119
self.__async_client.load_tool(tool_name, auth_token_getters, bound_params)
119120
)
@@ -142,6 +143,7 @@ def load_toolset(
142143
list[ToolboxSyncTool]: A list of synchronous callables, one for each
143144
tool defined in the toolset.
144145
"""
146+
145147
async_tools = self.__run_as_sync(
146148
self.__async_client.load_toolset(
147149
toolset_name, auth_token_getters, bound_params

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(
4141
Args:
4242
async_tool: An instance of the asynchronous ToolboxTool.
4343
"""
44+
4445
if not isinstance(async_tool, ToolboxTool):
4546
raise TypeError("async_tool must be an instance of ToolboxTool")
4647

@@ -109,6 +110,7 @@ def add_auth_token_getters(
109110
Returns:
110111
A new SyncToolboxTool instance wrapping the updated async tool.
111112
"""
113+
112114
new_async_tool = self.__async_tool.add_auth_token_getters(auth_token_getters)
113115
return ToolboxSyncTool(new_async_tool, self.__loop, self.__thread)
114116

@@ -125,5 +127,6 @@ def bind_parameters(
125127
Returns:
126128
A new SyncToolboxTool instance wrapping the updated async tool.
127129
"""
130+
128131
new_async_tool = self.__async_tool.bind_parameters(bound_params)
129132
return ToolboxSyncTool(new_async_tool, self.__loop, self.__thread)

packages/toolbox-core/tests/test_sync_e2e.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
import pytest
1516

1617
from toolbox_core.sync_client import ToolboxSyncClient

0 commit comments

Comments
 (0)