Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def storage_dict():
storage = StorageDict()
storage.ring = ring.dict
storage.is_binary = False
storage.has_has = True
storage.has_touch = True
storage.has_expire = True
return storage
@ring.dict({}, ignorable_keys=['ignorable'])
def f(n, ignorable):
return n + ignorable
@ring.dict({})
async def g(a: int, b: str) -> float:
pass
def test_proxy_repr():
@ring.dict({})
def f():
pass
assert repr(ring.dict)
assert repr(ring.dict({}))
assert repr(f)
@ring.dict(cache, ignorable_keys=['use_cache'])
def fibonacci(n, use_cache):
if use_cache:
raise RuntimeError('it is not cached!')
if n <= 1:
return n
return fibonacci(n - 2, use_cache) + fibonacci(n - 1, use_cache)
@ring.dict({}, ignorable_keys=['ignorable'])
def f(n, ignorable):
return n + ignorable
@ring.dict({})
def f():
pass
@ring.dict(cache, expire=1)
def f(a, b):
return a * 100 + b
@ring.dict(storage)
@classmethod
@asyncio.coroutine
def cmethod(cls, a, b):
return base + a * 200 + b
@ring.dict(cache)
def child(self, n):
return {'child_id': self.user_id * 10000 + n}