def build(*onts, fail=False, n_jobs=9, write=True):
    """ Set n_jobs=1 for debug or embed() will crash. """
    tail = lambda:tuple()
    lonts = len(onts)
    if lonts > 1:
        for i, ont in enumerate(onts):
            if ont.__name__ == 'parcBridge':
                onts = onts[:-1]
                def tail(o=ont):
                    return o.setup(),
                if i != lonts - 1:
                    raise ValueError('parcBridge should be built last to avoid weird errors!')
    # ont_setup must be run first on all ontologies
    # or we will get weird import errors
    if n_jobs == 1 or True:
        return tuple(ont.make(fail=fail, write=write) for ont in
                     tuple(ont.setup() for ont in onts) + tail())

    # have to use a listcomp so that all calls to setup()
    # finish before parallel goes to work
    return Parallel(n_jobs=n_jobs)(delayed(o.make)(fail=fail, write=write)
                                   for o in
                                   #[ont_setup(ont) for ont in onts])
                                   (tuple(Async()(deferred(ont.setup)()
                                                  for ont in onts)) + tail()
                                    if n_jobs > 1
                                    else [ont.setup()
                                          for ont in onts]))
def build ( * onts , fail = False , n_jobs = 9 , write = True ) : tail = lambda : tuple ( ) lonts = len ( onts ) if lonts > 1 : for i , ont in enumerate ( onts ) : if ont . __name__ == 'parcBridge' : onts = onts [ : - 1 ] def tail ( o = ont ) : return o . setup ( ) , if i != lonts - 1 : raise ValueError ( 'parcBridge should be built last to avoid weird errors!' ) if n_jobs == 1 or True : return tuple ( ont . make ( fail = fail , write = write ) for ont in tuple ( ont . setup ( ) for ont in onts ) + tail ( ) ) return Parallel ( n_jobs = n_jobs ) ( delayed ( o . make ) ( fail = fail , write = write ) for o in ( tuple ( Async ( ) ( deferred ( ont . setup ) ( ) for ont in onts ) ) + tail ( ) if n_jobs > 1 else [ ont . setup ( ) for ont in onts ] ) )
Set n_jobs=1 for debug or embed() will crash.