#NEWLINE# def driver_map( driver , inputs , outputs ) : #NEWLINE# #INDENT# ' Return mapped names for `driver` as ``(inputs, outputs)``. ' #NEWLINE# if hasattr ( driver , 'parent' ) : #NEWLINE# #INDENT# prefix = driver . parent . get_pathname ( ) #NEWLINE# if prefix : #NEWLINE# #INDENT# prefix += '.' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# prefix = '' #NEWLINE# #UNINDENT# pseudos = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if hasattr ( driver , 'eval_objectives' ) : #NEWLINE# #INDENT# for obj in driver . get_objectives ( ) . values ( ) : #NEWLINE# #INDENT# pseudos [ obj . pcomp_name ] = ( 'Objective(%s)' % obj ) #NEWLINE# #UNINDENT# #UNINDENT# if hasattr ( driver , 'eval_responses' ) : #NEWLINE# #INDENT# for response in driver . get_responses ( ) . values ( ) : #NEWLINE# #INDENT# pseudos [ response . pcomp_name ] = ( 'Response(%s)' % response ) #NEWLINE# #UNINDENT# #UNINDENT# constraints = [ ] #NEWLINE# if hasattr ( driver , 'get_eq_constraints' ) : #NEWLINE# #INDENT# constraints . extend ( driver . get_eq_constraints ( ) . values ( ) ) #NEWLINE# #UNINDENT# if hasattr ( driver , 'get_ineq_constraints' ) : #NEWLINE# #INDENT# constraints . extend ( driver . get_ineq_constraints ( ) . values ( ) ) #NEWLINE# #UNINDENT# for con in constraints : #NEWLINE# #INDENT# pseudos [ con . pcomp_name ] = ( 'Constraint(%s)' % con ) #NEWLINE# #UNINDENT# outputs = [ ( pseudos [ name ] if ( name in pseudos ) else name ) for name in outputs ] #NEWLINE# return ( [ ( prefix + name ) for name in inputs ] , [ ( prefix + pseudos ) for name in outputs ] )