def create_broker(root=None): if not root: broker = dr.Broker() broker[HostContext] = HostContext() yield broker else: def from_dir(d): # ctx is returned here, but its already in the broker so not needed _, broker = initialize_broker(d) return broker if os.path.isdir(root): yield from_dir(root) else: with extract(root) as ex: yield from_dir(ex.tmp_dir)
def create_broker(root=None): if not root: broker = dr.Broker() broker[HostContext] = HostContext() yield broker else: def from_dir(d): broker = dr.Broker() ctx = create_context(d, None) broker[ctx.__class__] = ctx return broker if os.path.isdir(root): yield from_dir(root) else: with extract(root) as ex: yield from_dir(ex.tmp_dir)