Skip to content

Commit db1ab46

Browse files
committed
fmt
1 parent 54c096f commit db1ab46

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

jupyter_ai_tools/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
def _jupyter_server_extension_points():
55
return [{"module": "jupyter_ai_tools"}]
66

7+
78
def _load_jupyter_server_extension(serverapp):
8-
serverapp.log.info("✅ jupyter_ai_tools extension loaded.")
9+
serverapp.log.info("✅ jupyter_ai_tools extension loaded.")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"""Toolkits for Jupyter"""
1+
"""Toolkits for Jupyter"""
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tools that provide code execution features"""
22

3-
43
import asyncio
54
import shlex
65
from typing import Optional
@@ -10,40 +9,39 @@
109

1110
async def bash(command: str, timeout: Optional[int] = None) -> str:
1211
"""Executes a bash command and returns the result
13-
12+
1413
Args:
1514
command: The bash command to execute
1615
timeout: Optional timeout in seconds
17-
16+
1817
Returns:
1918
The command output (stdout and stderr combined)
2019
"""
21-
20+
2221
proc = await asyncio.create_subprocess_exec(
2322
*shlex.split(command),
2423
stdout=asyncio.subprocess.PIPE,
2524
stderr=asyncio.subprocess.PIPE,
2625
)
27-
26+
2827
try:
2928
stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout)
3029
output = stdout.decode("utf-8")
3130
error = stderr.decode("utf-8")
32-
31+
3332
if proc.returncode != 0:
3433
if error:
3534
return f"Error: {error}"
3635
return f"Command failed with exit code {proc.returncode}"
37-
36+
3837
return output if output else "Command executed successfully with no output."
3938
except asyncio.TimeoutError:
4039
proc.kill()
4140
return f"Command timed out after {timeout} seconds"
42-
41+
4342

4443
toolkit = Toolkit(
4544
name="code_execution_toolkit",
4645
description="Tools to execute code in different environments.",
4746
)
4847
toolkit.add_tool(Tool(callable=bash, execute=True))
49-

jupyter_ai_tools/toolkits/file_system.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def glob(pattern: str, path: Optional[str] = None) -> str:
213213
# Sort files by modification time (most recent first)
214214
matching_files.sort(key=lambda f: os.path.getmtime(f), reverse=True)
215215
matching_files = [str(f) for f in matching_files]
216-
216+
217217
return "\n".join(matching_files)
218218
except Exception as e:
219219
return f"Error: Failed to perform glob search: {str(e)}"
@@ -343,4 +343,3 @@ async def ls(path: str, ignore: Optional[List[str]] = None) -> str:
343343
toolkit.add_tool(Tool(callable=glob, read=True))
344344
toolkit.add_tool(Tool(callable=grep, read=True))
345345
toolkit.add_tool(Tool(callable=ls, read=True))
346-

0 commit comments

Comments
 (0)