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

Method wrapper

Day66-75/code/main.py:39–46  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

37 def __call__(self, fn):
38
39 def wrapper(*args, **kwargs):
40 for _ in range(self.retry_times):
41 try:
42 return fn(*args, **kwargs)
43 except self.errors as e:
44 print(e)
45 sleep((random() + 1) * self.wait_secs)
46 return None
47
48 return wrapper
49

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected