You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/econtext/utils.py

18 lines
352 B
Python

import econtext
def run_with_broker(func, *args, **kwargs):
broker = econtext.Broker()
try:
return func(broker, *args, **kwargs)
finally:
broker.Finalize()
def with_broker(func):
def wrapper(*args, **kwargs):
return run_with_broker(*args, **kwargs)
wrapper.func_name = func.func_name
return wrapper