Move equivalent reference sources to the input directory
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
testcode = 'a = 12'
|
||||
|
||||
exec testcode
|
||||
exec testcode in globals()
|
||||
exec testcode in globals(), locals()
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def _lsbStrToInt(str):
|
||||
return ord(str[0]) + (ord(str[1]) << 8) + (ord(str[2]) << 16) + (ord(str[3]) << 24)
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def x0():
|
||||
pass
|
||||
|
||||
def x1(arg1):
|
||||
pass
|
||||
|
||||
def x2(arg1, arg2):
|
||||
pass
|
||||
|
||||
def x3a(*args):
|
||||
pass
|
||||
|
||||
def x3b(**kwargs):
|
||||
pass
|
||||
|
||||
def x3c(*args, **kwargs):
|
||||
pass
|
||||
|
||||
def x4a(foo, bar = 1, bla = 2, *args):
|
||||
pass
|
||||
|
||||
def x4b(foo, bar = 1, bla = 2, **kwargs):
|
||||
pass
|
||||
|
||||
def x4c(foo, bar = 1, bla = 2, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def func_with_tuple_args((a, b)):
|
||||
print a
|
||||
print b
|
||||
|
||||
def func_with_tuple_args2((a, b), (c, d)):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args3((a, b), (c, d), *args):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args4((a, b), (c, d), **kwargs):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args5((a, b), (c, d), *args, **kwargs):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args6((a, b), (c, d) = (2, 3), *args, **kwargs):
|
||||
print a
|
||||
print c
|
||||
@@ -1,26 +0,0 @@
|
||||
"""
|
||||
test_global.py -- source test pattern for 'global' statement
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
i = 1; j = 7
|
||||
def a():
|
||||
def b():
|
||||
def c():
|
||||
k = 34
|
||||
global i
|
||||
i = i + k
|
||||
l = 42
|
||||
c()
|
||||
global j
|
||||
j = j + l
|
||||
b()
|
||||
print i, j
|
||||
|
||||
a()
|
||||
print i, j
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def f():
|
||||
print x
|
||||
x = x + 1
|
||||
print x
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
x = 1
|
||||
f()
|
||||
print x
|
||||
@@ -1,21 +0,0 @@
|
||||
"""
|
||||
test_import.py -- source test pattern for import statements
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os, sys, BaseHTTPServer
|
||||
|
||||
import test.test_MimeWriter
|
||||
|
||||
from rfc822 import Message
|
||||
from mimetools import Message, decode, choose_boundary
|
||||
from os import *
|
||||
|
||||
for (k, v) in globals().items():
|
||||
print `k`, v
|
||||
@@ -1,33 +0,0 @@
|
||||
"""
|
||||
test_integers.py -- source test pattern for integers
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
Snippet taken from python libs's test_class.py
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
i = 1
|
||||
i = 42
|
||||
i = -1
|
||||
i = -42
|
||||
i = sys.maxint
|
||||
minint = -sys.maxint - 1
|
||||
print sys.maxint
|
||||
print minint
|
||||
print long(minint) - 1
|
||||
|
||||
print
|
||||
i = -2147483647
|
||||
print i, repr(i)
|
||||
i = i - 1
|
||||
print i, repr(i)
|
||||
i = -0x80000000L
|
||||
print i, repr(i)
|
||||
i = -0x80000001L
|
||||
print i, repr(i)
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
palette = map(lambda a: (a, a, a), range(256))
|
||||
palette = map(lambda (r, g, b): chr(r) + chr(g) + chr(b), palette)
|
||||
palette = map(lambda r: r, palette)
|
||||
|
||||
palette = lambda (r, g, b): r
|
||||
palette = lambda (r): r
|
||||
palette = lambda r: r
|
||||
palette = (lambda (r): r, palette)
|
||||
@@ -1,48 +0,0 @@
|
||||
"""
|
||||
test_loops.py -- source test pattern for loops
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
for i in range(10):
|
||||
if i == 3:
|
||||
continue
|
||||
if i == 5:
|
||||
break
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
print
|
||||
|
||||
for i in range(10):
|
||||
if i == 3:
|
||||
continue
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
|
||||
|
||||
i = 0
|
||||
while i < 10:
|
||||
i = i + 1
|
||||
if i == 3:
|
||||
continue
|
||||
if i == 5:
|
||||
break
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
print
|
||||
|
||||
i = 0
|
||||
while i < 10:
|
||||
i = i + 1
|
||||
if i == 3:
|
||||
continue
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
class A:
|
||||
def __init__(self, num):
|
||||
self.num = num
|
||||
def __repr__(self):
|
||||
return str(self.num)
|
||||
|
||||
b = []
|
||||
for i in range(10):
|
||||
b.append(A(i))
|
||||
|
||||
for i in ('CALL_FUNCTION', 'CALL_FUNCTION_VAR', 'CALL_FUNCTION_VAR_KW', 'CALL_FUNCTION_KW'):
|
||||
|
||||
print i, '\t', len(i), len(i) - len('CALL_FUNCTION'),
|
||||
print (len(i) - len('CALL_FUNCTION')) / 3,
|
||||
print i[len('CALL_FUNCTION'):]
|
||||
|
||||
p2 = (0, 0, None)
|
||||
if p2[2]:
|
||||
print 'has value'
|
||||
else:
|
||||
print ' no value'
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
a = None
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
elif a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
elif a == 3:
|
||||
print '3'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
|
||||
elif a ==2: # No bytecode distinction between else: if: and elif:
|
||||
print '2'
|
||||
|
||||
elif a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
|
||||
elif a == 2:
|
||||
print '2'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 2:
|
||||
print '2'
|
||||
|
||||
elif a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 2:
|
||||
print '2'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 3:
|
||||
print '3'
|
||||
elif a == 4:
|
||||
print '4'
|
||||
elif a == 4:
|
||||
print '4'
|
||||
else:
|
||||
print 'other'
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print 1, 2, 3, 4, 5
|
||||
a = b + 5
|
||||
print 1, 2, 3, 4, 5
|
||||
print 1, 2, 3, 4, 5
|
||||
print
|
||||
print
|
||||
print 1, 2, 3, 4, 5
|
||||
print
|
||||
@@ -1,25 +0,0 @@
|
||||
"""
|
||||
test_tuples.py -- source test pattern for tuples
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
a = (1,)
|
||||
b = (2, 3)
|
||||
a, b = (1, 2)
|
||||
a, b = (1, 2), (3, 4, 5)
|
||||
|
||||
x = {}
|
||||
try:
|
||||
x[1, 2, 3]
|
||||
except:
|
||||
pass
|
||||
x[1, 2, 3] = 42
|
||||
print x[1, 2, 3]
|
||||
print x[1, 2, 3]
|
||||
assert x[1, 2, 3] == x[1, 2, 3]
|
||||
del x[1, 2, 3]
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def kwfunc(**kwargs):
|
||||
print kwargs.items()
|
||||
|
||||
def argsfunc(*args):
|
||||
print args
|
||||
|
||||
def no_apply(*args, **kwargs):
|
||||
print args
|
||||
print kwargs.items()
|
||||
argsfunc(34)
|
||||
foo = argsfunc(*args)
|
||||
argsfunc(*args)
|
||||
argsfunc(34, *args)
|
||||
kwfunc(**kwargs)
|
||||
kwfunc(x=11, **kwargs)
|
||||
no_apply(*args, **kwargs)
|
||||
no_apply(34, *args, **kwargs)
|
||||
no_apply(x=11, *args, **kwargs)
|
||||
no_apply(34, x=11, *args, **kwargs)
|
||||
no_apply(42, 34, x=11, *args, **kwargs)
|
||||
|
||||
no_apply(1, 2, 4, 8, a=2, b=3, c=5)
|
||||
@@ -1,55 +0,0 @@
|
||||
"""
|
||||
augmentedAssign.py -- source test pattern for augmented assigns
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
a = 1
|
||||
b = 2
|
||||
a += b; print a # Combined to match line numbers
|
||||
a -= b; print a
|
||||
a *= b; print a
|
||||
a -= a; print a
|
||||
a += 7 * 3; print a
|
||||
|
||||
l = [1, 2, 3]
|
||||
l[1] *= 3; print l[1]
|
||||
l[1][2][3] = 7
|
||||
l[1][2][3] *= 3
|
||||
l[:] += [9]; print l
|
||||
l[:2] += [9]; print l
|
||||
l[1:] += [9]; print l
|
||||
l[1:4] += [9]; print l
|
||||
l += [42, 43]; print l
|
||||
|
||||
a.value = 1
|
||||
a.value += 1
|
||||
a.b.val = 1
|
||||
a.b.val += 1
|
||||
|
||||
l = []
|
||||
for i in range(3):
|
||||
lj = []
|
||||
for j in range(3):
|
||||
lk = []
|
||||
for k in range(3):
|
||||
lk.append(0)
|
||||
lj.append(lk)
|
||||
l.append(lj)
|
||||
|
||||
i = j = k = 1
|
||||
def f():
|
||||
global i
|
||||
i += 1
|
||||
return i
|
||||
|
||||
l[i][j][k] = 1
|
||||
i = 1
|
||||
l[f()][j][k] += 1
|
||||
print i, l
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
|
||||
print ' 1 // 2 =', 1 // 2
|
||||
print '1.0 // 2.0 =', 1.0 // 2.0
|
||||
print ' 1 / 2 =', 1 / 2
|
||||
print '1.0 / 2.0 =', 1.0 / 2.0
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
This is a doc string
|
||||
"""
|
||||
|
||||
def Doc_Test():
|
||||
"""This has to be present"""
|
||||
|
||||
class XXX:
|
||||
def __init__(self):
|
||||
"""__init__: This has to be present"""
|
||||
self.a = 1
|
||||
|
||||
def XXX22():
|
||||
"""XXX22: This has to be present"""
|
||||
pass
|
||||
|
||||
def XXX11():
|
||||
"""XXX22: This has to be present"""
|
||||
pass
|
||||
|
||||
def XXX12():
|
||||
foo = 'XXX22: This has to be present'
|
||||
pass # Left for line number compatibility. Do not emit
|
||||
|
||||
def XXX13():
|
||||
pass
|
||||
|
||||
def Y11():
|
||||
def Y22():
|
||||
def Y33():
|
||||
pass
|
||||
|
||||
print __doc__
|
||||
@@ -1,107 +0,0 @@
|
||||
import dis
|
||||
|
||||
def x11():
|
||||
try:
|
||||
a = 'try except'
|
||||
except:
|
||||
a = 2
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x12():
|
||||
try:
|
||||
a = 'try except else(pass)'
|
||||
except:
|
||||
a = 2
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x13():
|
||||
try:
|
||||
a = 'try except else(a=3)'
|
||||
except:
|
||||
a = 2
|
||||
else:
|
||||
a = 3
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x21():
|
||||
try:
|
||||
a = 'try KeyError'
|
||||
except KeyError:
|
||||
a = 8
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x22():
|
||||
try:
|
||||
a = 'try (IdxErr, KeyError) else(pass)'
|
||||
except (IndexError, KeyError):
|
||||
a = 8
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x23():
|
||||
try:
|
||||
a = 'try KeyError else(a=9)'
|
||||
except KeyError:
|
||||
a = 8
|
||||
else:
|
||||
a = 9
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x31():
|
||||
try:
|
||||
a = 'try KeyError IndexError'
|
||||
except KeyError:
|
||||
a = 8
|
||||
except IndexError:
|
||||
a = 9
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x32():
|
||||
try:
|
||||
a = 'try KeyError IndexError else(pass)'
|
||||
except KeyError:
|
||||
a = 8
|
||||
except IndexError:
|
||||
a = 9
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x33():
|
||||
try:
|
||||
a = 'try KeyError IndexError else(a=9)'
|
||||
except KeyError:
|
||||
a = 8
|
||||
except IndexError:
|
||||
a = 9
|
||||
else:
|
||||
a = 9
|
||||
b = '#################'
|
||||
|
||||
|
||||
def x41():
|
||||
if a == 1:
|
||||
a = 1
|
||||
elif b == 1:
|
||||
b = 1
|
||||
else:
|
||||
c = 1
|
||||
b = '#################'
|
||||
|
||||
|
||||
def x42():
|
||||
if a == 1:
|
||||
a = 1
|
||||
elif b == 1:
|
||||
b = 1
|
||||
else:
|
||||
c = 1
|
||||
xxx = 'mmm'
|
||||
|
||||
if __name__ == '__main__':
|
||||
dis.dis(xx)
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
testcode = 'a = 12'
|
||||
|
||||
exec testcode
|
||||
exec testcode in globals()
|
||||
exec testcode in globals(), locals()
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def _lsbStrToInt(str):
|
||||
return ord(str[0]) + (ord(str[1]) << 8) + (ord(str[2]) << 16) + (ord(str[3]) << 24)
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import os, sys as System, time # Combined to match line numbers
|
||||
import sys
|
||||
|
||||
from rfc822 import Message as Msg822
|
||||
from mimetools import Message as MimeMsg, decode, choose_boundary as MimeBoundary
|
||||
|
||||
import test.test_StringIO as StringTest
|
||||
|
||||
for k, v in globals().items():
|
||||
print `k`, v
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
print >>sys.stdout, 'Hello World'
|
||||
print >>sys.stdout, 1, 2, 3
|
||||
print >>sys.stdout, 1, 2, 3,
|
||||
print >>sys.stdout
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def x0():
|
||||
pass
|
||||
|
||||
def x1(arg1):
|
||||
pass
|
||||
|
||||
def x2(arg1, arg2):
|
||||
pass
|
||||
|
||||
def x3a(*args):
|
||||
pass
|
||||
|
||||
def x3b(**kwargs):
|
||||
pass
|
||||
|
||||
def x3c(*args, **kwargs):
|
||||
pass
|
||||
|
||||
def x4a(foo, bar = 1, bla = 2, *args):
|
||||
pass
|
||||
|
||||
def x4b(foo, bar = 1, bla = 2, **kwargs):
|
||||
pass
|
||||
|
||||
def x4c(foo, bar = 1, bla = 2, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def func_with_tuple_args((a, b)):
|
||||
print a
|
||||
print b
|
||||
|
||||
def func_with_tuple_args2((a, b), (c, d)):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args3((a, b), (c, d), *args):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args4((a, b), (c, d), **kwargs):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args5((a, b), (c, d), *args, **kwargs):
|
||||
print a
|
||||
print c
|
||||
|
||||
def func_with_tuple_args6((a, b), (c, d) = (2, 3), *args, **kwargs):
|
||||
print a
|
||||
print c
|
||||
@@ -1,26 +0,0 @@
|
||||
"""
|
||||
test_global.py -- source test pattern for 'global' statement
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
i = 1; j = 7
|
||||
def a():
|
||||
def b():
|
||||
def c():
|
||||
k = 34
|
||||
global i
|
||||
i = i + k
|
||||
l = 42
|
||||
c()
|
||||
global j
|
||||
j = j + l
|
||||
b()
|
||||
print i, j
|
||||
|
||||
a()
|
||||
print i, j
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def f():
|
||||
print x
|
||||
x = x + 1
|
||||
print x
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
x = 1
|
||||
f()
|
||||
print x
|
||||
@@ -1,21 +0,0 @@
|
||||
"""
|
||||
test_import.py -- source test pattern for import statements
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os, sys, BaseHTTPServer
|
||||
|
||||
import test.test_MimeWriter
|
||||
|
||||
from rfc822 import Message
|
||||
from mimetools import Message, decode, choose_boundary
|
||||
from os import *
|
||||
|
||||
for (k, v) in globals().items():
|
||||
print `k`, v
|
||||
@@ -1,23 +0,0 @@
|
||||
"""
|
||||
test_import_as.py -- source test pattern for 'import .. as 'statements
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
import sys as SYS
|
||||
import os as OS, sys as SYSTEM, BaseHTTPServer as HTTPServ # Combined to match line numbers
|
||||
|
||||
import test.test_MimeWriter as Mime_Writer
|
||||
|
||||
from rfc822 import Message as MSG
|
||||
from mimetools import Message as mimeMsg, decode, choose_boundary as mimeBoundry
|
||||
|
||||
|
||||
print '---' * 20
|
||||
|
||||
for k, v in globals().items():
|
||||
print k, repr(v)
|
||||
@@ -1,33 +0,0 @@
|
||||
"""
|
||||
test_integers.py -- source test pattern for integers
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
Snippet taken from python libs's test_class.py
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
i = 1
|
||||
i = 42
|
||||
i = -1
|
||||
i = -42
|
||||
i = sys.maxint
|
||||
minint = -sys.maxint - 1
|
||||
print sys.maxint
|
||||
print minint
|
||||
print long(minint) - 1
|
||||
|
||||
print
|
||||
i = -2147483647
|
||||
print i, repr(i)
|
||||
i = i - 1
|
||||
print i, repr(i)
|
||||
i = -0x80000000L
|
||||
print i, repr(i)
|
||||
i = -0x80000001L
|
||||
print i, repr(i)
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
for i in range(20):
|
||||
print i,
|
||||
|
||||
print
|
||||
|
||||
for i in range(10):
|
||||
print i,
|
||||
|
||||
else:
|
||||
print 'The End'
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
palette = map(lambda a: (a, a, a), range(256))
|
||||
palette = map(lambda (r, g, b): chr(r) + chr(g) + chr(b), palette)
|
||||
palette = map(lambda r: r, palette)
|
||||
|
||||
palette = lambda (r, g, b): r
|
||||
palette = lambda (r): r
|
||||
palette = lambda r: r
|
||||
palette = (lambda (r): r, palette)
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
XXX = range(4)
|
||||
|
||||
print [i for i in XXX]
|
||||
print
|
||||
print [i for i in (1, 2, 3, 4)]
|
||||
print
|
||||
print [(i, 1) for i in XXX]
|
||||
print
|
||||
print [i * 2 for i in range(4)]
|
||||
print
|
||||
print [i * j for i in range(4)
|
||||
for j in range(7)]
|
||||
print [i * 2 for i in range(4) if i == 0]
|
||||
print [(i, i ** 2) for i in range(4) if i % 2 == 0]
|
||||
print [i * j for i in range(4)
|
||||
if i == 2
|
||||
for j in range(7)
|
||||
if i + (i % 2) == 0]
|
||||
|
||||
seq1 = 'abc'
|
||||
seq2 = (1, 2, 3)
|
||||
|
||||
[(x, y) for x in seq1 for y in seq2]
|
||||
|
||||
def flatten(seq):
|
||||
return [x for subseq in seq for x in subseq]
|
||||
|
||||
print flatten([[0], [1, 2, 3], [4, 5], [6, 7, 8, 9], []])
|
||||
@@ -1,48 +0,0 @@
|
||||
"""
|
||||
test_loops.py -- source test pattern for loops
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
for i in range(10):
|
||||
if i == 3:
|
||||
continue
|
||||
if i == 5:
|
||||
break
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
print
|
||||
|
||||
for i in range(10):
|
||||
if i == 3:
|
||||
continue
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
|
||||
|
||||
i = 0
|
||||
while i < 10:
|
||||
i = i + 1
|
||||
if i == 3:
|
||||
continue
|
||||
if i == 5:
|
||||
break
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
print
|
||||
|
||||
i = 0
|
||||
while i < 10:
|
||||
i = i + 1
|
||||
if i == 3:
|
||||
continue
|
||||
print i,
|
||||
else:
|
||||
print 'Else'
|
||||
@@ -1,20 +0,0 @@
|
||||
"""
|
||||
test_loops2.py -- source test pattern for loops (CONTINUE_LOOP)
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
for term in args:
|
||||
try:
|
||||
print
|
||||
continue
|
||||
print
|
||||
except:
|
||||
pass
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
class A:
|
||||
def __init__(self, num):
|
||||
self.num = num
|
||||
def __repr__(self):
|
||||
return str(self.num)
|
||||
|
||||
b = []
|
||||
for i in range(10):
|
||||
b.append(A(i))
|
||||
|
||||
for i in ('CALL_FUNCTION', 'CALL_FUNCTION_VAR', 'CALL_FUNCTION_VAR_KW', 'CALL_FUNCTION_KW'):
|
||||
|
||||
print i, '\t', len(i), len(i) - len('CALL_FUNCTION'),
|
||||
print (len(i) - len('CALL_FUNCTION')) / 3,
|
||||
print i[len('CALL_FUNCTION'):]
|
||||
|
||||
p2 = (0, 0, None)
|
||||
if p2[2]:
|
||||
print 'has value'
|
||||
else:
|
||||
print ' no value'
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
a = None
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
elif a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
elif a == 2:
|
||||
print '2'
|
||||
elif a == 3:
|
||||
print '3'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
|
||||
elif a ==2: # No bytecode distinction between else: if: and elif:
|
||||
print '2'
|
||||
|
||||
elif a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
|
||||
elif a == 2:
|
||||
print '2'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 2:
|
||||
print '2'
|
||||
|
||||
elif a == 3:
|
||||
print '3'
|
||||
else:
|
||||
print 'other'
|
||||
|
||||
if a == 1:
|
||||
print '1'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 2:
|
||||
print '2'
|
||||
else:
|
||||
print 'more'
|
||||
if a == 3:
|
||||
print '3'
|
||||
elif a == 4:
|
||||
print '4'
|
||||
elif a == 4:
|
||||
print '4'
|
||||
else:
|
||||
print 'other'
|
||||
@@ -1,95 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
from __future__ import nested_scopes
|
||||
|
||||
blurb = 1
|
||||
|
||||
def k0():
|
||||
def l0(m = 1):
|
||||
print
|
||||
l0()
|
||||
|
||||
def x0():
|
||||
def y0():
|
||||
print
|
||||
y0()
|
||||
|
||||
def x1():
|
||||
def y1():
|
||||
print 'y-blurb =', blurb
|
||||
y1()
|
||||
|
||||
def x2():
|
||||
def y2():
|
||||
print
|
||||
blurb = 2
|
||||
y2()
|
||||
|
||||
def x3a():
|
||||
def y3a(x):
|
||||
print 'y-blurb =', blurb, flurb
|
||||
print
|
||||
blurb = 3
|
||||
flurb = 7
|
||||
y3a(1)
|
||||
print 'x3a-blurb =', blurb
|
||||
|
||||
def x3():
|
||||
def y3(x):
|
||||
def z():
|
||||
blurb = 25
|
||||
print 'z-blurb =', blurb,
|
||||
z()
|
||||
print 'y-blurb =', blurb,
|
||||
print
|
||||
blurb = 3
|
||||
y3(1)
|
||||
print 'x3-blurb =', blurb
|
||||
|
||||
def x3b():
|
||||
def y3b(x):
|
||||
def z():
|
||||
print 'z-blurb =', blurb,
|
||||
blurb = 25
|
||||
z()
|
||||
print 'y-blurb =', blurb,
|
||||
print
|
||||
blurb = 3
|
||||
y3b(1)
|
||||
print 'x3-blurb =', blurb
|
||||
|
||||
def x4():
|
||||
def y4(x):
|
||||
def z():
|
||||
print 'z-blurb =', blurb
|
||||
z()
|
||||
global blurb
|
||||
blurb = 3
|
||||
y4(1)
|
||||
|
||||
def x():
|
||||
def y(x):
|
||||
print 'y-blurb =', blurb
|
||||
blurb = 2
|
||||
y(1)
|
||||
|
||||
|
||||
def func_with_tuple_args6((a, b), (c, d) = (2, 3), *args, **kwargs):
|
||||
def y(x):
|
||||
print 'y-a =', a
|
||||
print c
|
||||
|
||||
def find(self, name):
|
||||
|
||||
L = filter(lambda x, name: x == name, self.list_attribute)
|
||||
|
||||
x0(); x1(); x2() # Combined to match line numbers
|
||||
x3(); x3a(); x3b()
|
||||
x4(); x()
|
||||
print 'blurb =', blurb
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print 1, 2, 3, 4, 5
|
||||
a = b + 5
|
||||
print 1, 2, 3, 4, 5
|
||||
print 1, 2, 3, 4, 5
|
||||
print
|
||||
print
|
||||
print 1, 2, 3, 4, 5
|
||||
print
|
||||
@@ -1,21 +0,0 @@
|
||||
"""
|
||||
print_to.py -- source test pattern for 'print >> ...' statements
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
import sys
|
||||
|
||||
print >>sys.stdout, 1, 2, 3, 4, 5
|
||||
|
||||
print >>sys.stdout, 1, 2, 3, 4, 5,
|
||||
print >>sys.stdout
|
||||
|
||||
print >>sys.stdout, 1, 2, 3, 4, 5,
|
||||
print >>sys.stdout, 1, 2, 3, 4, 5,
|
||||
print >>sys.stdout
|
||||
|
||||
print >>sys.stdout
|
||||
@@ -1 +0,0 @@
|
||||
print 5
|
||||
@@ -1,43 +0,0 @@
|
||||
"""
|
||||
test_slices.py -- source test pattern for slices
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
Snippet taken from python libs's test_class.py
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
testme[1]
|
||||
testme[1] = 1
|
||||
del testme[1]
|
||||
|
||||
testme[:42]
|
||||
testme[:42] = 'The Answer'
|
||||
del testme[:42]
|
||||
|
||||
testme[2:1024:]
|
||||
testme[:1024:10]
|
||||
testme[::]
|
||||
testme[2:1024:10]
|
||||
testme[2:1024:10] = 'A lot'
|
||||
del testme[2:1024:10]
|
||||
|
||||
testme[:42, ..., :24:, 24, 100]
|
||||
testme[:42, ..., :24:, 24, 100] = 'Strange'
|
||||
del testme[:42, ..., :24:, 24, 100]
|
||||
|
||||
testme[:]
|
||||
testme[:] = 'Take all'
|
||||
del testme[:]
|
||||
|
||||
testme[40:42]
|
||||
testme[40:42] = 'Three'
|
||||
del testme[40:42]
|
||||
|
||||
testme[40, 41, 42]
|
||||
testme[40, 41, 42] = 'Another Three'
|
||||
del testme[40, 41, 42]
|
||||
@@ -1,25 +0,0 @@
|
||||
"""
|
||||
test_tuples.py -- source test pattern for tuples
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
a = (1,)
|
||||
b = (2, 3)
|
||||
a, b = (1, 2)
|
||||
a, b = (1, 2), (3, 4, 5)
|
||||
|
||||
x = {}
|
||||
try:
|
||||
x[1, 2, 3]
|
||||
except:
|
||||
pass
|
||||
x[1, 2, 3] = 42
|
||||
print x[1, 2, 3]
|
||||
print x[1, 2, 3]
|
||||
assert x[1, 2, 3] == x[1, 2, 3]
|
||||
del x[1, 2, 3]
|
||||
@@ -1,8 +0,0 @@
|
||||
class MyClass:
|
||||
def method(self, i):
|
||||
if i is 5:
|
||||
print 'five'
|
||||
elif not (i is 2):
|
||||
print 'not two'
|
||||
else:
|
||||
print '2'
|
||||
@@ -1,6 +0,0 @@
|
||||
from __future__ import division
|
||||
|
||||
print ' 1 // 2 =', 1 // 2
|
||||
print '1.0 // 2.0 =', 1.0 // 2.0
|
||||
print ' 1 / 2 =', 1 / 2
|
||||
print '1.0 / 2.0 =', 1.0 / 2.0
|
||||
@@ -1,33 +0,0 @@
|
||||
"""
|
||||
This is a doc string
|
||||
"""
|
||||
|
||||
def Doc_Test():
|
||||
"""This has to be present"""
|
||||
pass
|
||||
|
||||
class XXX:
|
||||
def __init__(self):
|
||||
"""__init__: This has to be present"""
|
||||
self.a = 1
|
||||
|
||||
def XXX22():
|
||||
"""XXX22: This has to be present"""
|
||||
pass
|
||||
|
||||
def XXX11():
|
||||
"""XXX22: This has to be present"""
|
||||
pass
|
||||
|
||||
def XXX12():
|
||||
foo = 'XXX22: This has to be present'
|
||||
|
||||
def XXX13():
|
||||
pass
|
||||
|
||||
def Y11():
|
||||
def Y22():
|
||||
def Y33():
|
||||
pass
|
||||
|
||||
print __doc__
|
||||
@@ -1,107 +0,0 @@
|
||||
import dis
|
||||
|
||||
def x11():
|
||||
try:
|
||||
a = 'try except'
|
||||
except:
|
||||
a = 2
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x12():
|
||||
try:
|
||||
a = 'try except else(pass)'
|
||||
except:
|
||||
a = 2
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x13():
|
||||
try:
|
||||
a = 'try except else(a=3)'
|
||||
except:
|
||||
a = 2
|
||||
else:
|
||||
a = 3
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x21():
|
||||
try:
|
||||
a = 'try KeyError'
|
||||
except KeyError:
|
||||
a = 8
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x22():
|
||||
try:
|
||||
a = 'try (IdxErr, KeyError) else(pass)'
|
||||
except (IndexError, KeyError):
|
||||
a = 8
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x23():
|
||||
try:
|
||||
a = 'try KeyError else(a=9)'
|
||||
except KeyError:
|
||||
a = 8
|
||||
else:
|
||||
a = 9
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x31():
|
||||
try:
|
||||
a = 'try KeyError IndexError'
|
||||
except KeyError:
|
||||
a = 8
|
||||
except IndexError:
|
||||
a = 9
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x32():
|
||||
try:
|
||||
a = 'try KeyError IndexError else(pass)'
|
||||
except KeyError:
|
||||
a = 8
|
||||
except IndexError:
|
||||
a = 9
|
||||
b = '--------'
|
||||
|
||||
|
||||
def x33():
|
||||
try:
|
||||
a = 'try KeyError IndexError else(a=9)'
|
||||
except KeyError:
|
||||
a = 8
|
||||
except IndexError:
|
||||
a = 9
|
||||
else:
|
||||
a = 9
|
||||
b = '#################'
|
||||
|
||||
|
||||
def x41():
|
||||
if a == 1:
|
||||
a = 1
|
||||
elif b == 1:
|
||||
b = 1
|
||||
else:
|
||||
c = 1
|
||||
b = '#################'
|
||||
|
||||
|
||||
def x42():
|
||||
if a == 1:
|
||||
a = 1
|
||||
elif b == 1:
|
||||
b = 1
|
||||
else:
|
||||
c = 1
|
||||
xxx = 'mmm'
|
||||
|
||||
if __name__ == '__main__':
|
||||
dis.dis(xx)
|
||||
@@ -1 +0,0 @@
|
||||
print 5
|
||||
@@ -1,37 +0,0 @@
|
||||
"""
|
||||
test_slices.py -- source test pattern for slices
|
||||
|
||||
This source is part of the decompyle test suite.
|
||||
Snippet taken from python libs's test_class.py
|
||||
|
||||
decompyle is a Python byte-code decompiler
|
||||
See http://www.goebel-consult.de/decompyle/ for download and
|
||||
for further information
|
||||
"""
|
||||
|
||||
raise "This program can't be run"
|
||||
|
||||
testme[1]
|
||||
testme[1] = 1
|
||||
del testme[1]
|
||||
testme[:42]
|
||||
testme[:42] = 'The Answer'
|
||||
del testme[:42]
|
||||
testme[2:1024:]
|
||||
testme[:1024:10]
|
||||
testme[::]
|
||||
testme[2:1024:10]
|
||||
testme[2:1024:10] = 'A lot'
|
||||
del testme[2:1024:10]
|
||||
testme[:42, ..., :24:, 24, 100]
|
||||
testme[:42, ..., :24:, 24, 100] = 'Strange'
|
||||
del testme[:42, ..., :24:, 24, 100]
|
||||
testme[:]
|
||||
testme[:] = 'Take all'
|
||||
del testme[:]
|
||||
testme[40:42]
|
||||
testme[40:42] = 'Three'
|
||||
del testme[40:42]
|
||||
testme[40, 41, 42]
|
||||
testme[40, 41, 42] = 'Another Three'
|
||||
del testme[40, 41, 42]
|
||||
@@ -1,22 +0,0 @@
|
||||
from __future__ import generators
|
||||
|
||||
def inorder(t):
|
||||
if t:
|
||||
for x in inorder(t.left):
|
||||
yield x
|
||||
yield t.label
|
||||
for x in inorder(t.right):
|
||||
yield x
|
||||
|
||||
def generate_ints(n):
|
||||
for i in range(n):
|
||||
yield i * 2
|
||||
|
||||
for i in generate_ints(5):
|
||||
print i,
|
||||
print
|
||||
gen = generate_ints(3)
|
||||
print gen.next(),
|
||||
print gen.next(),
|
||||
print gen.next(),
|
||||
print gen.next()
|
||||
Reference in New Issue
Block a user