Skip to content

Commit

Permalink
feat: code_to_dag can have return line. Close #72
Browse files Browse the repository at this point in the history
  • Loading branch information
thorwhalen committed Oct 24, 2023
1 parent d380487 commit 97e632f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion meshed/makers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def parse_body(body):
info = _ast_info_str(body)
if isinstance(body, ast.Assign):
return parse_assignment(body, info=info)
elif isinstance(body, ast.Return):
return None # ignore # TODO: Would like to actually use this
else:
raise ValueError(
f"Couldn't find a handler for parsing body with {info} ({body=})"
Expand Down Expand Up @@ -378,7 +380,8 @@ def parse_steps(src):
# return etc.)
# return func_body
for body in func_body.body:
yield parse_body(body)
if (parsed_body := parse_body(body)) is not None:
yield parsed_body


parse_assignment_steps = parse_steps # backcompatible
Expand Down Expand Up @@ -513,6 +516,7 @@ def code_to_fnodes(
# Pass on to _code_to_fnodes to get func nodes iterable needed to make DAG
return tuple(_code_to_fnodes(src, func_src))


def _reconfigure_signature_according_to_src(src, dag):
if callable(src):
new_dag_sig = Sig(dag).modified(_allow_reordering=True, **Sig(src).parameters)
Expand Down

0 comments on commit 97e632f

Please sign in to comment.