MCPcopy Create free account
hub / github.com/ZiniuLu/Python-100-Days / wrapper

Method wrapper

Day66-75/code/main_redis.py:44–51  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

42 def __call__(self, fn):
43
44 def wrapper(*args, **kwargs):
45 for _ in range(self.retry_times):
46 try:
47 return fn(*args, **kwargs)
48 except self.errors as e:
49 print(e)
50 sleep((random() + 1) * self.wait_secs)
51 return None
52
53 return wrapper
54

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected