code
stringlengths
1
1.49M
vector
listlengths
0
7.38k
snippet
listlengths
0
7.38k
s = set([2,3,4]) t = set([3,4,5]) u = set([1,3,5]) print s s.difference_update(t) u.difference_update(t) print s print u print s == set([2]) print u == set([1]) s = set([2,3,4]) t = set([3,4,5]) t.difference_update(s, u) print t print t == set([5])
[ [ 14, 0, 0.0455, 0.0455, 0, 0.66, 0, 553, 3, 1, 0, 0, 21, 10, 1 ], [ 14, 0, 0.0909, 0.0455, 0, 0.66, 0.0714, 15, 3, 1, 0, 0, 21, 10, 1 ], [ 14, 0, 0.1364, 0.0455, 0, ...
[ "s = set([2,3,4])", "t = set([3,4,5])", "u = set([1,3,5])", "print(s)", "s.difference_update(t)", "u.difference_update(t)", "print(s)", "print(u)", "print(s == set([2]))", "print(u == set([1]))", "s = set([2,3,4])", "t = set([3,4,5])", "t.difference_update(s, u)", "print(t)", "print(t ==...
y = "\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the 'lazy' dog.\n\ " print y
[ [ 14, 0, 0.5, 0.8571, 0, 0.66, 0, 304, 1, 0, 0, 0, 0, 3, 0 ], [ 8, 0, 1, 0.1429, 0, 0.66, 1, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "y = \"\\n\\\nThe \\\"quick\\\"\\n\\\nbrown fox\\n\\\njumps over\\n\\\nthe 'lazy' dog.\\n\\\n\"", "print(y)" ]
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...
c = "squirrel" time = 0 def x(): global time time += 1 if time == 1: b = "dog" else: b = "banana" print b, c def y(d): a = "cat" print a,b,d def z(): for i in range(10*time): yield i,a,b,c,d return z return y("blorp"...
[ [ 14, 0, 0.0455, 0.0455, 0, 0.66, 0, 411, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.0909, 0.0455, 0, 0.66, 0.25, 654, 1, 0, 0, 0, 0, 1, 0 ], [ 2, 0, 0.4773, 0.7273, 0, 0.66...
[ "c = \"squirrel\"", "time = 0", "def x():\n global time\n time += 1\n if time == 1:\n b = \"dog\"\n else:\n b = \"banana\"\n print(b, c)", " if time == 1:\n b = \"dog\"\n else:\n b = \"banana\"", " b = \"dog\"", " b = \"banana\"", " print...
# 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)" ]
print "-----" print [] and 5 print {} and 5 print False and 5 print True and 5 print "-----" print [] or 5 print {} or 5 print False or 5 print True or 5 print "-----" print 5 and [] print 5 and {} print 5 and False print 5 and True print "-----" print 5 or [] print 5 or {} print 5 or False print 5 or True print "-----...
[ [ 8, 0, 0.04, 0.04, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.08, 0.04, 0, 0.66, 0.0417, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.12, 0.04, 0, 0.66, 0.0833...
[ "print(\"-----\")", "print([] and 5)", "print({} and 5)", "print(False and 5)", "print(True and 5)", "print(\"-----\")", "print([] or 5)", "print({} or 5)", "print(False or 5)", "print(True or 5)", "print(\"-----\")", "print(5 and [])", "print(5 and {})", "print(5 and False)", "print(5 a...
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.26, 0, 555, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 2, 0.2143, 0.0714, 2, 0.81, ...
[ "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 ...
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)" ]
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.06, 0, 555, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 2, 0.1579, 0.0526, 2, 0.63, ...
[ "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",...
class X: def __init__(self): print "wee" x = X() print repr(x)
[ [ 3, 0, 0.4, 0.6, 0, 0.66, 0, 783, 0, 1, 0, 0, 0, 0, 1 ], [ 2, 1, 0.5, 0.4, 1, 0.6, 0, 555, 0, 1, 0, 0, 0, 0, 1 ], [ 8, 2, 0.6, 0.2, 2, 0.26, 0, 535, 3,...
[ "class X:\n def __init__(self):\n print(\"wee\")", " def __init__(self):\n print(\"wee\")", " print(\"wee\")", "x = X()", "print(repr(x))" ]
print slice(1,2)
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(slice(1,2))" ]
x="OK" print x
[ [ 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)" ]
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.47, 0, 623, 5, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.2143, 0.0714, 1, 0.47, ...
[ "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...
print("O"+"K")
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(\"O\"+\"K\")" ]
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.25, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 1, 1, 0.25, 1, 0.25, 1, 535, 3, ...
[ "if 0 == 1:\n print(\"X\")\nelse:\n print(\"OK\")", " print(\"X\")", " print(\"OK\")" ]
big = 123456789012345678901234567890L print "'%d'" % big print "'%d'" % -big print "'%5d'" % -big print "'%31d'" % -big print "'%32d'" % -big print "'%-32d'" % -big print "'%032d'" % -big print "'%-032d'" % -big print "'%034d'" % -big print "'%034d'" % big print "'%0+34d'" % big print "'%+34d'" % big print "'%34d'" % b...
[ [ 8, 0, 0.0588, 0.0588, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.1176, 0.0588, 0, 0.66, 0.0625, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.1765, 0.0588, 0, 0.66...
[ "print(\"'%d'\" % big)", "print(\"'%d'\" % -big)", "print(\"'%5d'\" % -big)", "print(\"'%31d'\" % -big)", "print(\"'%32d'\" % -big)", "print(\"'%-32d'\" % -big)", "print(\"'%032d'\" % -big)", "print(\"'%-032d'\" % -big)", "print(\"'%034d'\" % -big)", "print(\"'%034d'\" % big)", "print(\"'%0+34d'...
class X: def __init__(self): self.px = 3 def y(self): l = "xyz" if len(l) == self.px: print "OK" x = X() x.y()
[ [ 3, 0, 0.4444, 0.7778, 0, 0.66, 0, 783, 0, 2, 0, 0, 0, 0, 2 ], [ 2, 1, 0.2778, 0.2222, 1, 0.96, 0, 555, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 2, 0.3333, 0.1111, 2, 0.22, ...
[ "class X:\n def __init__(self):\n self.px = 3\n def y(self):\n l = \"xyz\"\n if len(l) == self.px:\n print(\"OK\")", " def __init__(self):\n self.px = 3", " self.px = 3", " def y(self):\n l = \"xyz\"\n if len(l) == self.px:\n p...
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)))" ]
x = "abcdefghjijk" print x[:0] print x[0:]
[ [ 14, 0, 0.3333, 0.3333, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 3, 0 ], [ 8, 0, 0.6667, 0.3333, 0, 0.66, 0.5, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 1, 0.3333, 0, 0.66, 1...
[ "x = \"abcdefghjijk\"", "print(x[:0])", "print(x[0:])" ]
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.23, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "if None is None:\n print(\"OK\")", " print(\"OK\")" ]
# 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.62, 0, 859, 4, 0, 0, 0, 0, 0, 0 ], [ 2, 1, 0.3333, 0.1429, 1, 0.62, ...
[ "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,...
# free and cell vars in y c = "squirrel" def x(): b = "dog" print b, c def y(): a = "cat" print a,b def z(): return a,b,c return z return y() print x()()
[ [ 14, 0, 0.2143, 0.0714, 0, 0.66, 0, 411, 1, 0, 0, 0, 0, 3, 0 ], [ 2, 0, 0.6071, 0.7143, 0, 0.66, 0.5, 190, 0, 0, 1, 0, 0, 0, 3 ], [ 14, 1, 0.3571, 0.0714, 1, 0.55,...
[ "c = \"squirrel\"", "def x():\n b = \"dog\"\n print(b, c)\n def y():\n a = \"cat\"\n print(a,b)\n def z():\n return a,b,c", " b = \"dog\"", " print(b, c)", " def y():\n a = \"cat\"\n print(a,b)\n def z():\n return a,b,c\n ...
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))", "...
def f(a, b, c): print a, b, c args = [5, 6, 7] f(*args)
[ [ 2, 0, 0.3, 0.4, 0, 0.66, 0, 899, 0, 3, 0, 0, 0, 0, 1 ], [ 8, 1, 0.4, 0.2, 1, 0.5, 0, 535, 3, 3, 0, 0, 0, 0, 1 ], [ 14, 0, 0.8, 0.2, 0, 0.66, 0.5, 805, ...
[ "def f(a, b, c):\n print(a, b, c)", " print(a, b, c)", "args = [5, 6, 7]", "f(*args)" ]
print "..bbb..".replace("..", "X")
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(\"..bbb..\".replace(\"..\", \"X\"))" ]
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 f(): for i in 1,2,3,4,5: if i % 2 == 0: continue yield i print list(f())
[ [ 2, 0, 0.4167, 0.6667, 0, 0.66, 0, 899, 0, 0, 0, 0, 0, 0, 0 ], [ 6, 1, 0.5, 0.5, 1, 0.4, 0, 826, 0, 0, 0, 0, 0, 0, 0 ], [ 4, 2, 0.5, 0.1667, 2, 0.89, 0, 0,...
[ "def f():\n for i in 1,2,3,4,5:\n if i % 2 == 0: continue\n yield i", " for i in 1,2,3,4,5:\n if i % 2 == 0: continue\n yield i", " if i % 2 == 0: continue", " yield i", "print(list(f()))" ]
# empty set creation print set()
[ [ 8, 0, 1, 0.5, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(set())" ]
print int print float print int(3.0) print float(3)
[ [ 8, 0, 0.25, 0.25, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.5, 0.25, 0, 0.66, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.75, 0.25, 0, 0.66, 0.6667,...
[ "print(int)", "print(float)", "print(int(3.0))", "print(float(3))" ]
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))" ]
big = 0x1234567890abcdef12345L # 21 hex digits print "'%x'" % big print "'%x'" % -big print "'%5x'" % -big print "'%22x'" % -big print "'%23x'" % -big print "'%-23x'" % -big print "'%023x'" % -big print "'%-023x'" % -big print "'%025x'" % -big print "'%025x'" % big print "'%0+25x'" % big print "'%+25x'" % big print "'...
[ [ 8, 0, 0.0286, 0.0286, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.0571, 0.0286, 0, 0.66, 0.0323, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.0857, 0.0286, 0, 0.66...
[ "print(\"'%x'\" % big)", "print(\"'%x'\" % -big)", "print(\"'%5x'\" % -big)", "print(\"'%22x'\" % -big)", "print(\"'%23x'\" % -big)", "print(\"'%-23x'\" % -big)", "print(\"'%023x'\" % -big)", "print(\"'%-023x'\" % -big)", "print(\"'%025x'\" % -big)", "print(\"'%025x'\" % big)", "print(\"'%0+25x'...
print 234
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(234)" ]
def foo(value = None): for i in [-1,0,1,2,3,4]: if i < 0: continue elif i == 0: yield 0 elif i == 1: yield 1 yield value yield 2 else: yield i print list(foo())
[ [ 2, 0, 0.5, 0.9231, 0, 0.66, 0, 528, 0, 1, 0, 0, 0, 0, 0 ], [ 6, 1, 0.5385, 0.8462, 1, 0.92, 0, 826, 0, 0, 0, 0, 0, 0, 0 ], [ 4, 2, 0.5769, 0.7692, 2, 0.3, 0, ...
[ "def foo(value = None):\n for i in [-1,0,1,2,3,4]:\n if i < 0:\n continue\n elif i == 0:\n yield 0\n elif i == 1:\n yield 1", " for i in [-1,0,1,2,3,4]:\n if i < 0:\n continue\n elif i == 0:\n yield 0\n elif i =...
print({1:"OK"}[1])
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print({1:\"OK\"}[1])" ]
print 2*3**2
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(2*3**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)" ]
print "1234"[-3:3]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(\"1234\"[-3:3])" ]
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__)" ]
s='abcd' print s[::2]
[ [ 14, 0, 0.5, 0.5, 0, 0.66, 0, 553, 1, 0, 0, 0, 0, 3, 0 ], [ 8, 0, 1, 0.5, 0, 0.66, 1, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "s='abcd'", "print(s[::2])" ]
import sys def main(): cout = sys.stdout.write size = 4000 xr_size = range(size) xr_iter = range(50) bit = 128 byte_acc = 0 cout("P4\n%d %d\n" % (size, size)) size = float(size) for y in xr_size: fy = 2j * y / size - 1j for x in xr_size: z = 0j ...
[ [ 1, 0, 0.0256, 0.0256, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 2, 0, 0.5128, 0.8974, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 9 ], [ 14, 1, 0.1026, 0.0256, 1, 0.67...
[ "import sys", "def main():\n cout = sys.stdout.write\n size = 4000\n xr_size = range(size)\n xr_iter = range(50)\n bit = 128\n byte_acc = 0", " cout = sys.stdout.write", " size = 4000", " xr_size = range(size)", " xr_iter = range(50)", " bit = 128", " byte_acc = 0",...
def make_tree(item, depth): if not depth: return item, None, None item2 = item + item depth -= 1 return item, make_tree(item2 - 1, depth), make_tree(item2, depth) def check_tree(node): item, left, right = node if not left: return item return item + check_tree(left) - check_tree(right) def ...
[ [ 2, 0, 0.0938, 0.1562, 0, 0.66, 0, 92, 0, 2, 1, 0, 0, 0, 2 ], [ 4, 1, 0.0625, 0.0312, 1, 0.33, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 13, 2, 0.0625, 0.0312, 2, 0.09, 0...
[ "def make_tree(item, depth):\n if not depth: return item, None, None\n item2 = item + item\n depth -= 1\n return item, make_tree(item2 - 1, depth), make_tree(item2, depth)", " if not depth: return item, None, None", " if not depth: return item, None, None", " item2 = item + item", " ...
2134568 != 01231515
[]
[]
wee = """this is some stuff and
[]
[]
if 1 < 1 > 1 == 1 >= 5 <= 0x15 <= 0x12 != 1 and 5 in 1 not in 1 is 1 or 5 is not 1: pass
[ [ 4, 0, 1, 1, 0, 0.66, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
[ "if 1 < 1 > 1 == 1 >= 5 <= 0x15 <= 0x12 != 1 and 5 in 1 not in 1 is 1 or 5 is not 1: pass" ]
x = ur'abc' + Ur'ABC' + uR'ABC' + UR'ABC'
[]
[]
x = 0xfffffffffff
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 1, 0 ] ]
[ "x = 0xfffffffffff" ]
x = 123141242151251616110l
[]
[]
x = 3e14159
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 2, 0 ] ]
[ "x = 3e14159" ]
x = "doesn't "shrink", does it"
[]
[]
x = 314159.
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 2, 0 ] ]
[ "x = 314159." ]
def f(): if True: if False: x =3 y = 4 return return 19
[ [ 2, 0, 0.5714, 1, 0, 0.66, 0, 899, 0, 0, 1, 0, 0, 0, 0 ], [ 4, 1, 0.6429, 0.8571, 1, 0.04, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 4, 2, 0.5714, 0.4286, 2, 0.7, 0, ...
[ "def f():\n if True:\n if False:\n x =3\n y = 4\n return\n return 19", " if True:\n if False:\n x =3\n y = 4\n return\n return 19", " if False:\n x =3\n y = 4", " x =3", " ...
x = ''; y = ""
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 1, 1, 0, 0.66, 1, 304, 1, 0, 0, 0, 0, 3, 0 ] ]
[ "x = ''; y = \"\"", "x = ''; y = \"\"" ]
a = r'''this is some more stuff
[]
[]
x = '"'; y = "'"
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 1, 1, 0, 0.66, 1, 304, 1, 0, 0, 0, 0, 3, 0 ] ]
[ "x = '\"'; y = \"'\"", "x = '\"'; y = \"'\"" ]
0xdeadbeef != -1
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
[ "0xdeadbeef != -1" ]
x = 1 - y + 15 - 01 + 0x124 + z + a[5]
[]
[]
import sys, time x = sys.modules['time'].time()
[ [ 1, 0, 0.5, 0.5, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 14, 0, 1, 0.5, 0, 0.66, 1, 190, 3, 0, 0, 0, 654, 10, 1 ] ]
[ "import sys, time", "x = sys.modules['time'].time()" ]
-1*1/1+1*1//1 - ---1**1
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "-1*1/1+1*1//1 - ---1**1" ]
0o123 <= 0123
[]
[]
def d22(a, b, c=2, d=2, *k): pass
[ [ 2, 0, 1, 1, 0, 0.66, 0, 755, 0, 5, 0, 0, 0, 0, 0 ] ]
[ "def d22(a, b, c=2, d=2, *k): pass" ]
x = u'abc' + U'ABC'
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "x = u'abc' + U'ABC'" ]
1 + 1
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "1 + 1" ]
x = 3E123
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 2, 0 ] ]
[ "x = 3E123" ]
x = 1//1*1/5*12%0x12
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "x = 1//1*1/5*12%0x12" ]
01234567 > ~0x15
[]
[]
@staticmethod def foo(x,y): pass
[ [ 2, 0, 1, 0.5, 0, 0.66, 0, 528, 0, 2, 0, 0, 0, 0, 0 ] ]
[ "def foo(x,y): pass" ]
x = .314159
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 2, 0 ] ]
[ "x = .314159" ]
0xdeadc0de & 012345
[]
[]
x+y = 3e-1230
[]
[]
x = 3.14159
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 2, 0 ] ]
[ "x = 3.14159" ]
def d01v_(a=1, *k, **w): pass
[ [ 2, 0, 1, 1, 0, 0.66, 0, 498, 0, 3, 0, 0, 0, 0, 0 ] ]
[ "def d01v_(a=1, *k, **w): pass" ]
def k(x): x += 2 x += 5
[ [ 2, 0, 0.75, 1, 0, 0.66, 0, 954, 0, 1, 0, 0, 0, 0, 0 ] ]
[ "def k(x):\n x += 2" ]
0xFF & 0x15 | 1234
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "0xFF & 0x15 | 1234" ]
0xff <= 255
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
[ "0xff <= 255" ]
y = ur"abc" + Ur"ABC" + uR"ABC" + UR"ABC"
[]
[]
(-124561-1) & 0200000000
[]
[]
x = 1 << 1 >> 5
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "x = 1 << 1 >> 5" ]
x = 0L
[]
[]
x = -15921590215012591L
[]
[]
x = 3.14e159
[ [ 14, 0, 1, 1, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 2, 0 ] ]
[ "x = 3.14e159" ]
0b01 <= 255
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]
[ "0b01 <= 255" ]
~1 ^ 1 & 1 |1 ^ -1
[ [ 8, 0, 1, 1, 0, 0.66, 0, 0, 4, 0, 0, 0, 0, 0, 0 ] ]
[ "~1 ^ 1 & 1 |1 ^ -1" ]
import ast import sys def astppdump(node): def _format(node, indent): #print node, len(indent) if isinstance(node, ast.AST): namelen = " "*(len(node.__class__.__name__)) + " " fields = [] for a,b in ast.iter_fields(node): fieldlen = len(a)*" " ...
[ [ 1, 0, 0.037, 0.037, 0, 0.66, 0, 809, 0, 1, 0, 0, 809, 0, 0 ], [ 1, 0, 0.0741, 0.037, 0, 0.66, 0.3333, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 2, 0, 0.5, 0.7407, 0, 0.66, ...
[ "import ast", "import sys", "def astppdump(node):\n def _format(node, indent):\n #print node, len(indent)\n if isinstance(node, ast.AST):\n namelen = \" \"*(len(node.__class__.__name__)) + \" \"\n fields = []\n for a,b in ast.iter_fields(node):\n ...
class X: pass
[ [ 3, 0, 0.3333, 0.3333, 0, 0.66, 0, 783, 0, 0, 0, 0, 0, 0, 0 ] ]
[ "class X: pass" ]
print 4
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(4)" ]
def foobar(): print 'yes' foobar()
[ [ 2, 0, 0.375, 0.5, 0, 0.66, 0, 139, 0, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.5, 0.25, 1, 0.28, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 1, 0.25, 0, 0.66, 1, 139, ...
[ "def foobar():\n print('yes')", " print('yes')", "foobar()" ]
for i in range(10): print i
[ [ 6, 0, 0.5, 0.6667, 0, 0.66, 0, 826, 3, 0, 0, 0, 0, 0, 2 ], [ 8, 1, 0.6667, 0.3333, 1, 0.87, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "for i in range(10):\n print(i)", " print(i)" ]
import goog.math as gm c1 = gm.Coordinate() c2 = gm.Coordinate(1) c3 = gm.Coordinate(1, 2) print c1.toString() print c2.toString() print c3.toString() c4 = gm.Coordinate(1, 2) c5 = gm.Coordinate(3, 4) print gm.Coordinate.equals(c3, c4) print gm.Coordinate.equals(c3, c5) c6 = c4.clone() c7 = c6.clone() print gm.Coordi...
[ [ 1, 0, 0.0455, 0.0455, 0, 0.66, 0, 190, 0, 1, 0, 0, 190, 0, 0 ], [ 14, 0, 0.1364, 0.0455, 0, 0.66, 0.0556, 452, 3, 0, 0, 0, 782, 10, 1 ], [ 14, 0, 0.1818, 0.0455, 0, ...
[ "import goog.math as gm", "c1 = gm.Coordinate()", "c2 = gm.Coordinate(1)", "c3 = gm.Coordinate(1, 2)", "print(c1.toString())", "print(c2.toString())", "print(c3.toString())", "c4 = gm.Coordinate(1, 2)", "c5 = gm.Coordinate(3, 4)", "print(gm.Coordinate.equals(c3, c4))", "print(gm.Coordinate.equal...
import goog.json strd = goog.json.serialize({ 'a': 45, 'b': [ 1, 2, 3, 4, { 'c': "stuff", 'd': "things", }], 'xyzzy': False, 'blorp': True }) print strd print goog.json.unsafeParse(strd) print goog.json.serialize(goog.json.unsafeParse(strd)) == strd
[ [ 1, 0, 0.0667, 0.0667, 0, 0.66, 0, 575, 0, 1, 0, 0, 575, 0, 0 ], [ 14, 0, 0.5, 0.6667, 0, 0.66, 0.25, 75, 3, 1, 0, 0, 50, 10, 1 ], [ 8, 0, 0.8667, 0.0667, 0, 0.66,...
[ "import goog.json", "strd = goog.json.serialize({\n 'a': 45,\n 'b': [\n 1, 2, 3, 4, {\n 'c': \"stuff\",\n 'd': \"things\",\n }],\n 'xyzzy': False,", "print(strd)", "print(goog.json.unsafeParse(strd))", "print(goog.json.serialize(goog.json.unsafeParse(strd)) == st...
import goog.math as gm K = 10000 def main(): print gm.clamp(408, 10, 100) print gm.modulo(-10, 3) print gm.lerp(0, 14, 0.25) a = 14 b = 14.0001 print gm.nearlyEquals(a, b) print gm.nearlyEquals(a, b, 0.01) print gm.standardAngle(480) print gm.toRadians(170) print gm.toDegrees(2...
[ [ 1, 0, 0.02, 0.02, 0, 0.66, 0, 190, 0, 1, 0, 0, 190, 0, 0 ], [ 14, 0, 0.06, 0.02, 0, 0.66, 0.3333, 126, 1, 0, 0, 0, 0, 1, 0 ], [ 2, 0, 0.5, 0.82, 0, 0.66, 0.66...
[ "import goog.math as gm", "K = 10000", "def main():\n print(gm.clamp(408, 10, 100))\n print(gm.modulo(-10, 3))\n print(gm.lerp(0, 14, 0.25))\n a = 14\n b = 14.0001\n print(gm.nearlyEquals(a, b))\n print(gm.nearlyEquals(a, b, 0.01))", " print(gm.clamp(408, 10, 100))", " print(gm.mo...
import goog.json print goog.json.parse # random sample from json.org obj = goog.json.parse(""" { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortA...
[ [ 1, 0, 0.0345, 0.0345, 0, 0.66, 0, 575, 0, 1, 0, 0, 575, 0, 0 ], [ 8, 0, 0.1034, 0.0345, 0, 0.66, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 14, 0, 0.569, 0.8276, 0, 0....
[ "import goog.json", "print(goog.json.parse)", "obj = goog.json.parse(\"\"\"\n{\n \"glossary\": {\n \"title\": \"example glossary\",\n \"GlossDiv\": {\n \"title\": \"S\",\n \"GlossList\": {\n \"GlossEntry\": {", "print(obj)" ]
import goog.math as gm v0 = gm.Vec2(10, 12) print "ctor", v0 v1 = gm.Vec2.randomUnit() print "randomunit", gm.nearlyEquals(v1.magnitude(), 1.0); v2 = gm.Vec2.random() # todo; attr access #print v2.x >= -1 and v2.x <= 1, v2.y >= -1 and v2.y <= 1 v3 = gm.Vec2.fromCoordinate(gm.Coordinate(4, 5)) print "fromcoord", v3 ...
[ [ 1, 0, 0.0204, 0.0204, 0, 0.66, 0, 190, 0, 1, 0, 0, 190, 0, 0 ], [ 14, 0, 0.0612, 0.0204, 0, 0.66, 0.0303, 745, 3, 2, 0, 0, 198, 10, 1 ], [ 8, 0, 0.0816, 0.0204, 0, ...
[ "import goog.math as gm", "v0 = gm.Vec2(10, 12)", "print(\"ctor\", v0)", "v1 = gm.Vec2.randomUnit()", "v2 = gm.Vec2.random()", "v3 = gm.Vec2.fromCoordinate(gm.Coordinate(4, 5))", "print(\"fromcoord\", v3)", "v4 = v3.clone()", "print(\"clone\", v4)", "print(\"mag\", v4.magnitude())", "print(\"mag...
from goog.json import parse as jparse print jparse(''' {"x":5, "y":6, "z":[3.1, 4.7, 5.6]} ''')
[ [ 1, 0, 0.5, 0.5, 0, 0.66, 0, 575, 0, 1, 0, 0, 575, 0, 0 ] ]
[ "from goog.json import parse as jparse" ]
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
[ [ 14, 0, 0.0557, 0.0033, 0, 0.66, 0, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0689, 0.0033, 0, 0.66, 0.0333, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0721, 0.0033, 0, 0...
[ "__author__ = 'afshar@google.com (Ali Afshar)'", "import os", "import httplib2", "import sessions", "from google.appengine.ext import db", "from google.appengine.ext.webapp import template", "from apiclient.discovery import build_from_document", "from apiclient.http import MediaUpload", "from oauth2...
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
[ [ 14, 0, 0.0281, 0.0017, 0, 0.66, 0, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0347, 0.0017, 0, 0.66, 0.0303, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 8, 0, 0.0364, 0.0017, 0, 0...
[ "__author__ = 'afshar@google.com (Ali Afshar)'", "import sys", "sys.path.insert(0, 'lib')", "import os", "import httplib2", "import sessions", "from google.appengine.ext import webapp", "from google.appengine.ext.webapp.util import run_wsgi_app", "from google.appengine.ext import db", "from google...
#!/usr/bin/env python # Copyright (c) 2010, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this l...
[ [ 8, 0, 0.1818, 0.0267, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.2032, 0.0053, 0, 0.66, 0.2, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 3, 0, 0.2219, 0.0107, 0, 0.66, ...
[ "\"\"\"Module to enforce different constraints on flags.\n\nA validator represents an invariant, enforced over a one or more flags.\nSee 'FLAGS VALIDATORS' in gflags.py's docstring for a usage manual.\n\"\"\"", "__author__ = 'olexiy@google.com (Olexiy Oryeshko)'", "class Error(Exception):\n \"\"\"Thrown If val...
#!/usr/bin/python2.4 # -*- coding: utf-8 -*- # # Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
[ [ 1, 0, 0.0738, 0.0041, 0, 0.66, 0, 177, 0, 1, 0, 0, 177, 0, 0 ], [ 1, 0, 0.0779, 0.0041, 0, 0.66, 0.0625, 154, 0, 1, 0, 0, 154, 0, 0 ], [ 1, 0, 0.082, 0.0041, 0, 0...
[ "import base64", "import hashlib", "import logging", "import time", "from OpenSSL import crypto", "from anyjson import simplejson", "CLOCK_SKEW_SECS = 300 # 5 minutes in seconds", "AUTH_TOKEN_LIFETIME_SECS = 300 # 5 minutes in seconds", "MAX_TOKEN_LIFETIME_SECS = 86400 # 1 day in seconds", "cla...
# Copyright 2011 Google Inc. All Rights Reserved. """Multi-credential file store with lock support. This module implements a JSON credential store where multiple credentials can be stored in one file. That file supports locking both in a single process and across processes. The credential themselves are keyed off o...
[ [ 8, 0, 0.0437, 0.0741, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0847, 0.0026, 0, 0.66, 0.0588, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0899, 0.0026, 0, 0.66,...
[ "\"\"\"Multi-credential file store with lock support.\n\nThis module implements a JSON credential store where multiple\ncredentials can be stored in one file. That file supports locking\nboth in a single process and across processes.\n\nThe credential themselves are keyed off of:\n* client_id", "__author__ = 'jb...
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
[ [ 8, 0, 0.5312, 0.1562, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.6562, 0.0312, 0, 0.66, 0.5, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 7, 0, 0.875, 0.2812, 0, 0.66, ...
[ "\"\"\"Utility module to import a JSON module\n\nHides all the messy details of exactly where\nwe get a simplejson module from.\n\"\"\"", "__author__ = 'jcgregorio@google.com (Joe Gregorio)'", "try: # pragma: no cover\n # Should work for Python2.6 and higher.\n import json as simplejson\nexcept ImportError: #...
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
[ [ 8, 0, 0.0145, 0.0035, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0176, 0.0009, 0, 0.66, 0.0244, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0193, 0.0009, 0, 0.66,...
[ "\"\"\"An OAuth 2.0 client.\n\nTools for interacting with OAuth 2.0 protected resources.\n\"\"\"", "__author__ = 'jcgregorio@google.com (Joe Gregorio)'", "import base64", "import clientsecrets", "import copy", "import datetime", "import httplib2", "import logging", "import os", "import sys", "im...