A decorator to nudge users into passing only keyword args (`kwargs`) to the wrapped function, `fn`.
(fn)
| 272 | |
| 273 | |
| 274 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected