Extend code_to_dag to handle tuple outputs and keyword arguments
Closed this issue · 1 comments
thorwhalen commented
So far we can do:
def user_story():
wfs = make_wfs(data_source)
chks = chunker(wfs, chk_size) # multiple inputs!
But can't handle lines like
train_chks, test_chks = splitter(chks, from_data_source=data_source)
for two reasons:
- the
method='simple'
isn't handled correctly (should lead to abind: {0: 'chks', 'from_data_source'='data_source'}
- We can't handle the
ast.Tuple
element that the assignment targettrain_chks, test_chks
leads to.
Would be nice to include these in the language we handle.
thorwhalen commented
Now:
from meshed.makers import code_to_digraph
def user_story_01():
# Sure, linter complains that names are not known, but all we want is valid code.
# TODO: How to shut the linter up on this?
# simple function calls
data_source = get_data_source() # no inputs
wfs = make_wfs(data_source) # one input
chks = chunker(wfs, chk_size) # two (positional) inputs
# verify that we can handle multiple outputs (split)
train_chks, test_chks = splitter(chks)
# verify that we can handle k=v inputs (if v is a variable name):
featurizer_obj = learn_featurizer(featurizer_learner, train_data=train_chks)
code_to_digraph(user_story_01)