You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Add node and template code to cleanup "for" handling
This commit is contained in:
@@ -57,6 +57,14 @@ ExtractInfo = namedtuple("ExtractInfo",
|
||||
TABLE_DIRECT_FRAGMENT = {
|
||||
'importstmt': ( '%|import %c%x\n', 2, (2, (0, 1)), ),
|
||||
'importfrom': ( '%|from %[2]{pattr}%x import %c\n', (2, (0, 1)), 3),
|
||||
# FIXME: fix bugs below and add
|
||||
# 'forstmt': ( '%|for %c%x in %c:\n%+%c%-\n\n', 3, (3, (2,)), 1, 4 ),
|
||||
# 'forelsestmt': (
|
||||
# '%|for %c in %c%x:\n%+%c%-%|else:\n%+%c%-\n\n', 3, (3, (2,)), 1, 4, -2),
|
||||
# 'forelselaststmt': (
|
||||
# '%|for %c%x in %c:\n%+%c%-%|else:\n%+%c%-', 3, (3, (2,)), 1, 4, -2),
|
||||
# 'forelselaststmtl': (
|
||||
# '%|for %c%x in %c:\n%+%c%-%|else:\n%+%c%-\n\n', 3, (3, (2,)), 1, 4, -2),
|
||||
}
|
||||
|
||||
class Traverser(pysource.Walker, object):
|
||||
|
@@ -41,8 +41,8 @@ methods implement most of the below.
|
||||
format string and arguments (a la printf()) for the formatting engine.
|
||||
Escapes in the format string are:
|
||||
|
||||
%c evaluate N[A] recursively*
|
||||
%C evaluate N[A[0]]..N[A[1]-1] recursively, separate by A[2]*
|
||||
%c evaluate children N[A] recursively*
|
||||
%C evaluate children N[A[0]]..N[A[1]-1] recursively, separate by A[2]*
|
||||
%P same as %C but sets operator precedence
|
||||
%, print ',' if last %C only printed one item (for tuples--unused)
|
||||
%| tab to current indentation level
|
||||
|
Reference in New Issue
Block a user