X Tutup
Skip to content

Commit e368ab2

Browse files
committed
print AST children counts for internal nodes
1 parent 5f6314d commit e368ab2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*_dis
22
*~
3+
*.pyc
34
/.cache
45
/.eggs
56
/.python-version

uncompyle6/parsers/astnode.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ def __hash__(self):
3434
def __repr__(self, indent=''):
3535
rv = str(self.type)
3636
for k in self:
37-
rv = rv + '\n' + str(k).replace('\n', '\n ')
37+
child_text = str(k).replace('\n', '\n ')
38+
if hasattr(k, '__len__'):
39+
rv += '\n(%d) %s' % (len(k), child_text)
40+
else:
41+
rv += '\n' + child_text
3842
return rv

0 commit comments

Comments
 (0)
X Tutup