MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / positional_deprecated

Function positional_deprecated

lm-eval-harness/lm_eval/utils.py:274–290  ·  view source on GitHub ↗

A decorator to nudge users into passing only keyword args (`kwargs`) to the wrapped function, `fn`.

(fn)

Source from the content-addressed store, hash-verified

272
273
274def positional_deprecated(fn):
275 """
276 A decorator to nudge users into passing only keyword args (`kwargs`) to the
277 wrapped function, `fn`.
278 """
279
280 @functools.wraps(fn)
281 def _wrapper(*args, **kwargs):
282 if len(args) != 1 if inspect.ismethod(fn) else 0:
283 print(
284 f"WARNING: using {fn.__name__} with positional arguments is "
285 "deprecated and will be disallowed in a future version of "
286 "lm-evaluation-harness!"
287 )
288 return fn(*args, **kwargs)
289
290 return _wrapper
291
292
293@positional_deprecated

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected