Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def runme(arxiv, expected=None):
pm = picklemap(serializer='dill')
@memoized(cache=arxiv, keymap=pm)
def doit(x):
return x
doit(1)
doit('2')
doit(data)
doit(lambda x:x**2)
doit.load()
doit.dump()
c = doit.__cache__()
r = getattr(c, '__archive__', '')
info = doit.info()
ck = c.keys()
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert _keygen(min, [0,1], 0) == ((NULL,), {}) if IS_PYPY else ((0,), {})
assert _keygen(min, ['*'], 0) == ((), {}) if IS_PYPY else ((0,), {})
assert signature(p, safe=True) == (None, None, None, None)
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert _keygen(min, [0,1], 0) == ((NULL,), {}) if IS_PYPY else ((0,), {})
assert _keygen(min, ['*'], 0) == ((), {}) if IS_PYPY else ((0,), {})
if IS_PYPY: # builtins in PYPY are python functions
assert signature(pow, safe=True) == (('base', 'exponent', 'modulus'), {'modulus': None}, '', '')
else:
assert signature(pow, safe=True) == (None, None, None, None)
assert signature(p, safe=True) == (None, None, None, None)
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert signature(pow, safe=True) == (('base', 'exponent', 'modulus'), {'modulus': None}, '', '')
else:
assert signature(pow, safe=True) == (None, None, None, None)
assert signature(p, safe=True) == (None, None, None, None)
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert _keygen(min, [0,1], 0) == ((NULL,), {}) if IS_PYPY else ((0,), {})
if IS_PYPY: # builtins in PYPY are python functions
assert signature(pow, safe=True) == (('base', 'exponent', 'modulus'), {'modulus': None}, '', '')
else:
assert signature(pow, safe=True) == (None, None, None, None)
assert signature(p, safe=True) == (None, None, None, None)
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert signature(pow, safe=True) == (None, None, None, None)
assert signature(p, safe=True) == (None, None, None, None)
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert _keygen(min, [0,1], 0) == ((NULL,), {}) if IS_PYPY else ((0,), {})
assert _keygen(min, ['*'], 0) == ((), {}) if IS_PYPY else ((0,), {})
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert _keygen(min, [0,1], 0) == ((NULL,), {}) if IS_PYPY else ((0,), {})
assert _keygen(min, ['*'], 0) == ((), {}) if IS_PYPY else ((0,), {})
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})
assert _keygen(p2, [], 0) == ((), {'x': 0, 'z': 0})
assert _keygen(p, [], 0) == ((0,), {})
assert _keygen(min, [], x=0,y=1) == ((), {'y': 1, 'x': 0})
assert _keygen(min, [], 0,1) == ((0,1), {})
assert _keygen(min, [], 0) == ((0,), {})
assert _keygen(min, 'x', 0) == ((0,), {})
assert _keygen(min, ['x','y'], 0) == ((0,), {})
assert _keygen(min, [0,1], 0) == ((NULL,), {}) if IS_PYPY else ((0,), {})
assert _keygen(min, ['*'], 0) == ((), {}) if IS_PYPY else ((0,), {})
def test_special():
p = partial(add, 0,x=0)
p2 = partial(add, z=0)
p3 = partial(add, 0)
if IS_PYPY: # builtins in PYPY are python functions
assert signature(pow, safe=True) == (('base', 'exponent', 'modulus'), {'modulus': None}, '', '')
else:
assert signature(pow, safe=True) == (None, None, None, None)
assert signature(p, safe=True) == (None, None, None, None)
assert signature(p2, safe=True) == (('x', 'y'), {'z': 0}, '', '')
assert signature(p3, safe=True) == (('y',), {'!x': 0}, '', '')
if IS_PYPY: # PYPY bug in ArgSpec for min, so use pow
assert isvalid(pow, 0,1) == True
assert isvalid(pow, 0) == False
assert isvalid(pow) == False
else: # python >= 3.5 bug in ArgSpec for pow, so use min
assert isvalid(min, 0,1) == True
assert isvalid(min, 0) == False
assert isvalid(min) == False
assert isvalid(p, 0,1) == False
assert isvalid(p, 0) == False
assert isvalid(p) == False
assert isvalid(p2, 0,1) == False
assert isvalid(p2, 0) == False
assert isvalid(p2) == False
assert isvalid(p3, 0,1) == False
assert isvalid(p3, 0) == True
assert isvalid(p3) == False
assert _keygen(p3, [], 0) == ((), {'y': 0})