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