MCPcopy Create free account
hub / github.com/10Ring/LAA-Net / wrap

Function wrap

register/misc.py:205–221  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

203 """
204
205 def wrap(func):
206
207 @functools.wraps(func)
208 def wrapped_func(*args, **kwargs):
209 requirements = [prerequisites] if isinstance(
210 prerequisites, str) else prerequisites
211 missing = []
212 for item in requirements:
213 if not checker(item):
214 missing.append(item)
215 if missing:
216 print(msg_tmpl.format(', '.join(missing), func.__name__))
217 raise RuntimeError('Prerequisites not meet.')
218 else:
219 return func(*args, **kwargs)
220
221 return wrapped_func
222
223 return wrap
224

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected