#NEWLINE# def __init__( self , dependencies = [ ] , all = True , success = True , failure = False ) : #NEWLINE# #INDENT# if isinstance ( dependencies , dict ) : #NEWLINE# #INDENT# all = dependencies . get ( 'all' , True ) #NEWLINE# success = dependencies . get ( 'success' , success ) #NEWLINE# failure = dependencies . get ( 'failure' , failure ) #NEWLINE# dependencies = dependencies . get ( 'dependencies' , [ ] ) #NEWLINE# #UNINDENT# ids = [ ] #NEWLINE# if isinstance ( dependencies , ( str , AsyncResult ) ) : #NEWLINE# #INDENT# dependencies = [ dependencies ] #NEWLINE# #UNINDENT# for d in dependencies : #NEWLINE# #INDENT# if isinstance ( d , str ) : #NEWLINE# #INDENT# ids . append ( d ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( d , AsyncResult ) : #NEWLINE# #INDENT# ids . extend ( d . msg_ids ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( ( 'invalid dependency type: %r' % type ( d ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# set . __init__ ( self , ids ) #NEWLINE# self . all = all #NEWLINE# if ( not ( success or failure ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Must depend on at least one of successes or failures!' ) #NEWLINE# #UNINDENT# self . success = success #NEWLINE# self . failure = failure