diff options
author | Eli Bendersky <eliben@gmail.com> | 2020-04-15 15:07:22 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2020-04-15 15:07:22 -0700 |
commit | 66fc2434c804867707392b704c3cd13923118476 (patch) | |
tree | e6ffa9b7476f832fe656af8734fc00e2efc55eeb | |
parent | 7b893b86bb185ff1262f6a524e92b8ad592acaa3 (diff) | |
download | pycparser-66fc2434c804867707392b704c3cd13923118476.tar.gz |
Clean up whitespace in generated AST code
-rw-r--r-- | pycparser/_ast_gen.py | 10 | ||||
-rw-r--r-- | 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): |