Skip to content

Commit

Permalink
Merge pull request #2 from PCManticore/remove_postinit
Browse files Browse the repository at this point in the history
Remove postinit
  • Loading branch information
PCManticore committed May 3, 2016
2 parents 76a8c3c + a634842 commit 3885411
Show file tree
Hide file tree
Showing 6 changed files with 674 additions and 647 deletions.
22 changes: 14 additions & 8 deletions astroid/as_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,13 @@ def visit_yield(self, node):
"""yield an ast.Yield node as string"""
yi_val = node.value and (" " + node.value.accept(self)) or ""
expr = 'yield' + yi_val
if node.parent.is_statement:
return expr
else:
return "(%s)" % (expr,)
# TODO: this code can be restored when the as_string() visitor
# is made to work with the zipper.

# if node.parent.is_statement:
# return expr
# else:
return "(%s)" % (expr,)

def visit_starred(self, node):
"""return Starred node as string"""
Expand Down Expand Up @@ -453,10 +456,13 @@ 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,)
# TODO: this code can be restored when the as_string() visitor
# is made to work with the zipper.

# if node.parent.is_statement:
# return expr
# else:
return "(%s)" % (expr,)

def visit_asyncfunctiondef(self, node):
function = super(AsStringVisitor3, self).visit_functiondef(node)
Expand Down
3 changes: 1 addition & 2 deletions astroid/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ class BaseNode(object):
# instance specific inference function infer(node, context)
_explicit_inference = None

def __init__(self, lineno=None, col_offset=None, parent=None):
def __init__(self, lineno=None, col_offset=None):
self.lineno = lineno
self.col_offset = col_offset
self.parent = parent

def __iter__(self):
for field in self._astroid_fields:
Expand Down
Loading

0 comments on commit 3885411

Please sign in to comment.