You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return eval(predicate, sys._getframe(2).f_globals, params) if predicate else True
def when(condition=""):
def decorator(func):
Guard.register(func, condition)
def dispatcher(**args):
possibles = [method for (method, predicate) in Guard.dispatch_table if method.__name__ == func.__name__ and Guard.satisfies_predicate(predicate, args)]
return possibles[0](**args) if possibles else func(**args)