| f | import inspect | f | import inspect |
| | | |
| n | def banned(*ban_funcs): | n | def banned(*funs): |
| | | |
| n | def decorator(fun): | n | def decorator(function): |
| | | |
| t | def newfun(*args, **kwargs): | t | def wrapper(*args, **kwargs): |
| for i in reversed(inspect.stack()): | | for elem in reversed(inspect.stack()): |
| for j in ban_funcs: | | for fun in funs: |
| if i.frame.f_code is j.__code__: | | if elem.frame.f_code == fun.__code__: |
| raise RuntimeError(i.function) | | raise RuntimeError(elem.function) |
| return fun(*args, **kwargs) | | return function(*args, **kwargs) |
| return newfun | | return wrapper |
| return decorator | | return decorator |