MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / positional_deprecated

Function positional_deprecated

test/general/lm_eval/utils.py:229–245  ·  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

227
228
229def positional_deprecated(fn):
230 """
231 A decorator to nudge users into passing only keyword args (`kwargs`) to the
232 wrapped function, `fn`.
233 """
234
235 @functools.wraps(fn)
236 def _wrapper(*args, **kwargs):
237 if len(args) != 1 if inspect.ismethod(fn) else 0:
238 print(
239 f"WARNING: using {fn.__name__} with positional arguments is "
240 "deprecated and will be disallowed in a future version of "
241 "lm-evaluation-harness!"
242 )
243 return fn(*args, **kwargs)
244
245 return _wrapper
246
247
248@positional_deprecated

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected