From 66fc2434c804867707392b704c3cd13923118476 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 15 Apr 2020 15:07:22 -0700 Subject: Clean up whitespace in generated AST code --- pycparser/_ast_gen.py | 10 +++++----- pycparser/c_ast.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pycparser/_ast_gen.py b/pycparser/_ast_gen.py index 5ec2d3d..ba03d90 100644 --- a/pycparser/_ast_gen.py +++ b/pycparser/_ast_gen.py @@ -196,7 +196,7 @@ def _repr(obj): if isinstance(obj, list): return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]' else: - return repr(obj) + return repr(obj) class Node(object): __slots__ = () @@ -206,19 +206,19 @@ class Node(object): """ Generates a python representation of the current node """ result = self.__class__.__name__ + '(' - + indent = '' separator = '' for name in self.__slots__[:-2]: result += separator result += indent result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__))))) - + separator = ',' indent = '\n ' + (' ' * len(self.__class__.__name__)) - + result += indent + ')' - + return result def children(self): diff --git a/pycparser/c_ast.py b/pycparser/c_ast.py index b7bbbee..0ce8fef 100644 --- a/pycparser/c_ast.py +++ b/pycparser/c_ast.py @@ -25,7 +25,7 @@ def _repr(obj): if isinstance(obj, list): return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]' else: - return repr(obj) + return repr(obj) class Node(object): __slots__ = () @@ -35,19 +35,19 @@ class Node(object): """ Generates a python representation of the current node """ result = self.__class__.__name__ + '(' - + indent = '' separator = '' for name in self.__slots__[:-2]: result += separator result += indent result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__))))) - + separator = ',' indent = '\n ' + (' ' * len(self.__class__.__name__)) - + result += indent + ')' - + return result def children(self): -- cgit v1.2.1