MCPcopy Create free account
hub / github.com/alibaba/BladeDISC / wrapper

Function wrapper

scripts/python/common_setup.py:56–74  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

54def time_stage(incl_args=[], incl_kwargs=[]):
55 def time_stage_impl(entry):
56 def wrapper(*args, **kwargs):
57 start = time.time()
58 try:
59 ret = entry(*args, **kwargs)
60 except Exception:
61 logger.exception("{} failed on exception".format(entry.__name__))
62 raise Exception("run error")
63 finally:
64 end = time.time()
65 name = entry.__name__
66 if len(incl_args) > 0 or len(incl_kwargs) > 0:
67 name += "("
68 for idx in incl_args:
69 name += args[idx] + ","
70 for k in incl_kwargs:
71 name += kwargs[k] + ","
72 name = name[:-1] + ")"
73 stage_time.append(name, end - start)
74 return ret
75
76 return wrapper
77

Callers

nothing calls this directly

Calls 2

formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected