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