@contextlib.contextmanager
def register_dispatcher(disp):
 assert callable(disp)
 assert callable(disp.py_func)
 name = disp.py_func.__name__
 _temporary_dispatcher_map[name] = disp
 try:
  (yield)
 finally:
  del _temporary_dispatcher_map[name]

@ contextlib . contextmanager def register_dispatcher ( disp ) : assert callable ( disp ) assert callable ( disp . py_func ) name = disp . py_func . __name__ _temporary_dispatcher_map [ name ] = disp try : ( yield ) finally : del _temporary_dispatcher_map [ name ]
register a dispatcher for inference while it is not yet stored as global or closure variable (e .