code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
x = [0, 1, 2]
print x
x.insert(2, x.pop(0))
print x
| [
[
14,
0,
0.2,
0.2,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.6667,
... | [
"x = [0, 1, 2]",
"print(x)",
"x.insert(2, x.pop(0))",
"print(x)"
] |
x = ('OK',)
print(x[0])
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = ('OK',)",
"print(x[0])"
] |
import pkga.pkgb.modc as c_me
print c_me.stuff
print c_me.things
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
812,
0,
1,
0,
0,
812,
0,
0
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
535... | [
"import pkga.pkgb.modc as c_me",
"print(c_me.stuff)",
"print(c_me.things)"
] |
x=4
x|=1
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x=4",
"print(x)"
] |
# Test the comparison of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
# Test the comparison of sets
print '# self'
print '# forwards'
print s.isdisjoint(s)
print s > s
print s.issuperset(s)
print s >= s
print s == s
print s != s
print s.issubset(s)
print s <= s
print s < s
print '# backwards'
print s.isdisjoint(... | [
[
14,
0,
0.069,
0.0345,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.1034,
0.0345,
0,
0.66,
0.0417,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1379,
0.0345,
0,
0.6... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"print('# self')",
"print('# forwards')",
"print(s.isdisjoint(s))",
"print(s > s)",
"print(s.issuperset(s))",
"print(s >= s)",
"print(s == s)",
"print(s != s)",
"print(s.issubset(s))",
"print(s <= s)",
"print(s < s)",
"print('#... |
print("O"+"K")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"O\"+\"K\")"
] |
if None is None:
print "OK"
| [
[
4,
0,
0.75,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.44,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if None is None:\n print(\"OK\")",
" print(\"OK\")"
] |
def f():
y = 0
while y == 0:
y += 1
yield y
for i in f():
print i
| [
[
2,
0,
0.375,
0.625,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.25,
0.125,
1,
0.99,
0,
304,
1,
0,
0,
0,
0,
1,
0
],
[
5,
1,
0.5,
0.375,
1,
0.99,
1,
... | [
"def f():\n y = 0\n while y == 0:\n y += 1\n yield y",
" y = 0",
" while y == 0:\n y += 1\n yield y",
" yield y",
"for i in f():\n print(i)",
" print(i)"
] |
print False or False
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(False or False)"
] |
class C:
def __init__(self, data):
self.data = data
def pr(self):
print self.data
C("OK").pr()
| [
[
3,
0,
0.5,
0.8333,
0,
0.66,
0,
619,
0,
2,
0,
0,
0,
0,
1
],
[
2,
1,
0.4167,
0.3333,
1,
0.13,
0,
555,
0,
2,
0,
0,
0,
0,
0
],
[
14,
2,
0.5,
0.1667,
2,
0.77,
0,
... | [
"class C:\n def __init__(self, data):\n self.data = data\n def pr(self):\n print(self.data)",
" def __init__(self, data):\n self.data = data",
" self.data = data",
" def pr(self):\n print(self.data)",
" print(self.data)",
"C(\"OK\").pr()"
] |
if not "?" in "xyz": print "OK"
| [] | [] |
a = b,c = 1,2
print a[0]
print a[1]
print b
print c
| [
[
14,
0,
0.2,
0.2,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,... | [
"a = b,c = 1,2",
"print(a[0])",
"print(a[1])",
"print(b)",
"print(c)"
] |
x = 'OK',1
print x[0]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = 'OK',1",
"print(x[0])"
] |
if 0 == 1:
print "X"
else:
print "OK"
| [
[
4,
0,
0.625,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
8,
1,
0.5,
0.25,
1,
0,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.25,
1,
0,
1,
535,
3,
1,... | [
"if 0 == 1:\n print(\"X\")\nelse:\n print(\"OK\")",
" print(\"X\")",
" print(\"OK\")"
] |
class O(object): pass
class F(O): pass
class E(O): pass
class D(O): pass
class C(D,F): pass
class B(D,E): pass
class A(B,C): pass
print A.__bases__
print A.__mro__
| [
[
3,
0,
0.1,
0.1,
0,
0.66,
0,
720,
0,
0,
0,
0,
186,
0,
0
],
[
3,
0,
0.2,
0.1,
0,
0.66,
0.125,
498,
0,
0,
0,
0,
720,
0,
0
],
[
3,
0,
0.3,
0.1,
0,
0.66,
0.25,
... | [
"class O(object): pass",
"class F(O): pass",
"class E(O): pass",
"class D(O): pass",
"class C(D,F): pass",
"class B(D,E): pass",
"class A(B,C): pass",
"print(A.__bases__)",
"print(A.__mro__)"
] |
print 3*7
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(3*7)"
] |
print long
print long(3.0)
print long(3)
print type(long(3.0))
print type(long(3))
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(long)",
"print(long(3.0))",
"print(long(3))",
"print(type(long(3.0)))",
"print(type(long(3)))"
] |
print [1,2,3].index(3)
| [
[
8,
0,
1,
1,
0,
0.66,
0,
780,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print [1,2,3].index(3)"
] |
print slice(1)
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(slice(1))"
] |
def wee(waa, woo=True, wii=False):
print waa, woo, wii
wee("OK")
| [
[
2,
0,
0.5,
0.6667,
0,
0.66,
0,
48,
0,
3,
0,
0,
0,
0,
1
],
[
8,
1,
0.6667,
0.3333,
1,
0.98,
0,
535,
3,
3,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,
4... | [
"def wee(waa, woo=True, wii=False):\n print(waa, woo, wii)",
" print(waa, woo, wii)",
"wee(\"OK\")"
] |
def test(x,y):
return x+y
r = test(3,5)
print r
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
224,
0,
2,
1,
0,
0,
0,
0
],
[
13,
1,
0.5,
0.25,
1,
0.15,
0,
0,
4,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
436... | [
"def test(x,y):\n return x+y",
" return x+y",
"r = test(3,5)",
"print(r)"
] |
class X:
x = 4
x = X()
stuff = x.x
print stuff
things = X.x
print things
| [
[
3,
0,
0.1875,
0.25,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.25,
0.125,
1,
0.14,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.5,
0.125,
0,
0.66,
0.2,
... | [
"class X:\n x = 4",
" x = 4",
"x = X()",
"stuff = x.x",
"print(stuff)",
"things = X.x",
"print(things)"
] |
# Tests the list functions.
l = [1,1,2,3,5,8,13,21]
print l
print l.count(1)
print l.reverse()
print l
print l.count(1)
print l.count(0)
print l.count(3)
print l.index(5)
print l.remove(5)
print l.remove(1)
print l.count(1)
print l
| [
[
14,
0,
0.1429,
0.0714,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.2143,
0.0714,
0,
0.66,
0.0833,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.2857,
0.0714,
0,
0.6... | [
"l = [1,1,2,3,5,8,13,21]",
"print(l)",
"print(l.count(1))",
"print(l.reverse())",
"print(l)",
"print(l.count(1))",
"print(l.count(0))",
"print(l.count(3))",
"print(l.index(5))",
"print(l.remove(5))",
"print(l.remove(1))",
"print(l.count(1))",
"print(l)"
] |
def a():
x = "OK"
print x
del x
print "after"
a()
| [
[
2,
0,
0.5,
0.8333,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
0,
2
],
[
14,
1,
0.3333,
0.1667,
1,
0.62,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
1,
0.5,
0.1667,
1,
0.62,
0.5,... | [
"def a():\n x = \"OK\"\n print(x)\n del x\n print(\"after\")",
" x = \"OK\"",
" print(x)",
" print(\"after\")",
"a()"
] |
class X: pass
print repr(X())
print str(X())
| [
[
3,
0,
0.3333,
0.3333,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"class X: pass",
"print(repr(X()))",
"print(str(X()))"
] |
print [x*y for x in range(10) if x % 2 == 0 for y in range(10)]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([x*y for x in range(10) if x % 2 == 0 for y in range(10)])"
] |
a = range(17)
del a[::-3]
print a
a = range(16)
del a[::-3]
print a
a = range(17)
del a[::-2]
print a
a = range(16)
del a[::-2]
print a
| [
[
14,
0,
0.0833,
0.0833,
0,
0.66,
0,
475,
3,
1,
0,
0,
816,
10,
1
],
[
8,
0,
0.25,
0.0833,
0,
0.66,
0.2857,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.3333,
0.0833,
0,
0... | [
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)",
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)"
] |
print 0xff
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(0xff)"
] |
def yrange(n):
for i in range(n):
yield i
print list(yrange(5))
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
187,
0,
1,
0,
0,
0,
0,
1
],
[
6,
1,
0.625,
0.5,
1,
0.51,
0,
826,
3,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.75,
0.25,
2,
0.58,
0,
0,
... | [
"def yrange(n):\n for i in range(n):\n yield i",
" for i in range(n):\n yield i",
" yield i",
"print(list(yrange(5)))"
] |
# to avoid constant-izing in python compiler
def doadd(a,b):
return a+b
def dosub(a,b):
return a-b
print doadd(123, 12345678987654321)
print doadd(-123, 12345678987654321)
print doadd(-123, -12345678987654321)
print doadd(123, -12345678987654321)
print dosub(123, 12345678987654321)
print dosub(12345678987654321... | [
[
2,
0,
0.1923,
0.1538,
0,
0.66,
0,
313,
0,
2,
1,
0,
0,
0,
0
],
[
13,
1,
0.2308,
0.0769,
1,
0.13,
0,
0,
4,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.3462,
0.1538,
0,
0.66,
... | [
"def doadd(a,b):\n return a+b",
" return a+b",
"def dosub(a,b):\n return a-b",
" return a-b",
"print(doadd(123, 12345678987654321))",
"print(doadd(-123, 12345678987654321))",
"print(doadd(-123, -12345678987654321))",
"print(doadd(123, -12345678987654321))",
"print(dosub(123, 123456789876... |
# multiple instances of generator at the same time
def genmaker(a, b):
z = a*b
def gen(y):
for i in range(4):
yield i,a,b,y,z
return gen(a*a*b*b)
g1 = genmaker(3, 4)
g2 = genmaker(4, 5)
print g1.next()
print g2.next()
print g1.next()
print g2.next()
print g1.next()
print g2.next()
pr... | [
[
2,
0,
0.3095,
0.2857,
0,
0.66,
0,
808,
0,
2,
1,
0,
0,
0,
2
],
[
14,
1,
0.2381,
0.0476,
1,
0.36,
0,
859,
4,
0,
0,
0,
0,
0,
0
],
[
2,
1,
0.3333,
0.1429,
1,
0.36,
... | [
"def genmaker(a, b):\n z = a*b\n def gen(y):\n for i in range(4):\n yield i,a,b,y,z\n return gen(a*a*b*b)",
" z = a*b",
" def gen(y):\n for i in range(4):\n yield i,a,b,y,z",
" for i in range(4):\n yield i,a,b,y,z",
" yield i,a,... |
print ord(chr(128))
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(ord(chr(128)))"
] |
print str(range(-4,-8))[:5]
print len(range(-4,-8))
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(str(range(-4,-8))[:5])",
"print(len(range(-4,-8)))"
] |
class O(object): pass
class A(O): pass
class B(O): pass
class C(O): pass
class D(O): pass
class E(O): pass
class K1(A,B,C): pass
class K2(D,B,E): pass
class K3(D,A): pass
class Z(K1,K2,K3): pass
print K1.__mro__
print K2.__mro__
print K3.__mro__
print Z.__mro__
| [
[
3,
0,
0.0714,
0.0714,
0,
0.66,
0,
720,
0,
0,
0,
0,
186,
0,
0
],
[
3,
0,
0.1429,
0.0714,
0,
0.66,
0.0769,
429,
0,
0,
0,
0,
720,
0,
0
],
[
3,
0,
0.2143,
0.0714,
0,
... | [
"class O(object): pass",
"class A(O): pass",
"class B(O): pass",
"class C(O): pass",
"class D(O): pass",
"class E(O): pass",
"class K1(A,B,C): pass",
"class K2(D,B,E): pass",
"class K3(D,A): pass",
"class Z(K1,K2,K3): pass",
"print(K1.__mro__)",
"print(K2.__mro__)",
"print(K3.__mro__)",
"p... |
x = 1
n = 0
while x < 10:
x = x + 1
if n == 2:
continue
n = n + 1
print n
| [
[
14,
0,
0.125,
0.125,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.25,
0.125,
0,
0.66,
0.3333,
773,
1,
0,
0,
0,
0,
1,
0
],
[
5,
0,
0.625,
0.625,
0,
0.66,
... | [
"x = 1",
"n = 0",
"while x < 10:\n x = x + 1\n if n == 2:\n continue\n n = n + 1",
" x = x + 1",
" if n == 2:\n continue",
" n = n + 1",
"print(n)"
] |
xyzy = [100,101,102,103,104,105,106,107]
del xyzy
print xyzy
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
100,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"xyzy = [100,101,102,103,104,105,106,107]",
"print(xyzy)"
] |
class O(object): pass
class F(O): pass
class E(O): pass
class D(O): pass
class C(D,F): pass
class B(E,D): pass
class A(B,C): pass
print A.__mro__
| [
[
3,
0,
0.125,
0.125,
0,
0.66,
0,
720,
0,
0,
0,
0,
186,
0,
0
],
[
3,
0,
0.25,
0.125,
0,
0.66,
0.1429,
498,
0,
0,
0,
0,
720,
0,
0
],
[
3,
0,
0.375,
0.125,
0,
0.66,
... | [
"class O(object): pass",
"class F(O): pass",
"class E(O): pass",
"class D(O): pass",
"class C(D,F): pass",
"class B(E,D): pass",
"class A(B,C): pass",
"print(A.__mro__)"
] |
print () == (1,)
print () == ()
print (1,) == (1,)
print (1,2) == (3,4)
print (1,2) == (1,2)
print (1,2) == (1,)
print (1,2) == (1,2,3)
print (1,2,3) == (1,2)
print (1,2,3) == (1,2,3)
print
print () != (1,)
print () != ()
print (1,) != (1,)
print (1,2) != (3,4)
print (1,2) != (1,2)
print (1,2) != (1,)
print (1,2) != (1... | [
[
8,
0,
0.0169,
0.0169,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.0339,
0.0169,
0,
0.66,
0.0172,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.0508,
0.0169,
0,
0.66,
... | [
"print () == (1,)",
"print () == ()",
"print (1,) == (1,)",
"print (1,2) == (3,4)",
"print (1,2) == (1,2)",
"print (1,2) == (1,)",
"print (1,2) == (1,2,3)",
"print (1,2,3) == (1,2)",
"print (1,2,3) == (1,2,3)",
"print",
"print () != (1,)",
"print () != ()",
"print (1,) != (1,)",
"print (1,... |
print str(range(-8,-4))[:5]
print len(range(-8,-4))
print range(-8,-4)[0]
print range(-8,-4)[1]
print range(-8,-4)[-1]
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(str(range(-8,-4))[:5])",
"print(len(range(-8,-4)))",
"print(range(-8,-4)[0])",
"print(range(-8,-4)[1])",
"print(range(-8,-4)[-1])"
] |
print "a\0b".replace("\0", "c")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"a\\0b\".replace(\"\\0\", \"c\"))"
] |
def func():
return "dog"
def wee():
assert 1 != 2
assert "dog" == func()
wee()
| [
[
2,
0,
0.2143,
0.2857,
0,
0.66,
0,
856,
0,
0,
1,
0,
0,
0,
0
],
[
13,
1,
0.2857,
0.1429,
1,
0.18,
0,
0,
1,
0,
0,
0,
0,
3,
0
],
[
2,
0,
0.5714,
0.4286,
0,
0.66,
... | [
"def func():\n return \"dog\"",
" return \"dog\"",
"def wee():\n assert 1 != 2\n assert \"dog\" == func()",
"wee()"
] |
def test():
def fnc():
print "OK"
print fnc()
test()
| [
[
2,
0,
0.5,
0.8,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
3
],
[
2,
1,
0.5,
0.4,
1,
0.04,
0,
499,
0,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.6,
0.2,
2,
0.35,
0,
535,
3... | [
"def test():\n def fnc():\n print(\"OK\")\n print(fnc())",
" def fnc():\n print(\"OK\")",
" print(\"OK\")",
" print(fnc())",
"test()"
] |
# Test that re-setting the value in a dict doesn't mess with its length
d = {'foo':2}
print len(d), d
d['foo'] = 13
print len(d), d
| [
[
14,
0,
0.4,
0.2,
0,
0.66,
0,
355,
0,
0,
0,
0,
0,
6,
0
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.3333,
535,
3,
2,
0,
0,
0,
0,
2
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"d = {'foo':2}",
"print(len(d), d)",
"d['foo'] = 13",
"print(len(d), d)"
] |
print [x*y for x in range(1,10) for y in range(1,x) if y%2 == 0]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([x*y for x in range(1,10) for y in range(1,x) if y%2 == 0])"
] |
x=4
x*=3
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x=4",
"print(x)"
] |
class Stuff:
def blah(self, x, y=False):
print x,y
s = Stuff()
s.blah("x",y="OK")
| [
[
3,
0,
0.4,
0.6,
0,
0.66,
0,
710,
0,
1,
0,
0,
0,
0,
1
],
[
2,
1,
0.5,
0.4,
1,
0.17,
0,
485,
0,
3,
0,
0,
0,
0,
1
],
[
8,
2,
0.6,
0.2,
2,
0.4,
0,
535,
3,... | [
"class Stuff:\n def blah(self, x, y=False):\n print(x,y)",
" def blah(self, x, y=False):\n print(x,y)",
" print(x,y)",
"s = Stuff()",
"s.blah(\"x\",y=\"OK\")"
] |
print 3,4,5
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
3,
0,
0,
0,
0,
1
]
] | [
"print(3,4,5)"
] |
x = 'OK'
print x[0]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = 'OK'",
"print(x[0])"
] |
for i in (1 for x in range(3)):
print i
| [
[
6,
0,
0.75,
1,
0,
0.66,
0,
826,
5,
0,
0,
0,
0,
0,
2
],
[
8,
1,
1,
0.5,
1,
0.88,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"for i in (1 for x in range(3)):\n print(i)",
" print(i)"
] |
# Test the behaviour of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
# Test the addition and removal of items
print len(s), s
s.add(100)
print len(s), s
s.discard(2)
print len(s), s
| [
[
14,
0,
0.1818,
0.0909,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.2727,
0.0909,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.3636,
0.0909,
0,
0.... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(len(s), s)",
"s.add(100)",
"print(len(s), s)",
"s.discard(2)",
"print(len(s), s)"
] |
class X: pass
x = X()
print getattr(x, 'wee', 14)
print getattr(X, 'doggy', 'OK')
| [
[
3,
0,
0.25,
0.25,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
190,
3,
0,
0,
0,
783,
10,
1
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.6... | [
"class X: pass",
"x = X()",
"print(getattr(x, 'wee', 14))",
"print(getattr(X, 'doggy', 'OK'))"
] |
x = ["hello"]
y = list(x)
x[0] = "hi"
print y[0]
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
304,
3,
1,
0,
0,
430,
10,
1
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0... | [
"x = [\"hello\"]",
"y = list(x)",
"x[0] = \"hi\"",
"print(y[0])"
] |
class Stuff:
def __init__(self):
self.x = lambda: self.things()
def things(self):
print "OK"
y = Stuff()
y.x()
| [
[
3,
0,
0.4286,
0.7143,
0,
0.66,
0,
710,
0,
2,
0,
0,
0,
0,
2
],
[
2,
1,
0.3571,
0.2857,
1,
0.54,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
14,
2,
0.4286,
0.1429,
2,
0.04,
... | [
"class Stuff:\n def __init__(self):\n self.x = lambda: self.things()\n def things(self):\n print(\"OK\")",
" def __init__(self):\n self.x = lambda: self.things()",
" self.x = lambda: self.things()",
" def things(self):\n print(\"OK\")",
" print(\"OK\")",... |
x = []
x.append(x)
print({x:'OK'}[x])
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
243,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1... | [
"x = []",
"x.append(x)",
"print({x:'OK'}[x])"
] |
d = {}
d["__proto__"]="testing"
print d
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
355,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
0,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"d = {}",
"d[\"__proto__\"]=\"testing\"",
"print(d)"
] |
# Test the creation of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
print len(s)
| [
[
14,
0,
0.3333,
0.1667,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.5,
0.1667,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.6667,
0.1667,
0,
0.66,
... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"print(len(s))"
] |
x="OK";print x
| [] | [] |
print str(range(-8,-4,-1))[:5]
print len(range(-8,-4,-1))
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(str(range(-8,-4,-1))[:5])",
"print(len(range(-8,-4,-1)))"
] |
def f(*a):
print a
def g(x, *a):
print x, a
def h(x, y, *a):
print x, y, a
def i(x, y=4, *a):
print x, y, a
f()
f(1)
f(1, 2, 3)
g(1)
g(1, 2, 3)
h(1, 2)
h(1, 2, 3)
h(1, 2, 3, 4)
i(1)
i(1, 2, 3)
i(1, 2, 3, 4)
| [
[
2,
0,
0.0652,
0.087,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
0.087,
0.0435,
1,
0.71,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.1957,
0.087,
0,
0.66,
0.... | [
"def f(*a):\n print(a)",
" print(a)",
"def g(x, *a):\n print(x, a)",
" print(x, a)",
"def h(x, y, *a):\n print(x, y, a)",
" print(x, y, a)",
"def i(x, y=4, *a):\n print(x, y, a)",
" print(x, y, a)",
"f()",
"f(1)",
"f(1, 2, 3)",
"g(1)",
"g(1, 2, 3)",
"h(1, 2)",
"h(... |
print (2 < 3 < 9)
print (2 < (3 < 9))
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print (2 < 3 < 9)",
"print (2 < (3 < 9))"
] |
def f():
yield 1
yield 2
g = f()
print g.next()
print g.next()
for i in f():
print i
| [
[
2,
0,
0.25,
0.375,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.25,
0.125,
1,
0.29,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.375,
0.125,
1,
0.29,
1,
0,... | [
"def f():\n yield 1\n yield 2",
" yield 1",
" yield 2",
"g = f()",
"print(g.next())",
"print(g.next())",
"for i in f():\n print(i)",
" print(i)"
] |
print "234".replace("\r\n", "\n")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"234\".replace(\"\\r\\n\", \"\\n\"))"
] |
class A: pass
a = A()
print isinstance([], list)
print isinstance([], dict)
print isinstance([], str)
print isinstance([], tuple)
print isinstance([], A)
print "---"
print isinstance({}, list)
print isinstance({}, dict)
print isinstance({}, str)
print isinstance({}, tuple)
print isinstance({}, A)
print "---"
print i... | [
[
3,
0,
0.027,
0.027,
0,
0.66,
0,
429,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0541,
0.027,
0,
0.66,
0.0323,
475,
3,
0,
0,
0,
429,
10,
1
],
[
8,
0,
0.1081,
0.027,
0,
0.66... | [
"class A: pass",
"a = A()",
"print(isinstance([], list))",
"print(isinstance([], dict))",
"print(isinstance([], str))",
"print(isinstance([], tuple))",
"print(isinstance([], A))",
"print(\"---\")",
"print(isinstance({}, list))",
"print(isinstance({}, dict))",
"print(isinstance({}, str))",
"pri... |
def f():
print "in f"
return 10
def g():
print "in g"
return 20
retval = True
def h():
global retval
retval = not retval
return retval
for i in range(3):
print f() if h() else g()
| [
[
2,
0,
0.1176,
0.1765,
0,
0.66,
0,
899,
0,
0,
1,
0,
0,
0,
1
],
[
8,
1,
0.1176,
0.0588,
1,
0.03,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
13,
1,
0.1765,
0.0588,
1,
0.03,
... | [
"def f():\n print(\"in f\")\n return 10",
" print(\"in f\")",
" return 10",
"def g():\n print(\"in g\")\n return 20",
" print(\"in g\")",
" return 20",
"retval = True",
"def h():\n global retval\n retval = not retval\n return retval",
" retval = not retval",
" ... |
import pkga.pkgb.modc
import pkga.pkgb.modc # only one print
print "a name", pkga.__name__
print "a.b name", pkga.pkgb.__name__
print "a.b.c name", pkga.pkgb.modc.__name__
print "stuff", pkga.pkgb.modc.stuff
print "things", pkga.pkgb.modc.things
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
812,
0,
1,
0,
0,
812,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.1667,
812,
0,
1,
0,
0,
812,
0,
0
],
[
8,
0,
0.5,
0.125,
0,
0.66,
... | [
"import pkga.pkgb.modc",
"import pkga.pkgb.modc # only one print",
"print(\"a name\", pkga.__name__)",
"print(\"a.b name\", pkga.pkgb.__name__)",
"print(\"a.b.c name\", pkga.pkgb.modc.__name__)",
"print(\"stuff\", pkga.pkgb.modc.stuff)",
"print(\"things\", pkga.pkgb.modc.things)"
] |
x = [v*v for v in range(0,5)]
print x[3]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
5,
0,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = [v*v for v in range(0,5)]",
"print(x[3])"
] |
print 5&7
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(5&7)"
] |
from pkga.pkgb.modc import stuff as mystuff
from pkga.pkgb.modc import things as mythings
print mystuff, mythings
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
812,
0,
1,
0,
0,
812,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.5,
812,
0,
1,
0,
0,
812,
0,
0
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
53... | [
"from pkga.pkgb.modc import stuff as mystuff",
"from pkga.pkgb.modc import things as mythings",
"print(mystuff, mythings)"
] |
print [1,2,"OK",4][-3:3][1]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
6,
0,
0,
0,
0,
0,
0
]
] | [
"print [1,2,\"OK\",4][-3:3][1]"
] |
class A: pass
class B: pass
class C: pass
class D(A): pass
class E(A,B): pass
class F(E,C): pass
a,b,c,d,e,f = A(),B(),C(),D(),E(),F()
print isinstance(a, A)
print isinstance(a, B)
print isinstance(a, C)
print isinstance(a, D)
print isinstance(a, E)
print isinstance(a, F)
print "---"
print isinstance(b, A)
print isin... | [
[
3,
0,
0.0196,
0.0196,
0,
0.66,
0,
429,
0,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.0392,
0.0196,
0,
0.66,
0.0208,
197,
0,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.0588,
0.0196,
0,
0.66... | [
"class A: pass",
"class B: pass",
"class C: pass",
"class D(A): pass",
"class E(A,B): pass",
"class F(E,C): pass",
"a,b,c,d,e,f = A(),B(),C(),D(),E(),F()",
"print(isinstance(a, A))",
"print(isinstance(a, B))",
"print(isinstance(a, C))",
"print(isinstance(a, D))",
"print(isinstance(a, E))",
"... |
print 2*3**2
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2*3**2)"
] |
s = set([2,3,4])
t = set([3,4,5])
u = set([1,3,5])
a = s.intersection(t)
b = u.intersection(s)
c = u.intersection(t)
print a
print b
print c
print a == set([3, 4])
print b == set([3])
print c == set([3, 5])
d = s.intersection(t, u)
print d
print d == set([3])
| [
[
14,
0,
0.05,
0.05,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1,
0.05,
0,
0.66,
0.0714,
15,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.15,
0.05,
0,
0.66,
0... | [
"s = set([2,3,4])",
"t = set([3,4,5])",
"u = set([1,3,5])",
"a = s.intersection(t)",
"b = u.intersection(s)",
"c = u.intersection(t)",
"print(a)",
"print(b)",
"print(c)",
"print(a == set([3, 4]))",
"print(b == set([3]))",
"print(c == set([3, 5]))",
"d = s.intersection(t, u)",
"print(d)",
... |
print 2 in {1:2}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2 in {1:2})"
] |
# Test that a clone of a list really is distinct
l = [1,2,3]
print l
m = list(l)
print m
m.pop()
print l
print m
| [
[
14,
0,
0.25,
0.125,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0.1667,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.5,
0.125,
0,
0.66,
0... | [
"l = [1,2,3]",
"print(l)",
"m = list(l)",
"print(m)",
"m.pop()",
"print(l)",
"print(m)"
] |
if "a" is "a":
print "OK"
| [
[
4,
0,
0.75,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.71,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if \"a\" is \"a\":\n print(\"OK\")",
" print(\"OK\")"
] |
print type(4)
print type(444444444444444444444)
print type(4.5)
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"print(type(4))",
"print(type(444444444444444444444))",
"print(type(4.5))"
] |
x = {}
x['y'] = "test"
print x['y']
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
0,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"x = {}",
"x['y'] = \"test\"",
"print(x['y'])"
] |
print len("\\0")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(len(\"\\\\0\"))"
] |
class Wee:
def __init__(self):
self.called = False
def __iter__(self):
return self
def next(self):
print "in next"
if not self.called:
self.called = True
return "dog"
raise StopIteration
for i in Wee():
print i
| [
[
3,
0,
0.4286,
0.7857,
0,
0.66,
0,
410,
0,
3,
0,
0,
0,
0,
1
],
[
2,
1,
0.1786,
0.1429,
1,
0.35,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.2143,
0.0714,
2,
0.58,
... | [
"class Wee:\n def __init__(self):\n self.called = False\n def __iter__(self):\n return self\n def next(self):\n print(\"in next\")\n if not self.called:",
" def __init__(self):\n self.called = False",
" self.called = False",
" def __iter__(self):\n ... |
def f(iter):
for v in iter:
print v
f(x*y for x in range(10) for y in range(x))
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
1
],
[
6,
1,
0.625,
0.5,
1,
0.9,
0,
553,
2,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.75,
0.25,
2,
0.38,
0,
535,
... | [
"def f(iter):\n for v in iter:\n print(v)",
" for v in iter:\n print(v)",
" print(v)",
"f(x*y for x in range(10) for y in range(x))"
] |
print "hello world"
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"hello world\")"
] |
import sys
sys.x = 4
sys.y = ["stuff"]
sys.z = {'things': sys.x}
print sys.x, sys.y, sys.z
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.4,
0.2,
0,
0.66,
0.25,
671,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.6,
0.2,
0,
0.66,
0.5,
3... | [
"import sys",
"sys.x = 4",
"sys.y = [\"stuff\"]",
"sys.z = {'things': sys.x}",
"print(sys.x, sys.y, sys.z)"
] |
print("X-OK-Y".split("-")[1])
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"X-OK-Y\".split(\"-\")[1])"
] |
n = 0
for x in range(0,10,2):
n += 1
print n
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
773,
1,
0,
0,
0,
0,
1,
0
],
[
6,
0,
0.625,
0.5,
0,
0.66,
0.5,
190,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
535,... | [
"n = 0",
"for x in range(0,10,2):\n n += 1",
"print(n)"
] |
print len({'a':1, 'b':2})
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(len({'a':1, 'b':2}))"
] |
def f(a,b,c=10,d=20,*e,**f):
sortf = [(x,y) for x,y in f.items()]
sortf.sort()
print a,b,c,d,e,sortf
f(1,2)
f(1,2,3)
f(1,2,3,5)
f(1,2,d=3,c=5)
f(1,2,e=['x','y','z'])
f(1,2,d=3,c=5,e=['x','y','z'])
f(1,2,3,5,['x','y','z'])
f(1,2,3,5,['x','y','z'],z=5,y=9)
f(1,2,3,5,['x','y','z'],'blorp','wee',z=5,y=9)
| [
[
2,
0,
0.1786,
0.2857,
0,
0.66,
0,
899,
0,
6,
0,
0,
0,
0,
3
],
[
14,
1,
0.1429,
0.0714,
1,
0.66,
0,
623,
5,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.2143,
0.0714,
1,
0.66,
... | [
"def f(a,b,c=10,d=20,*e,**f):\n sortf = [(x,y) for x,y in f.items()]\n sortf.sort()\n print(a,b,c,d,e,sortf)",
" sortf = [(x,y) for x,y in f.items()]",
" sortf.sort()",
" print(a,b,c,d,e,sortf)",
"f(1,2)",
"f(1,2,3)",
"f(1,2,3,5)",
"f(1,2,d=3,c=5)",
"f(1,2,e=['x','y','z'])",
"f(1... |
def f(n):
yield 1
a, b = n, n + 1
yield 2
yield a
yield b
a = 9999
b = 9999
for i in f(20):
print i
| [
[
2,
0,
0.35,
0.6,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
0
],
[
8,
1,
0.2,
0.1,
1,
0.52,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.3,
0.1,
1,
0.52,
0.25,
127,
... | [
"def f(n):\n yield 1\n a, b = n, n + 1\n yield 2\n yield a\n yield b",
" yield 1",
" a, b = n, n + 1",
" yield 2",
" yield a",
" yield b",
"a = 9999",
"b = 9999",
"for i in f(20):\n print(i)",
" print(i)"
] |
print 1|2|3|4|5|6|0x80
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(1|2|3|4|5|6|0x80)"
] |
a,b,d = [0],2,"OK"
print d
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
51,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a,b,d = [0],2,\"OK\"",
"print(d)"
] |
if "a" is not "b":
print "OK"
| [
[
4,
0,
0.75,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.18,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if \"a\" is not \"b\":\n print(\"OK\")",
" print(\"OK\")"
] |
a = [100,101,102,103,104,105,106,107]
del a[0]
print a
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = [100,101,102,103,104,105,106,107]",
"print(a)"
] |
x = 444
def f(arg):
return "OK: " + arg + ", " + str(x)
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
2,
0,
0.8333,
0.6667,
0,
0.66,
1,
899,
0,
1,
1,
0,
0,
0,
1
],
[
13,
1,
1,
0.3333,
1,
0.13,
0,... | [
"x = 444",
"def f(arg):\n return \"OK: \" + arg + \", \" + str(x)",
" return \"OK: \" + arg + \", \" + str(x)"
] |
class X: pass
x = X()
methodName = "wee"
try:
stuff = getattr(x, methodName)
except AttributeError:
raise ValueError, "no such method in %s: %s" % (x.__class__, methodName)
| [
[
3,
0,
1,
1,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
]
] | [
"class X: pass"
] |
# Test the behaviour of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
# Test the addition and removal of items of a clone set
t = set(s)
print len(t), t
print len(s), s
t.add(100)
print len(t), t
print len(s), s
t.discard(2)
print len(t), t
print len(s), s
| [
[
14,
0,
0.125,
0.0625,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.1875,
0.0625,
0,
0.66,
0.0833,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.25,
0.0625,
0,
0.66,... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"t = set(s)",
"print(len(t), t)",
"print(len(s), s)",
"t.add(100)",
"print(len(t), t)",
"print(len(s), s)",
"t.discard(2)",
"print(len(t), t)",
"print(len(s), s)"
] |
def test(y='K',x='Z'): print(x+y)
test('O')
| [
[
2,
0,
0.5,
0.5,
0,
0.66,
0,
224,
0,
2,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.5,
1,
0.23,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
224,
3,
... | [
"def test(y='K',x='Z'): print(x+y)",
"def test(y='K',x='Z'): print(x+y)",
"test('O')"
] |
wee = lambda waa, woo=False, wii=True: ("OK", waa, woo, wii)
print wee("stuff")
print wee("stuff", "dog")
print wee("stuff", "dog", "cat")
print wee("stuff", wii="lamma")
print wee(wii="lamma", waa="pocky")
print wee(wii="lamma", waa="pocky", woo="blorp")
| [
[
14,
0,
0.125,
0.125,
0,
0.66,
0,
48,
9,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0.1667,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.5,
0.125,
0,
0.66,
0.... | [
"wee = lambda waa, woo=False, wii=True: (\"OK\", waa, woo, wii)",
"print(wee(\"stuff\"))",
"print(wee(\"stuff\", \"dog\"))",
"print(wee(\"stuff\", \"dog\", \"cat\"))",
"print(wee(\"stuff\", wii=\"lamma\"))",
"print(wee(wii=\"lamma\", waa=\"pocky\"))",
"print(wee(wii=\"lamma\", waa=\"pocky\", woo=\"blorp... |
def foo(x):
yield len(x)
yield len(x)
g = foo(range(5))
print g.next()
len = lambda y: 8
print g.next()
| [
[
2,
0,
0.25,
0.375,
0,
0.66,
0,
528,
0,
1,
0,
0,
0,
0,
2
],
[
8,
1,
0.25,
0.125,
1,
0.07,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.375,
0.125,
1,
0.07,
1,
0,... | [
"def foo(x):\n yield len(x)\n yield len(x)",
" yield len(x)",
" yield len(x)",
"g = foo(range(5))",
"print(g.next())",
"len = lambda y: 8",
"print(g.next())"
] |
class Stuff:
def __init__(self):
self.a = 0
self.b = 'b'
self.c = [1,2,3]
self.d = 100000000000000
def doit(self):
self.a += 10
self.b += 'dog'
self.c += [9,10]
self.d += 10000
s = Stuff()
s.doit()
print s.a
print s.b
print s.c
print s.d
| [
[
3,
0,
0.3158,
0.5789,
0,
0.66,
0,
710,
0,
2,
0,
0,
0,
0,
0
],
[
2,
1,
0.2105,
0.2632,
1,
0.01,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.1579,
0.0526,
2,
0.35,
... | [
"class Stuff:\n def __init__(self):\n self.a = 0\n self.b = 'b'\n self.c = [1,2,3]\n self.d = 100000000000000\n def doit(self):\n self.a += 10",
" def __init__(self):\n self.a = 0\n self.b = 'b'\n self.c = [1,2,3]\n self.d = 100000000000000",... |
def test():
print "OK"
x = [1,test,2]
x[1]()
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.25,
1,
0.43,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
19... | [
"def test():\n print(\"OK\")",
" print(\"OK\")",
"x = [1,test,2]",
"x[1]()"
] |
print 234
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(234)"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.