astor.dump_tree doesn't populate ctx.
Opened this issue · 0 comments
stuaxo commented
I've started playing with astor and ASTs, and noticed astor doesn't populate ctx
when using dump_tree
, this makes means there is an extra step to fill this out before the output can be used for NodeTransformer etc.
Astor dump - no ctx:
print(astor.dump_tree(parse('a = variables[1]')))
Module(
body=[
Assign(targets=[Name(id='a')],
value=Subscript(value=Name(id='variables'), slice=Index(value=Constant(value=1, kind=None))),
type_comment=None)],
type_ignores=[])
dump_tree from greentreesnakes:
print(dump(parse('a = variables[1]')))
Module(body=[
Assign(targets=[
Name(id='a', ctx=Store()),
], value=Subscript(value=Name(id='variables', ctx=Load()), slice=Index(value=Constant(value=1, kind=None)), ctx=Load()), type_comment=None),
], type_ignores=[])