diff options
Diffstat (limited to 'as_string.py')
-rw-r--r-- | as_string.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/as_string.py b/as_string.py index 72c5b6c3..ace1c4e3 100644 --- a/as_string.py +++ b/as_string.py @@ -467,6 +467,15 @@ class AsStringVisitor3k(AsStringVisitor): """return Starred node as string""" return "*" + node.value.accept(self) + def visit_yieldfrom(self, node): + """ Return an astroid.YieldFrom node as string. """ + yi_val = node.value and (" " + node.value.accept(self)) or "" + expr = 'yield from' + yi_val + if node.parent.is_statement: + return expr + else: + return "(%s)" % (expr,) + def _import_string(names): """return a list of (name, asname) formatted as a string""" |