#NEWLINE# @ functools . wraps ( Cost . get_monitoring_channels ) #NEWLINE# def get_monitoring_channels( self , model , data , **kwargs ) : #NEWLINE# #INDENT# self . get_data_specs ( model ) [ 0 ] . validate ( data ) #NEWLINE# rval = OrderedDict ( ) #NEWLINE# ( composite_specs , mapping ) = self . get_composite_specs_and_mapping ( model ) #NEWLINE# nested_data = mapping . nest ( data ) #NEWLINE# for ( i , cost ) in enumerate ( self . costs ) : #NEWLINE# #INDENT# cost_data = nested_data [ i ] #NEWLINE# try : #NEWLINE# #INDENT# channels = cost . get_monitoring_channels ( model , cost_data , ** kwargs ) #NEWLINE# rval . update ( channels ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# reraise_as ( Exception ( 'SumOfCosts.get_monitoring_channels encountered TypeError while calling {0}.get_monitoring_channels' . format ( type ( cost ) ) ) ) #NEWLINE# #UNINDENT# value = cost . expr ( model , cost_data , ** kwargs ) #NEWLINE# if ( value is not None ) : #NEWLINE# #INDENT# name = '' #NEWLINE# if ( hasattr ( value , 'name' ) and ( value . name is not None ) ) : #NEWLINE# #INDENT# name = ( '_' + value . name ) #NEWLINE# #UNINDENT# rval [ ( ( 'term_' + str ( i ) ) + name ) ] = value #NEWLINE# #UNINDENT# #UNINDENT# return rval