Skip to content

Commit 17bee17

Browse files
committed
add subsection for get_schema tests
1 parent bdefb10 commit 17bee17

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

01_funccall.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,14 @@
10481048
"get_schema(path_test2)"
10491049
]
10501050
},
1051+
{
1052+
"cell_type": "markdown",
1053+
"id": "369320d4",
1054+
"metadata": {},
1055+
"source": [
1056+
"### Additional `get_schema()` Test Cases"
1057+
]
1058+
},
10511059
{
10521060
"cell_type": "markdown",
10531061
"id": "a8052380",

toolslm/funccall.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ def PathArg(
112112
path: str # A filesystem path
113113
): return Path(path)
114114

115-
# %% ../01_funccall.ipynb 65
115+
# %% ../01_funccall.ipynb 66
116116
import ast, time, signal, traceback
117117
from fastcore.utils import *
118118

119-
# %% ../01_funccall.ipynb 66
119+
# %% ../01_funccall.ipynb 67
120120
def _copy_loc(new, orig):
121121
"Copy location information from original node to new node and all children."
122122
new = ast.copy_location(new, orig)
@@ -125,7 +125,7 @@ def _copy_loc(new, orig):
125125
elif isinstance(o, list): setattr(new, field, [_copy_loc(value, orig) for value in o])
126126
return new
127127

128-
# %% ../01_funccall.ipynb 68
128+
# %% ../01_funccall.ipynb 69
129129
def _run(code:str ):
130130
"Run `code`, returning final expression (similar to IPython)"
131131
tree = ast.parse(code)
@@ -148,7 +148,7 @@ def _run(code:str ):
148148
if _result is not None: return _result
149149
return stdout_buffer.getvalue().strip()
150150

151-
# %% ../01_funccall.ipynb 73
151+
# %% ../01_funccall.ipynb 74
152152
def python(code, # Code to execute
153153
timeout=5 # Maximum run time in seconds before a `TimeoutError` is raised
154154
): # Result of last node, if it's an expression, or `None` otherwise
@@ -161,7 +161,7 @@ def handler(*args): raise TimeoutError()
161161
except Exception as e: return traceback.format_exc()
162162
finally: signal.alarm(0)
163163

164-
# %% ../01_funccall.ipynb 80
164+
# %% ../01_funccall.ipynb 81
165165
def mk_ns(*funcs_or_objs):
166166
merged = {}
167167
for o in funcs_or_objs:
@@ -170,7 +170,7 @@ def mk_ns(*funcs_or_objs):
170170
if callable(o) and hasattr(o, '__name__'): merged |= {o.__name__: o}
171171
return merged
172172

173-
# %% ../01_funccall.ipynb 89
173+
# %% ../01_funccall.ipynb 90
174174
def call_func(fc_name, fc_inputs, ns):
175175
"Call the function `fc_name` with the given `fc_inputs` using namespace `ns`."
176176
if not isinstance(ns, abc.Mapping): ns = mk_ns(*ns)

0 commit comments

Comments
 (0)