Remove Whitespace class and replace it with Newline and Endmarker.

This commit is contained in:
Dave Halter
2016-07-24 17:16:36 +02:00
parent 7f2f66f011
commit ff47fab62a
5 changed files with 17 additions and 10 deletions

View File

@@ -154,7 +154,7 @@ def get_faked(module, obj, name=None):
doc = '"""%s"""' % obj.__doc__ # TODO need escapes.
suite = result.children[-1]
string = pt.String(pt.zero_position_modifier, doc, (0, 0), '')
new_line = pt.Whitespace('\n', (0, 0), '')
new_line = pt.Newline('\n', (0, 0), '')
docstr_node = pt.Node('simple_stmt', [string, new_line])
suite.children.insert(2, docstr_node)
return result

View File

@@ -26,8 +26,8 @@ def deep_ast_copy(obj, parent=None, new_elements=None):
new_children = []
for child in obj.children:
typ = child.type
if typ in ('whitespace', 'operator', 'keyword', 'number', 'string',
'indent', 'dedent', 'error_leaf'):
if typ in ('newline', 'operator', 'keyword', 'number', 'string',
'indent', 'dedent', 'endmarker', 'error_leaf'):
# At the moment we're not actually copying those primitive
# elements, because there's really no need to. The parents are
# obviously wrong, but that's not an issue.