@curry
def delayed(obj, name=None, pure=False, nout=None, traverse=True):
 if isinstance(obj, Delayed):
  return obj
 if (isinstance(obj, base.Base) or traverse):
  (task, dasks) = to_task_dasks(obj)
 else:
  task = quote(obj)
  dasks = []
 if (task is obj):
  if (not ((nout is None) or ((type(nout) is int) and (nout >= 0)))):
   raise ValueError(('nout must be None or a positive integer, got %s' % nout))
  if (not name):
   try:
    prefix = obj.__name__
   except AttributeError:
    prefix = type(obj).__name__
   token = tokenize(obj, nout, pure=pure)
   name = ('%s-%s' % (prefix, token))
  return DelayedLeaf(obj, name, pure=pure, nout=nout)
 else:
  if (not name):
   name = ('%s-%s' % (type(obj).__name__, tokenize(task, pure=pure)))
  dasks.append({name: task})
  return Delayed(name, dasks)

@ curry def delayed ( obj , name = None , pure = False , nout = None , traverse = True ) : if isinstance ( obj , Delayed ) : return obj if ( isinstance ( obj , base . Base ) or traverse ) : ( task , dasks ) = to_task_dasks ( obj ) else : task = quote ( obj ) dasks = [ ] if ( task is obj ) : if ( not ( ( nout is None ) or ( ( type ( nout ) is int ) and ( nout >= 0 ) ) ) ) : raise ValueError ( ( 'nout must be None or a positive integer, got %s' % nout ) ) if ( not name ) : try : prefix = obj . __name__ except AttributeError : prefix = type ( obj ) . __name__ token = tokenize ( obj , nout , pure = pure ) name = ( '%s-%s' % ( prefix , token ) ) return DelayedLeaf ( obj , name , pure = pure , nout = nout ) else : if ( not name ) : name = ( '%s-%s' % ( type ( obj ) . __name__ , tokenize ( task , pure = pure ) ) ) dasks . append ( { name : task } ) return Delayed ( name , dasks )
decorator used to capture the arguments of a function .